From 35e19396e196c89583132c96a6bc1fbfc4512580 Mon Sep 17 00:00:00 2001 From: Liuyang <2746366019@qq.com> Date: Wed, 5 Mar 2025 17:15:46 +0800 Subject: [PATCH] =?UTF-8?q?fix(llm):=20=E4=BF=AE=E5=A4=8D=E7=9F=A5?= =?UTF-8?q?=E8=AF=86=E5=BA=93=E9=97=AE=E7=AD=94=E4=B8=AD=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E6=8D=A2=E8=A1=8C=E7=AC=A6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在提取页面内容后,添加了替换换行符的代码 - 将 pageContent 中的 \n 和 \r 替换为空字符串,避免在返回结果中显示换行符 --- .../module/llm/service/conversation/ConversationServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/conversation/ConversationServiceImpl.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/conversation/ConversationServiceImpl.java index e55cc112a..57b019556 100644 --- a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/conversation/ConversationServiceImpl.java +++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/conversation/ConversationServiceImpl.java @@ -603,6 +603,7 @@ public class ConversationServiceImpl implements ConversationService { // 提取页面内容 JSONObject content = firstResult.getJSONObject(0); String pageContent = content.getString("page_content"); + pageContent = pageContent.replace("\n", "").replace("\r", ""); log.info("{} 内容: {}", "[KnowledgeBase]", JSON.toJSONString(pageContent)); JSONObject metadata = content.getJSONObject("metadata");