✨Feat: 引入gin框架

This commit is contained in:
2026-03-23 13:26:27 +08:00
parent 8adb2f6065
commit c8396f1111
4 changed files with 120 additions and 34 deletions
+8 -21
View File
@@ -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()
}