♻️Refactor: 优化代码结构和调整提示词
This commit is contained in:
@@ -4,9 +4,6 @@ import (
|
||||
"agent/agent"
|
||||
"agent/response_struct"
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"sync"
|
||||
|
||||
"github.com/tmc/langchaingo/llms"
|
||||
)
|
||||
@@ -48,43 +45,3 @@ func GetScenario(llm llms.Model, ctx context.Context, topic string) (response re
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user