PetAgent/backend/api
wsb1224 ab618f2e4b 修复语音/通话只保存最后一轮对话:改为逐轮创建 ChatLog 记录
原来 _append_voice_log_chunk 对同一个 conversation_id 只维护一条 ChatLog,
多轮对话的 user_msg 和 ai_msg 被反复覆盖,最终只剩最后一轮。

修改为:
- 每次新用户消息(asr_result)都创建新的 ChatLog 记录,ID 存入 session_state
- AI 回复(chat_response)通过 current_log_id 找到当前轮次的记录并更新
- 会话结束时 _persist_voice_session_history 也通过 current_log_id 更新最后一轮

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 15:16:31 +08:00
..
models 修复toekn权限和语音聊天功能 2026-06-07 10:22:37 +08:00
__init__.py 第一次提交 2026-04-12 11:32:37 +08:00
admin_router.py 修复toekn权限和语音聊天功能 2026-05-26 13:12:09 +08:00
ai_governance_router.py 第一次提交 2026-04-12 11:32:37 +08:00
background_router.py 修复toekn权限和语音聊天功能 2026-06-07 10:22:37 +08:00
cache_router.py 第一次提交 2026-04-12 11:32:37 +08:00
chat_router.py 修复token余额不足时仍能继续使用功能的问题 2026-06-07 14:05:21 +08:00
fullscreen_router.py 第一次提交 2026-04-12 11:32:37 +08:00
live2d_router.py 第一次提交 2026-04-12 11:32:37 +08:00
model_config_router.py 第一次提交 2026-04-12 11:32:37 +08:00
pet_router.py 第一次提交 2026-04-12 11:32:37 +08:00
scene_editor_router.py 第一次提交 2026-04-12 11:32:37 +08:00
sms_auth_router.py 第一次提交 2026-04-12 11:32:37 +08:00
storage_router.py 优化一下视频背景上传功能 2026-04-15 22:04:48 +08:00
user_router.py 新增 token 余额前置检查,余额不足时阻止使用功能 2026-06-07 11:41:20 +08:00
voice_chat_router.py 修复语音/通话只保存最后一轮对话:改为逐轮创建 ChatLog 记录 2026-06-07 15:16:31 +08:00
voice_chat_router.py.bak2 修复toekn权限和语音聊天功能 2026-06-07 10:22:37 +08:00
wechat_auth_router.py 第一次提交 2026-04-12 11:32:37 +08:00