♻️Refactor: 解耦chatAgent调用

This commit is contained in:
2026-03-22 21:25:36 +08:00
parent d69b9a371e
commit 67a23fbaa2
2 changed files with 34 additions and 16 deletions
+24
View File
@@ -0,0 +1,24 @@
package agent
import (
"context"
"fmt"
"log"
"github.com/tmc/langchaingo/llms"
)
func Call(llm llms.Model, ctx context.Context) {
response, err := llms.GenerateFromSinglePrompt(
ctx,
llm,
"Hello! My name is wonder!",
)
if err != nil {
log.Fatal(err)
}
fmt.Println("AI:", response)
}