✨Feat: 完成前端郭德纲教学卡片

This commit is contained in:
2026-03-27 20:30:49 +08:00
parent 541ca96fc6
commit c0414e7548
5 changed files with 124 additions and 2 deletions
+11
View File
@@ -5,6 +5,7 @@ import (
"fmt"
"log"
"os"
"strings"
"github.com/tmc/langchaingo/llms"
"github.com/tmc/langchaingo/outputparser"
@@ -98,10 +99,20 @@ func CallWithAgentDefined[T any](llm llms.Model, ctx context.Context, topic stri
llm,
"用户正在学习Go语言和React框架,你是用户的助手。\n"+prompt,
)
if err != nil {
log.Fatal(err)
}
if !strings.Contains(responseString, "```json") {
responseString = "```json\n" + responseString + "```"
}
fmt.Printf("AI: %s\n\n",responseString)
response, err = parse.Parse(responseString)
if err != nil {
fmt.Printf("Parse err: %v", err)