From d1cb2c2b5a9137204a13001c250cc5900c92b380 Mon Sep 17 00:00:00 2001 From: Liuyang <2746366019@qq.com> Date: Sun, 2 Mar 2025 11:34:55 +0800 Subject: [PATCH] =?UTF-8?q?refactor(yudao-module-llm):=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20LLM=20=E6=A8=A1=E5=9E=8B=E6=9C=8D=E5=8A=A1=E7=9A=84?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E8=BE=93=E5=87=BA=E5=92=8C=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在处理响应行数据前增加日志输出,便于调试和监控 - 优化内容处理,移除多余的换行符,提高数据一致性和可读性 --- .../cn/iocoder/yudao/module/llm/service/http/ModelService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/http/ModelService.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/http/ModelService.java index c73558473..39f849fe2 100644 --- a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/http/ModelService.java +++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/http/ModelService.java @@ -223,7 +223,7 @@ public class ModelService { if (StringUtils.isBlank(line)) { continue; } - line = line.replaceAll("\n", " "); + log.info("接收到的响应行数据: {}", line); line = line.replaceAll("\n", " "); String content = parseStreamLine(line); @@ -266,6 +266,7 @@ public class ModelService { if (delta != null) { // 获取 content 的值 String content = delta.getString("content"); + content = content.replaceAll("\n", " "); return "{\"content\":\"" + content + "\",\"finish_reason\":\"" + false + "\"}"; } }