From 9f1397403f58772b018933cfbe6d028b60bc676a Mon Sep 17 00:00:00 2001 From: ZLI263 Date: Wed, 24 Sep 2025 17:20:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=97=A5=E5=BF=97=EF=BC=8C?= =?UTF-8?q?=E5=AE=9A=E4=BD=8D=E6=98=AF=E5=90=A6=E4=BC=A0=20soureId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/TmNameplateCorpusServiceImpl.java | 1 - .../impl/TmTelephoneCorpusServiceImpl.java | 46 +++++++++++-------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/ai-analytic-center-biz/src/main/java/com/volvo/ai/analytic/center/service/impl/TmNameplateCorpusServiceImpl.java b/ai-analytic-center-biz/src/main/java/com/volvo/ai/analytic/center/service/impl/TmNameplateCorpusServiceImpl.java index cc96c61..6557b29 100644 --- a/ai-analytic-center-biz/src/main/java/com/volvo/ai/analytic/center/service/impl/TmNameplateCorpusServiceImpl.java +++ b/ai-analytic-center-biz/src/main/java/com/volvo/ai/analytic/center/service/impl/TmNameplateCorpusServiceImpl.java @@ -206,7 +206,6 @@ public class TmNameplateCorpusServiceImpl extends ServiceImpl inputMap = new HashMap(); - DiFyReq diFyImageReq = new DiFyReq(); - diFyImageReq.setUser(ConstantStr.corpus_user); - diFyImageReq.setFlowId(telephoneToken); JSONObject jsonObject = JSONObject.parseObject(aicorpusTelephone.getDisplay()); JSONArray segments = jsonObject.getJSONArray("segments"); Long audioDuration = jsonObject.getLong("audio_duration"); // 毫秒 + if (audioDuration / 1000 <= 10) { log.info("电话语料时长小于10秒,不进行dify处理"); return; @@ -157,14 +154,20 @@ public class TmTelephoneCorpusServiceImpl extends ServiceImpl inputMapForSummary = new HashMap<>(); + inputMapForSummary.put("chat", chatList.toString()); + inputMapForSummary.put("model", carModel); + inputMapForSummary.put("analysisScene", "2"); + inputMapForSummary.put("recordId", aicorpusTelephone.getSourceId()); + inputMapForSummary.put(communicateDateStr, formattedDateStartTime); + inputMapForSummary.put("version", 2); + + Map inputMapForPortrait = new HashMap<>(inputMapForSummary); // 复制一份 + inputMapForPortrait.put("businessId", businessIdSourceId); // 仅画像任务需要 + CorpusReportDTO corpusReportDTO = new CorpusReportDTO(); corpusReportDTO.setCorpusTime(formattedDateStartTime); corpusReportDTO.setRecordId(aicorpusTelephone.getSourceId()); @@ -175,9 +178,13 @@ public class TmTelephoneCorpusServiceImpl extends ServiceImpl { try { - diFyImageReq.setFlowId(telephoneToken); - log.info("dcc语料telephoneToken:{}", telephoneToken); - JSONObject execDifyFlow = diFyService.executeDifyFlow(diFyImageReq, BusinessTypeEnum.SMART_ASSISTANT.getCode(), + DiFyReq req1 = new DiFyReq(); + req1.setUser(ConstantStr.corpus_user); + req1.setFlowId(telephoneToken); + req1.setInputs(inputMapForSummary); + + log.info("dcc语料req1:{}", req1); + JSONObject execDifyFlow = diFyService.executeDifyFlow(req1, BusinessTypeEnum.SMART_ASSISTANT.getCode(), JSONObject.toJSONString(corpusReportDTO), aicorpusTelephone.getAiAnalysisRequestId()); log.info("dcc总结场景,总结和分类 runDify execDifyFlow : {}", execDifyFlow); @@ -194,15 +201,14 @@ public class TmTelephoneCorpusServiceImpl extends ServiceImpl { try { - // 创建新的DiFyReq对象以避免线程安全问题 - inputMap.put("businessId", aicorpusTelephone.getSourceId()); + DiFyReq req2 = new DiFyReq(); + req2.setUser(ConstantStr.corpus_user); + req2.setFlowId(dccTokenPortrait); + req2.setInputs(inputMapForPortrait); // 使用带 businessId 的副本 - diFyImageReq.setInputs(inputMap); - - diFyImageReq.setFlowId(dccTokenPortrait); log.info("dcc总结场景,客户画像runDify execDifyFlow : {}", dccTokenPortrait); - JSONObject execDifyFlowForPortrait = diFyService.executeDifyFlow(diFyImageReq, BusinessTypeEnum.CORPUS_PORTRAIT_DCC.getCode(), + JSONObject execDifyFlowForPortrait = diFyService.executeDifyFlow(req2, BusinessTypeEnum.CORPUS_PORTRAIT_DCC.getCode(), JSONObject.toJSONString(corpusReportDTO), aicorpusTelephone.getAiAnalysisRequestId()); log.info("dcc客户画像场景 runDify execDifyFlow 返回 , dcc: {}", execDifyFlowForPortrait);