Files
langchain-go/backend/handlers/agent.go
T

48 lines
1.3 KiB
Go
Raw Normal View History

2026-03-23 13:44:45 +08:00
package handle
import (
"agent/agent"
2026-03-27 19:30:04 +08:00
"agent/response_struct"
2026-03-23 13:44:45 +08:00
"context"
"github.com/tmc/langchaingo/llms"
)
var files = []string{
".\\prompt\\card.txt",
".\\prompt\\guodegang.txt",
".\\prompt\\mermaid.txt",
".\\prompt\\quiz.txt",
".\\prompt\\scenario.txt",
}
2026-03-27 19:30:04 +08:00
func GetCard(llm llms.Model, ctx context.Context, topic string) (response response_struct.Card) {
2026-03-23 13:44:45 +08:00
file := files[0]
2026-03-27 19:30:04 +08:00
response = agent.CallWithAgentDefined(llm, ctx, topic, file, response_struct.Card{})
2026-03-23 13:44:45 +08:00
return
}
2026-03-27 19:30:04 +08:00
func GetGuodegang(llm llms.Model, ctx context.Context, topic string) (response response_struct.Guodegang) {
2026-03-23 13:44:45 +08:00
file := files[1]
2026-03-27 19:30:04 +08:00
response = agent.CallWithAgentDefined(llm, ctx, topic, file, response_struct.Guodegang{})
2026-03-23 13:44:45 +08:00
return
}
2026-03-27 19:30:04 +08:00
func GetMermaid(llm llms.Model, ctx context.Context, topic string) (response response_struct.Mermaid) {
2026-03-23 13:44:45 +08:00
file := files[2]
2026-03-27 19:30:04 +08:00
response = agent.CallWithAgentDefined(llm, ctx, topic, file, response_struct.Mermaid{})
2026-03-23 13:44:45 +08:00
return
}
2026-03-27 19:30:04 +08:00
func GetQuiz(llm llms.Model, ctx context.Context, topic string) (response response_struct.Quiz) {
2026-03-23 13:44:45 +08:00
file := files[3]
2026-03-27 19:30:04 +08:00
response = agent.CallWithAgentDefined(llm, ctx, topic, file, response_struct.Quiz{})
2026-03-23 13:44:45 +08:00
return
}
2026-03-27 19:30:04 +08:00
func GetScenario(llm llms.Model, ctx context.Context, topic string) (response response_struct.Scenario) {
2026-03-23 13:44:45 +08:00
file := files[4]
2026-03-27 19:30:04 +08:00
response = agent.CallWithAgentDefined(llm, ctx, topic, file, response_struct.Scenario{})
2026-03-23 13:44:45 +08:00
return
}