refactor(module-llm):优化聊天响应处理逻辑

-将接收到的内容解析为 ChatReqVO 对象
- 增加空值检查,避免潜在的空指针异常
- 仅追加非空的聊天内容到结果中
This commit is contained in:
Liuyang 2025-03-02 12:26:56 +08:00
parent 6316befb9f
commit d9da4c0bfa

View File

@ -288,7 +288,11 @@ public class ModelService {
.data(content, MediaType.TEXT_EVENT_STREAM)
);
}
result.append(content);
ChatReqVO chatReqVO = JSONObject.parseObject(content, ChatReqVO.class);
if (content!=null){
result.append(chatReqVO.getContent());
}
// 心跳检测
if (System.currentTimeMillis() - lastSendTime > 15_000) {
emitter.send(SseEmitter.event().comment("heartbeat"));