IntuitionX_agent/pyproject.toml
wds 5d2e2cfa6b feat: 实现2.1和2.3 WebSocket接口
- 2.1异常状态触发对话:皮肤状态异常/情绪低落时触发关怀对话
- 2.3双向音频流对话:K230和后端实时音频双向传输
- 核心模块:WebSocket服务器、2个消息处理器、提示词管理
- 异步架构:asyncio + 线程池,流式LLM→TTS
- 完整的测试套件和API文档

实现细节:
- 使用websockets库(15.0版本)
- asyncio.to_thread桥接同步模块
- 流式处理,低延迟
- 自动session管理和资源清理
- 完整的错误处理和日志

新增文件:
- src/MainServices.py: WebSocket服务器主入口(171行)
- src/handlers/abnormal_trigger.py: 2.1处理器(120行)
- src/handlers/audio_stream.py: 2.3处理器(250行)
- src/utils/prompts.py: 提示词管理(35行)
- test_ws.py: 完整的测试脚本(190行)
- WEBSOCKET_API.md: 完整的API文档
- IMPLEMENTATION_SUMMARY.md: 实现总结
2026-01-01 22:57:55 +08:00

41 lines
936 B
TOML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[project]
name = "Heart_Mirror_Agent"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"agentscope>=1.0.10",
"dashscope>=1.25.5",
"loguru>=0.7.3",
"packaging>=25.0",
"pre-commit>=4.3.0",
"pydantic>=2.11.7",
"python-dotenv>=1.2.1",
"pyyaml>=6.0.2",
"ruff>=0.12.11",
"torch>=2.9.1",
"torchaudio>=2.9.1",
"websockets>=12.0",
]
[tool.ruff]
line-length = 88
lint.select = [
"E", # pycodestyle比如 E501 行过长)
"W", # pycodestyle warnings比如 W293 空白行含空格)
"F", # pyflakes未使用变量等
"B", # bugbear潜在 bug
"UP", # pyupgrade自动升级语法
"I", # isort导入顺序
"RUF", # Ruff 自己的规则(比如 Unicode 混淆检查)
]
exclude = [
".git",
"__pycache__",
"build",
"dist",
".venv",
]