refactor(yudao-module-llm): 优化 LLM 模型服务的日志输出和数据处理

- 在处理响应行数据前增加日志输出,便于调试和监控
- 优化内容处理,移除多余的换行符,提高数据一致性和可读性
This commit is contained in:
Liuyang 2025-03-02 11:34:55 +08:00
parent d3bb3a2388
commit d1cb2c2b5a

View File

@ -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 + "\"}";
}
}