refactor: use consistent context variable throughout the code (#40)

update: update the todoagent ctx
drew/english
Scott9(阵雨) 1 year ago committed by GitHub
parent 5dce8ffab4
commit 55e069c734
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -58,7 +58,7 @@ func main() {
} }
// 创建并配置 ChatModel // 创建并配置 ChatModel
chatModel, err := openai.NewChatModel(context.Background(), &openai.ChatModelConfig{ chatModel, err := openai.NewChatModel(ctx, &openai.ChatModelConfig{
Model: "gpt-4o", Model: "gpt-4o",
APIKey: openAIAPIKey, APIKey: openAIAPIKey,
Temperature: gptr.Of(float32(0.7)), Temperature: gptr.Of(float32(0.7)),
@ -88,7 +88,7 @@ func main() {
} }
// 创建 tools 节点 // 创建 tools 节点
todoToolsNode, err := compose.NewToolNode(context.Background(), &compose.ToolsNodeConfig{ todoToolsNode, err := compose.NewToolNode(ctx, &compose.ToolsNodeConfig{
Tools: todoTools, Tools: todoTools,
}) })
if err != nil { if err != nil {

Loading…
Cancel
Save