From 041e9fad0b136f6ea2981cb7bb771671f822fa2c Mon Sep 17 00:00:00 2001 From: renzhiyuan <465386466@qq.com> Date: Wed, 11 Mar 2026 10:50:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E5=92=8C=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/biz/llm_service/third_party/hsyq.go | 9 ++-- internal/services/advice/advicer_test.go | 43 ++++++++++++-------- internal/services/advice/chat_test.go | 2 +- internal/services/advice/client_test.go | 2 +- 4 files changed, 34 insertions(+), 22 deletions(-) diff --git a/internal/biz/llm_service/third_party/hsyq.go b/internal/biz/llm_service/third_party/hsyq.go index 2a9eb9d..8b73b9f 100644 --- a/internal/biz/llm_service/third_party/hsyq.go +++ b/internal/biz/llm_service/third_party/hsyq.go @@ -92,8 +92,10 @@ func (h *Hsyq) CreateResponse(ctx context.Context, key string, modelName string, ListValue: &responses.InputItemList{ListValue: prompt}, }, }, - Stream: new(bool), - Thinking: &responses.ResponsesThinking{Type: responses.ThinkingType_disabled.Enum()}, + Stream: new(bool), + Reasoning: &responses.ResponsesReasoning{Effort: responses.ReasoningEffort_minimal}, + Thinking: &responses.ResponsesThinking{Type: responses.ThinkingType_disabled.Enum()}, + Text: &responses.ResponsesText{Format: &responses.TextFormat{Type: responses.TextType_json_object}}, } if isRegis { prefix := true @@ -125,7 +127,8 @@ func (h *Hsyq) RequestHsyqJson(ctx context.Context, key string, modelName string ListValue: &responses.InputItemList{ListValue: prompt}, }, }, - Stream: new(bool), + Stream: new(bool), + Thinking: &responses.ResponsesThinking{Type: responses.ThinkingType_disabled.Enum()}, Text: &responses.ResponsesText{Format: &responses.TextFormat{Type: responses.TextType_json_object}}, } diff --git a/internal/services/advice/advicer_test.go b/internal/services/advice/advicer_test.go index 056ac9f..cd89b7a 100644 --- a/internal/services/advice/advicer_test.go +++ b/internal/services/advice/advicer_test.go @@ -21,7 +21,7 @@ import ( func Test_WordAna(t *testing.T) { Run(context.Background(), nil) - ana, err := file.WordAnat("https://attachment-public.oss-cn-hangzhou.aliyuncs.com/ai-scheduler/data-analytics/word/content2.docx") + ana, err := fileService.WordAnat("https://attachment-public.oss-cn-hangzhou.aliyuncs.com/ai-scheduler/data-analytics/word/content2.docx") t.Log(ana, err) } @@ -29,35 +29,35 @@ func Test_AdvicerInit(t *testing.T) { reqBody := `{"advicer_id": 124, "name": "张三111", "birth": "1990-01-01", "gender": 1, "working_years": 10}` Run(context.Background(), []byte(reqBody)) - err := advicer.AdvicerUpdate(fiberCtx) + err := advicerService.AdvicerUpdate(fiberCtx) t.Log(err) } func Test_AdvicerVersionAdd(t *testing.T) { reqBody := `{"advicerId":124,"versionDesc":"第三个版本","dialectFeatures":{"region":"四川成都话","intensity":0.6,"KeyWords":null},"personalityTags":["耐心细致","专业务实","经验丰富","善于引导"],"sentencePatterns":{"openingMode":["我给你介绍一下","我们先来看一下","这边请"],"explanationMode":["是这样的","我跟你讲","你发现没得","说白了"],"confirmationMode":["对吧?","是不是嘛?","你晓得不?","明白了噻?","对不对?"],"summaryMode":["所以说","简单说就是","其实"],"transitionMode":["然后的话","再其次","还有一点","另外"]},"signatureDialogues":[{"context":"客户质疑地块大小","dialogue":"哥,14亩确实不大,但你要在成都2.5环内城买房,这种是普遍现象。你看万景和绿城都是13亩,中铁建只有8.8亩,339那个帮泰只有11亩。我们虽然地小,但楼间距开阔啊,看过去都是200多米!而且小小区人少安静,圈层更纯粹!"},{"context":"客户担心物业费高","dialogue":"姐,我懂你意思,我们也觉得物业费是有点贵。但招商物业是铂金服务,有夜间送外卖、免费宠物喂养、年度保洁这些增值服务。而且前三年开发商补贴一块钱,只需要交5块,跟其他盘差不多!好物业能让房子后期保值增值更多!"},{"context":"客户犹豫价格","dialogue":"说实话,这个地段的地价都比二八板块贵5000多,但我们单价只贵3000。你看龙湖滨江云河颂套内单价都36000了,我们才33000,真的性价比高!现在不买,以后这个板块可能就买不起了。"},{"context":"客户担心小区小不保值","dialogue":"哥,你不用担心小地块不保值,东大街的九龙仓擎天半岛只有两栋楼,现在二手房还能卖3万左右,是当年的豪宅项目。还有望江名门、仁和春天29号院,都是小地块但照样是高端保值盘。核心还是地段,我们在槐树店这个成华区最贵的板块,保值根本没问题!"}],"toneTags":{"enthusiasm":0.8,"patience":0.9,"confidence":0.85,"friendliness":0.8,"persuasion":0.75}}` Run(context.Background(), []byte(reqBody)) - err := advicer.AdvicerVersionAdd(fiberCtx) + err := advicerService.AdvicerVersionAdd(fiberCtx) t.Log(err) } func Test_AdvicerVersionUpdate(t *testing.T) { reqBody := `{"id":"69804b5a6532131383aeda3a","advicerId":124,"versionDesc":"第三个版本","dialectFeatures":{"region":"四川成都话","intensity":0.6,"KeyWords":null},"personalityTags":["耐心细致","专业务实","经验丰富","善于引导"],"sentencePatterns":{"openingMode":["我给你介绍一下","我们先来看一下","这边请"],"explanationMode":["是这样的","我跟你讲","你发现没得","说白了"],"confirmationMode":["对吧?","是不是嘛?","你晓得不?","明白了噻?","对不对?"],"summaryMode":["所以说","简单说就是","其实"],"transitionMode":["然后的话","再其次","还有一点","另外"]},"signatureDialogues":[{"context":"客户质疑地块大小","dialogue":"哥,14亩确实不大,但你要在成都2.5环内城买房,这种是普遍现象。你看万景和绿城都是13亩,中铁建只有8.8亩,339那个帮泰只有11亩。我们虽然地小,但楼间距开阔啊,看过去都是200多米!而且小小区人少安静,圈层更纯粹!"},{"context":"客户担心物业费高","dialogue":"姐,我懂你意思,我们也觉得物业费是有点贵。但招商物业是铂金服务,有夜间送外卖、免费宠物喂养、年度保洁这些增值服务。而且前三年开发商补贴一块钱,只需要交5块,跟其他盘差不多!好物业能让房子后期保值增值更多!"},{"context":"客户犹豫价格","dialogue":"说实话,这个地段的地价都比二八板块贵5000多,但我们单价只贵3000。你看龙湖滨江云河颂套内单价都36000了,我们才33000,真的性价比高!现在不买,以后这个板块可能就买不起了。"},{"context":"客户担心小区小不保值","dialogue":"哥,你不用担心小地块不保值,东大街的九龙仓擎天半岛只有两栋楼,现在二手房还能卖3万左右,是当年的豪宅项目。还有望江名门、仁和春天29号院,都是小地块但照样是高端保值盘。核心还是地段,我们在槐树店这个成华区最贵的板块,保值根本没问题!"}],"toneTags":{"enthusiasm":0.8,"patience":0.9,"confidence":0.85,"friendliness":0.8,"persuasion":0.75}}` Run(context.Background(), []byte(reqBody)) - err := advicer.AdvicerVersionUpdate(fiberCtx) + err := advicerService.AdvicerVersionUpdate(fiberCtx) t.Log(err) } func Test_VersionList(t *testing.T) { reqBody := `{"id":"69804060c17976e5e21858a8"}` Run(context.Background(), []byte(reqBody)) - err := advicer.AdvicerVersionList(fiberCtx) + err := advicerService.AdvicerVersionList(fiberCtx) t.Log(err) } func Test_AdvicerVersionDel(t *testing.T) { reqBody := `{"id":"698056073059550befc4f0da"}` Run(context.Background(), []byte(reqBody)) - err := advicer.AdvicerVersionDel(fiberCtx) + err := advicerService.AdvicerVersionDel(fiberCtx) t.Log(err) } @@ -93,10 +93,11 @@ func Test_Json(t *testing.T) { } var ( - file *FileService - advicer *AdvicerService - configConfig *config.Config - fiberCtx *fiber.Ctx + fileService *FileService + advicerService *AdvicerService + adviceChatService *ChatService + configConfig *config.Config + fiberCtx *fiber.Ctx ) // run 函数是程序的入口函数,负责初始化和配置各个组件 @@ -115,23 +116,31 @@ func Run(ctx context.Context, reqBody []byte) { rdb := utils.NewRdb(configConfig) advicerImpl := impl.NewAdviceAdvicerImpl(db) advicerVersionMongo := mongo_model.NewAdvicerVersionMongo() + advicerChatHisMongo := mongo_model.NewAdvicerChatHisMongo() + aiAdviceModelSupImpl := impl.NewAiAdviceModelSupImpl(db) + aiAdviceSessionImpl := impl.NewAiAdviceSessionImpl(db) + advicerTalkSkillMongo := mongo_model.NewAdvicerTalkSkillMongo() advicerClientMongo := mongo_model.NewAdvicerClientMongo() advicerProjectMongo := mongo_model.NewAdvicerProjectMongo() hsyq := third_party.NewHsyq() - advicerfilebiz := biz.NewAdviceFileBiz(hsyq) + + adviceProjectImpl := impl.NewAdviceProjectImpl(db) mongo, _ := pkg.NewMongoDb(ctx, configConfig) adviceAdvicerBiz := biz.NewAdviceAdvicerBiz(advicerImpl, advicerVersionMongo, mongo) + adviceChatBiz := biz.NewAdviceChatBiz(hsyq, rdb, aiAdviceSessionImpl, aiAdviceModelSupImpl, advicerChatHisMongo, mongo) skillBiz := biz.NewAdviceSkillBiz(advicerTalkSkillMongo, mongo) clientBiz := biz.NewAdviceClientBiz(advicerClientMongo, mongo) - projectBiz := biz.NewAdviceProjectBiz(advicerProjectMongo, mongo) - chatBiz := biz.NewAdviceChatBiz(hsyq, rdb) - file = NewFileService(advicerfilebiz, configConfig) - advicer = NewAdvicerService(adviceAdvicerBiz, configConfig) + adviceFileBiz := biz.NewAdviceFileBiz(hsyq) + adviceProjectBiz := biz.NewAdviceProjectBiz(advicerProjectMongo, adviceProjectImpl, aiAdviceModelSupImpl, mongo) + adviceClientBiz := biz.NewAdviceClientBiz(advicerClientMongo, mongo) + adviceSkillBiz := biz.NewAdviceSkillBiz(advicerTalkSkillMongo, mongo) + fileService = NewFileService(adviceFileBiz, configConfig, adviceProjectBiz) + advicerService = NewAdvicerService(adviceAdvicerBiz, configConfig) skill = NewTalkSkillService(skillBiz, configConfig) client = NewClientService(clientBiz, configConfig) - project = NewProjectService(projectBiz, configConfig) - chat = NewChatService(chatBiz, clientBiz, adviceAdvicerBiz, projectBiz, skillBiz, configConfig) + project = NewProjectService(adviceProjectBiz, configConfig) + adviceChatService = NewChatService(adviceChatBiz, adviceClientBiz, adviceAdvicerBiz, adviceProjectBiz, adviceSkillBiz, configConfig) } var dataMap = map[string]mongo_model.AdviceData{ diff --git a/internal/services/advice/chat_test.go b/internal/services/advice/chat_test.go index d60eb91..f11432a 100644 --- a/internal/services/advice/chat_test.go +++ b/internal/services/advice/chat_test.go @@ -9,7 +9,7 @@ import ( ) func Test_Regis(t *testing.T) { - reqBody := `{"advicerVersionId":"698315725d0077330399f704","clientId":"698199fa0c5f4ae098e009ab","talkSkillId":"698063ff5215bdb9c6344e88"}` + reqBody := `{"advicerVersionId":"698315725d0077330399f704","clientId":"69819b3403152e79c5ac8ca9","talkSkillId":"6980651219c4ac11078c341e"}` Run(context.Background(), []byte(reqBody)) err := chat.Regis(fiberCtx) t.Log(err) diff --git a/internal/services/advice/client_test.go b/internal/services/advice/client_test.go index f94e2cb..92eebad 100644 --- a/internal/services/advice/client_test.go +++ b/internal/services/advice/client_test.go @@ -30,7 +30,7 @@ func Test_ClientList(t *testing.T) { func Test_ClientDel(t *testing.T) { reqBody := `{"id":"698056073059550befc4f0da"}` Run(context.Background(), []byte(reqBody)) - err := advicer.AdvicerVersionDel(fiberCtx) + err := advicerService.AdvicerVersionDel(fiberCtx) t.Log(err) }