From a950a7b025943aee33412ad4c776e5a57336300b Mon Sep 17 00:00:00 2001 From: renzhiyuan <465386466@qq.com> Date: Thu, 29 Jan 2026 15:06:08 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E6=96=B0=E5=A2=9EWord=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=88=86=E6=9E=90=E6=9C=8D=E5=8A=A1=E5=8F=8A=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/biz/advice.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/internal/biz/advice.go b/internal/biz/advice.go index 94ccd71..3f2eb1f 100644 --- a/internal/biz/advice.go +++ b/internal/biz/advice.go @@ -50,11 +50,14 @@ var dataMap = map[string]string{ func (a *AdviceBiz) WordAna(ctx context.Context, wordContent string) error { examples := a.getAllExamples() prompt := a.buildSimplePrompt(wordContent, examples) + os.WriteFile("requset.json", []byte(prompt), 0644) anaContent, err := a.callLlm(ctx, prompt) if err != nil { return err } + os.WriteFile("res.json", []byte(anaContent), 0644) data := a.parseResponse(anaContent) + jsonData, _ := json.MarshalIndent(data, "", " ") os.WriteFile("extracted.json", jsonData, 0644) fmt.Println("✅ 数据已保存到 extracted.json") @@ -88,15 +91,15 @@ func (a *AdviceBiz) buildSimplePrompt(wordContent string, examples map[string]st 对话内容: %s -请按照以下` + fmt.Sprintf("%d", len(examples)) + `个格式生成JSON数据,每个格式用===分隔: +请按照以下` + fmt.Sprintf("%d", len(examples)) + `个格式生成JSON数据,key为格式名称,value为对应值: %s 输出要求: 1. 每个结构体一个JSON对象 -2. 严格按照示例格式 -3. 用空行分隔不同结构体` - +2. 所有内容必须严格基于提供的对话原文,不得编造 +3. 严格按照示例格式 +4. 将上述生成的` + fmt.Sprintf("%d", len(examples)) + `个JSON对象,json不需要有可读性,不要有特殊符号,比如"\n",用map[string]json来包裹所有json对象:{"SupportingFacilities":{...},"SignatureDialogues":[{...},{...}]}` // 构建格式部分 var formats strings.Builder for name, example := range examples {