Skip to content

Commit a606dd4

Browse files
committed
debug:用户消息时间戳空指针
1 parent 5dd4bf1 commit a606dd4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/main/java/com/xiaozhi/dialogue/llm/factory/ChatModelFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public class ChatModelFactory {
5959
* 根据配置ID创建ChatModel,首次调用时缓存,缓存key为配置ID。
6060
*
6161
* @see SysConfigService#selectConfigById(Integer) 已经进行了Cacheable,所以此处没有必要缓存
62-
* @param configId 配置ID,实际是模型ID。
62+
* @param session 与网络链接绑定的聊天会话
6363
* @return
6464
*/
6565
public ChatModel takeChatModel(ChatSession session) {

src/main/java/com/xiaozhi/dialogue/service/DialogueService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,6 @@ private void startStt(
376376
// 获取完整的音频数据并保存
377377
saveUserAudio(session);
378378

379-
380-
381379
CompletableFuture.runAsync(() -> messageService.sendSttMessage(session, finalText))
382380
.thenRun(() -> audioService.sendStart(session))
383381
.thenRun(() -> {
@@ -873,7 +871,9 @@ public void handleText(ChatSession session, String inputText, Consumer<Long> tex
873871
return;
874872
}
875873
sessionManager.updateLastActivity(sessionId);
876-
874+
// 设置用户消息的创建时间戳,要在消息入库前获得时间戳。 后续考虑:传递的消息不一定是String,也可以是封装的。
875+
final Long userTimeMillis = System.currentTimeMillis();
876+
session.setUserTimeMillis(userTimeMillis);
877877
// 发送识别结果
878878
messageService.sendSttMessage(session, inputText);
879879
audioService.sendStart(session);

0 commit comments

Comments
 (0)