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 7ef401702..c73558473 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 @@ -156,6 +156,7 @@ public class ModelService { } catch (Exception e) { emitter.completeWithError(e); } + } /** @@ -187,9 +188,8 @@ public class ModelService { * * @param httpPost HttpPost 请求对象 * @param requestBody 请求体内容 - * @throws IOException 创建 StringEntity 时可能抛出的 IO 异常 */ - private void setupRequest (HttpPost httpPost, String requestBody) throws IOException { + private void setupRequest (HttpPost httpPost, String requestBody) { // 创建 StringEntity 对象,用于封装请求体 StringEntity entity = new StringEntity( requestBody, @@ -223,7 +223,9 @@ public class ModelService { if (StringUtils.isBlank(line)) { continue; } + line = line.replaceAll("\n", " "); log.info("接收到的响应行数据: {}", line); + line = line.replaceAll("\n", " "); String content = parseStreamLine(line); if (content != null) { emitter.send(SseEmitter.event()