✨Feat: 引入gin框架
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"agent/agent"
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"sync"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/joho/godotenv"
|
||||
"github.com/tmc/langchaingo/llms"
|
||||
"github.com/tmc/langchaingo/llms/openai"
|
||||
@@ -45,24 +44,12 @@ func init() {
|
||||
}
|
||||
|
||||
func main() {
|
||||
var wg sync.WaitGroup
|
||||
route := gin.Default()
|
||||
route.GET("/ping", func(c *gin.Context) {
|
||||
c.JSON(200, gin.H{
|
||||
"message": "pong",
|
||||
})
|
||||
})
|
||||
|
||||
files := []string{
|
||||
".\\prompt\\card.txt",
|
||||
".\\prompt\\guodegang.txt",
|
||||
".\\prompt\\mermaid.txt",
|
||||
".\\prompt\\quiz.txt",
|
||||
".\\prompt\\scenario.txt",
|
||||
}
|
||||
|
||||
wg.Add(len(files))
|
||||
|
||||
for _, file := range files {
|
||||
go func(f string) {
|
||||
defer wg.Done()
|
||||
agent.CallWithAgent(llm, ctx, "文件", f)
|
||||
}(file)
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
route.Run()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user