✨Feat: 完成前端郭德纲教学卡片
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user