xiaozhi-esp32-server/main/xiaozhi-server/tests
Allen 6e1ab09738 fix(coze): 打断对话时取消上游 chat,避免下一轮撞上 4016 会话被占用(#2076)
客户端打断上一轮对话时,core/connection.py 跳出 LLM 流式循环,上游那个
coze chat 就没人管了,会一直占着这个 conversation。下一轮请求用同一个
conversation_id 发过去,coze 直接返回 4016:

    error event: {"code":4016,"msg":"Conversation occupied: Another chat is
    currently active."}

这一轮就整个卡死,只能靠重启服务。issue 里作者的绕法是删掉本地记的
conversation_id,但这样上下文也就没了。

改动:
- 记录每个会话当前跑着的 chat(session_id -> conversation_id + chat_id)
- 客户端打断时(流式生成器被提前关闭)主动调 chat.cancel 把上游 chat 结束掉,
  conversation_id 保留,上下文不丢
- 下一轮开始前先把上一轮遗留的 chat 取消掉,不依赖生成器回收时机
- 真的撞上 4016 时清掉本地会话 id,下一轮重新建会话,不会一直卡住
2026-11-26 16:06:21 +08:00
..
config revert(config): 移除 mem_report_only 出厂配置块,维持单模块 fail-fast 契约 2026-11-13 17:42:16 +08:00
core fix(coze): 打断对话时取消上游 chat,避免下一轮撞上 4016 会话被占用(#2076) 2026-11-26 16:06:21 +08:00
plugins_func Merge pull request #3548 from zhenglieAllen/zhenglieAllen/fix/check-model-key-none 2026-11-19 09:52:20 +08:00
__init__.py 加 Python 冒烟测试,验证 pytest 流水线 2026-09-02 22:24:35 +08:00
conftest.py Merge branch 'main' into py-test-ollama 2026-11-19 11:13:30 +08:00
test_llm.py Merge branch 'main' into py-test-ollama 2026-11-19 11:13:30 +08:00
test_manage_api_client_lifecycle.py 迁移测试用例,优化相关注释 2026-10-13 14:31:21 +08:00
test_memory.py chore(deps): 批量升级 4 个允许的依赖 (#3374) 2026-09-17 15:57:43 +08:00
test_rag.py chore(deps): 批量升级 4 个允许的依赖 (#3374) 2026-09-17 15:57:43 +08:00
test_smoke.py 加 Python 冒烟测试,验证 pytest 流水线 2026-09-02 22:24:35 +08:00
test_stt.py chore(deps): 批量升级 4 个允许的依赖 (#3374) 2026-09-17 15:57:43 +08:00
test_tts.py 调整相关测试 2026-11-19 17:11:57 +08:00