Commit graph

570 commits

Author SHA1 Message Date
Sakura-RanChen
e41bc98a25 fix(tts): 流式 TTS 会话延迟到首个有效文本开启,修复慢 LLM 场景合成结果为空 2026-11-13 10:10:20 +08:00
Sakura-RanChen
9f5f520576 fix: 修复ha读取异常 2026-11-05 15:36:04 +08:00
koala553
c59b29c723
fix: prevent tool description cache mutation (#3540) 2026-11-05 10:10:17 +08:00
Sakura-RanChen
f9138e65b7 update: 使用专用线程池避免阻塞默认池 2026-11-03 10:43:53 +08:00
Bao1573
9b8a9b585d
fix(tools): 服务端插件的同步函数放线程池,不阻塞事件循环 (#3528)
ServerPluginExecutor.execute 在事件循环上被 await,而 hass_state、天气等插件用 requests 同步阻塞,工具执行期间整个循环停转、正在发的音频节拍也停。同步函数改用 run_in_executor 放到线程池;async def 插件照常 await;传参规则不变。附测试。
2026-11-02 15:29:34 +08:00
hrz
3230a69c99
Merge pull request #3515 from shinjiyu/fix/config-provider-copy-accuracy
fix(config): 纠正供应器占位文案与 PaddleSpeech 协议说明
2026-11-01 06:56:22 +08:00
shinjiyu
1ac4c09946 fix(config): 按审核意见补齐占位文案与 PaddleSpeech 协议收敛
- AliLLM 占位改为「你的阿里云百炼API密钥」;ASR 段「语音合成」改为「语音识别」;XunfeiSparkLLM 占位改为 api_key
- PaddleSpeech:启动时校验 protocol;代码兜底 URL 与 config 对齐为本机;智控台新增 changeset 去掉 http 选项
2026-10-30 20:55:56 +08:00
Sakura-RanChen
01289b8fd4 仅保留mcp2.x行为 2026-10-29 14:17:38 +08:00
shinjiyu
ef2fcdbcb1
fix(server_mcp): read Tool.input_schema for mcp 2.3.0 (#3522)
mcp==2.3.0 Tool stores the JSON Schema on input_schema (alias
inputSchema). Accessing tool.inputSchema raises AttributeError and
aborts server_mcp init after a successful tools/list.

Use getattr fallback so function-calling conversion works.

Closes #3521

Co-authored-by: shinjiyu <shinjiyu@users.noreply.github.com>
2026-10-29 14:08:44 +08:00
Sakura-RanChen
549261fdff PR 提供的keep 逃生门要求用户自行发现问题、了解该魔法值并手改 configJson,对普通用户不可达。
调整LLM thinking 域名禁用规则支持按模型名豁免(避免 MaaS glm-5.3 被注入参数后 400)
2026-10-28 16:18:58 +08:00
SecInsight
2cb0562ade
feat(llm): 华为云 MaaS 思考强度实例级配置 + 管理台 select 字段类型 (#3446)
- openai provider: THINKING_DISABLED_DOMAINS 补 modelarts-maas.com
- openai provider: 实例配置支持可选 thinking 字段(off/low/medium/high/keep),
  实例值优先于域名默认表; keep=完全直通(适配强制思考且拒绝该参数的模型, 如 MaaS glm-5.3)
- manager-web: 模型配置表单渲染器支持 select 字段类型(el-select + field.options)
  (ModelEditDialog / AddModelDialog 两处渲染点与类型映射)

Co-authored-by: SecInsight <secinsight@users.noreply.github.com>
Co-authored-by: Sakura-RanChen <1908198662@qq.com>
2026-10-28 15:20:28 +08:00
shinjiyu
ccc77799d9 fix(config): 纠正 AliLLM 占位文案与 PaddleSpeech 协议说明
- AliLLM 的 api_key 占位误写成 deepseek,照抄会把错误 key 填进百炼(#3495)
- PaddleSpeechTTS 实际只实现 websocket,去掉 config/报错里对 http 的承诺(#3503)
2026-10-28 06:02:21 +08:00
wengzh
6c352e5978
Merge pull request #3436 from xinnan-tech/perf/hello-handshake-fast
hello 握手首屏响应从 4s 降到 200ms
2026-10-27 14:34:13 +08:00
Sakura-RanChen
82d2acc78c - audio_to_data 缓存键加入文件 mtime:regen 覆写 wav 后旧缓存自动失效,
并在 regen 后预编码新文件,唤醒回复不再播旧音频且延迟收益保留
- enhanced_prompt 缓存键补上 emoji_enabled 与 prompt 哈希:
  同设备不同客户端(ESP32/digital-human)不再互相污染,改配置即时生效
- 删除 initialize 响应后的 tools/list 兜底补发:id=2 同连接复用
  违反 JSON-RPC 与设备端严格递增约定(#3461/#3485),且兜不住任何场景
2026-10-26 17:09:09 +08:00
Sakura-RanChen
ee726f49e6 Merge remote-tracking branch 'origin/main' into perf/hello-handshake-fast
# Conflicts:
#	main/xiaozhi-server/requirements.txt
2026-10-26 15:05:17 +08:00
Sakura-RanChen
05f0da0639 补充接入点工具id调整 2026-10-26 14:40:31 +08:00
shinjiyu
af1982c424
fix: device MCP tools/call 避开握手占用的 JSON-RPC id 1/2 (#3462)
握手阶段写死 id=1 (initialize) / id=2 (tools/list),但 MCPClient.next_id
从 1 起算,导致前两次 tools/call 复用同一连接上的 request id。合规设备端
会拒收并触发服务端 30s 超时(表现为前两次调用失败、第三次起恢复)。

将 next_id 初始值改为 3,与官方协议序列及 #3461 复现一致;同时去掉
mcp_handler 里重复的 MCPClient 定义,改为从 mcp_client 导入。

Fixes #3461

Co-authored-by: shinjiyu <shinjiyu@users.noreply.github.com>
2026-10-26 14:05:40 +08:00
wengzh
3709540efd
Merge pull request #3445 from xinnan-tech/fix/huoshan-double-stream-4-bugs-y15
huoshan_double_stream 修 4 个会话协议与监听竞态 bug
2026-10-23 17:37:05 +08:00
Sakura-RanChen
be75e7bd39 chore(deps): 批量升级 15 个依赖,适配 mcp 2.x
源 PR: #3426 #3427 #3428 #3429

剔除 4 项:
- edge-tts 7.3.1->7.2.8 是降级
- powermem >=1.1.7 要求 Python>=3.11
- openai 3.29.0 与 powermem 冲突(powermem 要求 openai<3.0.0)
- ruamel.yaml 0.19.1 与 hyperpyyaml 冲突

mcp 2.x 适配: streamablehttp_client 更名为 streamable_http_client,headers/timeout
改由 http_client 承载,产出从 3 元组变 2 元组,ProgressFnT 移到 mcp.shared.dispatcher
2026-10-23 15:15:50 +08:00
Sakura-RanChen
d8f8a4a083 - 取消屏障保证:新连接创建前 _cancel_monitor_task 已等旧监听任务完全退出,
旧任务不可能读新连接或误关新连接(check_huoshan_3440 动态断言覆盖)
- mismatch 分支仅保留纯跳过,删除旧会话结束事件的复位遗留,
  activate_session 写入点收敛到会话生命周期(start / matched 结束 / close)
- 删除 _session_start_future 启动确认机制:start_session 发送即返回,
  SessionFailed 由 monitor 记 error 并复位 activate_session,无挂起风险
- 回归脚本同步调整:3438 重写为新行为断言,3440 用屏障断言替换 snapshot 断言
2026-10-19 17:52:25 +08:00
hrz
0a54124d0d huoshan_double_stream 修 3 处复评反馈
init 漏写 _pending_prefix 字段、start_session 用已弃用的
get_event_loop、finish_session 留着多余的 getattr 兜底。补字段、
换 get_running_loop、去兜底,3 处都修了。
2026-10-17 07:57:26 +08:00
hrz
9b7fb3e826 parser_response 四处二进制协议解析修正
serialization_method 错用掩码当移位数恒 0,改成 >>4;message_type 写
== FULL or AUDIO_ONLY_RESPONSE 优先级下恒真,改 in (...);offset 硬编码 4 在
header_size>1 全错位,改成 header_size * 4;SessionCanceled 漏进协议分支被
else 误读,补进统一解析。
2026-10-17 07:39:51 +08:00
hrz
a6cdbf9410 监听任务用 snapshot 隔离跨连接
旧 monitor 循环直接 self.ws.recv(),连接重建后旧任务读新下行;finally 无条件
关 self.ws 误关新连接。改成入口绑 monitor_ws / monitor_task,recv 用 snapshot;
旧 session 事件 continue 不再 reset 当前;finally 判 id 相同才关 ws / 清引用。
2026-10-17 07:39:51 +08:00
hrz
75fd5d8cc3 句尾替换词残留先发 + 会话结束冲刷编码器
旧 finish_session 不发 _pending_prefix 残留,句尾替换词被扣时整段丢;monitor / to_tts
收 SessionFinished 不调 is_end=True 冲刷 opus 编码器,每句固定丢尾。改成
finish_session 开头先发残留,monitor / to_tts 调 is_end=True 冲刷,FIRST 同步重置。
2026-10-17 07:39:51 +08:00
hrz
6fe5630346 TTS 会话等 SessionStarted 确认
旧逻辑 start_session 发完 StartSession 即返回;服务端鉴权失败或 14s 内 26005 时
文本线程继续给死会话发文本,整轮无声。改成末尾 await 一个 future:monitor 读到
SessionStarted set True、读到 SessionFailed set False,超时报错让文本线程感知。
2026-10-17 07:39:50 +08:00
hrz
eb9dc8ca0f
把 pydub 探针绑到当前解释器同目录的完整版 ffmpeg (#3444)
edge_tts 升 7.3.1;edge.py 撤 WSS_URL patch 改默认
(4.36 跑默认 URL 稳定)。util.py 加 PATH 临时注入,
绕开 Mac 上 Trae CN 注入的精简版 ffmpeg/ffprobe,
让 pydub 拿 conda env 完整版。引用计数加锁防多线
程串。
2026-10-15 15:43:39 +08:00
hrz
4dd194ef8b pr02 P1 三条全部兜底
device_prompt 缓存跨日不失效导致今天日期/天气被烤死,改成独立 key 并带 5 分钟 ttl;mcp 工具列表在收到初始化响应后补回并发发送,helloHandle 预发万一丢帧时也能兜住;启服脚本去硬编码路径与全机 pkill,改用相对路径与 PID 文件。
2026-10-14 23:19:33 +08:00
hrz
597ab5f415 每连接冗余计算与日志降级
提示词模板结果按设备 id 缓存复用、声纹未配置和 mcp 配置文件缺失两条提示从警告降到调试,让每条新连接少跑几百毫秒的模板渲染、少两次同步日志。
2026-10-14 23:05:15 +08:00
hrz
4f1cb98503 hello 握手并发与缓存
唤醒词音频改为带缓存且进程启动时预热、首段流控缓冲帧数从 5 调到 2、hello 阶段并发发出 mcp 工具列表帧让客户端在听到声音前就准备好、删掉 mcp 初始化后的固定 sleep。砍幅 t_hello_to_tools_ready p50 从 4019ms 降到 219ms。
2026-10-14 23:05:12 +08:00
wengzh
27399a2fb6
Merge pull request #3430 from xinnan-tech/py-text-test
Py text test
2026-10-14 14:11:53 +08:00
korexil
0be634c627
fix: SenseVoice 日语识别结果按词带空格 (#3412)
SenseVoice 识别日语时偶尔按词输出空格(如「今日 の こと を 少し 長め に」),
这些空格会原样进入对话历史并交给 LLM。lang_tag_filter 现在去掉两个
中日文字符之间的空格,韩文、英文的词间空格保持不变。
2026-10-14 10:32:56 +08:00
Sakura-RanChen
932962e8d3 补充注释说明,调整测试样例 2026-10-14 10:10:28 +08:00
Sakura-RanChen
a5e47f2c4e 补充字符,调整字符判断 2026-10-13 15:29:28 +08:00
hrz
741ec299c0
fix(tts): edge-tts 失声改走 msedgeservices (#3420)
* fix(tts): edge-tts 失声改走 msedgeservices

微软 2026-10 起对 legacy 消费者接口返回 403,
edge-tts 7.2.8 仍走 speech.platform.bing.com 走不通。
上游 PR rany2/edge-tts#491 切到 api.msedgeservices.com 修好,
但 7.2.8 仍是 PyPI 最新版本。

仓库在 edge.py 顶部临时把 WSS_URL 顶住,等 7.2.9 出了删掉。

* fix(tts): patch 还要写 communicate.WSS_URL

edge-tts 7.2.8 仍指 legacy bing 接口,10 月起微软 403。
上游 PR #491 已切到 msedgeservices.com,7.2.9 才进 PyPI,先顶住。
上次只改 constants.WSS_URL 不够,communicate 用 from import 是模块局部名,
LEGB 找不到新值。这次同时改 communicate.WSS_URL 才生效。
2026-10-13 09:58:30 +08:00
korexil
70ab19d23f
fix: TTS 分句在引号内切开句子 (#3413)
_get_segment_text 会在引号内的标点处切分(如「わぁ!」って、“好!”然后),
把引号拆到两段里,或留下只有「。」的片段。新增 _quote_safe_cut:切分点后的
右引号与句末标点一并带走;位于未闭合引号内或右引号后句子仍在继续时,顺延到
下一个标点。不含引号的文本切分结果不变。
2026-10-12 16:26:40 +08:00
Sakura-RanChen
1846d3e935 调整相关逻辑 2026-09-09 16:17:13 +08:00
Sakura-RanChen
b1a7607dd5
Merge pull request #3345 from apexlsai/feature/alibl-workspace-streaming
feat(tts): 完善阿里百炼 Workspace 流式语音合成
2026-09-09 14:22:59 +08:00
yillkid
323c2248b4 [pm] fix: normalize FunASR result type 2026-09-04 13:10:58 +08:00
Jacob
a31ba7ef6d fix(tts): synchronize Bailian streaming subtitles 2026-09-04 12:05:34 +08:00
Jacob
935184b1d0 feat(tts): support Bailian workspace endpoints 2026-09-04 12:05:09 +08:00
Tyke Chen
04b3ad5aae fix(tts): validate timeout range 2026-08-13 15:59:41 +08:00
Tyke Chen
2c43a13d6e fix(tts): unify configurable request timeouts 2026-08-13 15:02:17 +08:00
henson957
db7db3de67 fix(tts): reuse base tts_timeout config instead of hardcoded 15 2026-08-13 13:28:17 +08:00
henson957
d03d0d0982 fix(tts): add HTTP timeout and error handling to SiliconFlow provider
- requests.request() had no timeout: when the SiliconFlow API slows down,
  the request hangs forever and the device produces no audio intermittently
- non-200 responses (rate limit, error page) were written to disk as audio;
  now the status code is checked and an exception is raised with the body
2026-08-12 17:37:04 +08:00
3030332422
88eed86dc2 update:关闭deepseek的思考模式 2026-08-06 13:07:04 +08:00
3030332422
7a22b61969 fix:修复与函数同名时遗漏其他函数的问题 2026-07-28 17:05:18 +08:00
colorful
523915f9fe fix(plugins): 展开模块级别插件名为具体函数名
在一个 function 文件中可能注册多个 @register_function,当配置下发或
本地配置使用模块名(文件名)时,需要自动展开为具体的函数名列表。

改动内容:
- register.py: 新增 module_func_map 全局映射,在 register_function
  装饰器中自动记录模块名 → 函数名列表的映射关系
- connection.py: 处理服务端下发的插件配置时,将模块级的 plugins 配置
  复制到各具体函数名 key 下,并将模块名展开写入 Intent functions 列表
- plugin_executor.py: 新增 _expand_plugin_names() 兜底展开逻辑和
  _get_plugin_description() 双层查找方法,确保本地配置场景也能正确展开
2026-07-24 10:47:00 +08:00
Sakura-RanChen
ed89c05245 fix: intent阻塞主线程 2026-07-20 14:48:26 +08:00
hrz
bc1aa1a089
Merge pull request #3267 from xinnan-tech/fix-agent-idor
fix: prevent agent IDOR access
2026-07-10 17:36:00 +08:00
wengzh
14e57a1add fix(powermem): 修复用户配置启用状态的类型判断问题
将配置的启用值统一转为小写字符串后判断是否为true,避免非布尔类型配置导致的判断失效
2026-07-10 10:06:07 +08:00