From 05105525e8c7975cceead5f8b9c76ae15600b916 Mon Sep 17 00:00:00 2001 From: Wonder Date: Mon, 23 Mar 2026 13:12:31 +0800 Subject: [PATCH] =?UTF-8?q?=20=E2=9C=A8Feat:=20=E5=8A=A0=E5=85=A5=E5=8D=8F?= =?UTF-8?q?=E7=A8=8B=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 95a341f..56b69dd 100644 --- a/main.go +++ b/main.go @@ -6,6 +6,7 @@ import ( "fmt" "log" "os" + "sync" "github.com/joho/godotenv" "github.com/tmc/langchaingo/llms" @@ -44,10 +45,24 @@ func init() { } func main() { + var wg sync.WaitGroup - agent.CallWithAgent(llm, ctx, "文件", ".\\prompt\\card.txt") - agent.CallWithAgent(llm, ctx, "文件", ".\\prompt\\guodegang.txt") - agent.CallWithAgent(llm, ctx, "文件", ".\\prompt\\mermaid.txt") - agent.CallWithAgent(llm, ctx, "文件", ".\\prompt\\quiz.txt") - agent.CallWithAgent(llm, ctx, "文件", ".\\prompt\\scenario.txt") + 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() }