package handle import ( "agent/agent" "agent/response_struct" "context" "fmt" "sync" "github.com/tmc/langchaingo/llms" ) var files = []string{ ".\\prompt\\card.txt", ".\\prompt\\guodegang.txt", ".\\prompt\\mermaid.txt", ".\\prompt\\quiz.txt", ".\\prompt\\scenario.txt", } func GetCard(llm llms.Model, ctx context.Context, topic string) (response response_struct.Card) { file := files[0] response = agent.CallWithAgentDefined(llm, ctx, topic, file, response_struct.Card{}) return } func GetGuodegang(llm llms.Model, ctx context.Context, topic string) (response response_struct.Guodegang) { file := files[1] response = agent.CallWithAgentDefined(llm, ctx, topic, file, response_struct.Guodegang{}) return } func GetMermaid(llm llms.Model, ctx context.Context, topic string) (response response_struct.Mermaid) { file := files[2] response = agent.CallWithAgentDefined(llm, ctx, topic, file, response_struct.Mermaid{}) return } func GetQuiz(llm llms.Model, ctx context.Context, topic string) (response response_struct.Quiz) { file := files[3] response = agent.CallWithAgentDefined(llm, ctx, topic, file, response_struct.Quiz{}) return } func GetScenario(llm llms.Model, ctx context.Context, topic string) (response response_struct.Scenario) { file := files[4] response = agent.CallWithAgentDefined(llm, ctx, topic, file, response_struct.Scenario{}) return } func GetAll(llm llms.Model, ctx context.Context, topic string) (response *response_struct.AllStruct) { var wg sync.WaitGroup wg.Add(len(files)) go func() { defer wg.Done() response.CardStruct = GetCard(llm, ctx, topic) }() go func() { defer wg.Done() response.GuodegangStruct = GetGuodegang(llm, ctx, topic) }() go func() { defer wg.Done() response.MermaidStruct = GetMermaid(llm, ctx, topic) }() go func() { defer wg.Done() response.QuizStruct = GetQuiz(llm, ctx, topic) }() go func() { defer wg.Done() response.ScenarioStruct = GetScenario(llm, ctx, topic) }() wg.Wait() fmt.Println("======== All responses received ========") return response }