Commit graph

3903 commits

Author SHA1 Message Date
lapy
d51c54f483 fix(tests): make pytest suite runnable from a fresh checkout (CI fix)
PR#2 CI: the Python job failed with 17 FileNotFoundError collection errors.
Widening CI from upstream's smoke-test-only to the full suite exposed that
the suite depends on main/xiaozhi-server/data/.config.yaml, which is
gitignored and therefore absent on CI runners (dev boxes always have it, so
the local rebase gate never caught it).

- add tracked tests/testdata/test-config.yaml (placeholder keys, empty
  manager-api block, same shape as the local stub)
- conftest falls back to it when data/.config.yaml is missing (explicit
  PYTEST_CONFIG_FILE still wins)
- neutralize config.settings/config.logger check_config_file bindings and
  logger's load_config so setup_logging() at module import works without a
  real deployment config; these names are bound at import time via
  manage_api_client -> config.logger, so patching the source modules alone
  was not enough

Verified on a clean clone with py3.10 + full requirements: 58 passed,
5 skipped; lifecycle unittests 11 OK on both clean clone and dev box.
2026-10-13 12:55:55 +01:00
lapy
6f4728085b merge: sync with GitHub main (PR#1 merge commit) to keep local history fast-forwardable 2026-10-13 12:54:47 +01:00
lapy
ffc331c467 test(server): shim edge_tts.communicate so upstream WSS_URL monkey-patch imports in mock mode
Upstream's edge-tts workaround (msedgeservices 403 fix) now imports
edge_tts.communicate explicitly; the conftest shim only registered the
.exceptions submodule, so 4 tts tests failed after the sync. Same pattern
as the existing opuslib_next submodule shims.

Also widen CI + rebase gate from smoke-only to the full pytest suite and
the unittest-only lifecycle tests (the smoke run masked these failures).
2026-10-13 11:53:28 +01:00
lapy
df6fc3ae76 fix(westernization): translate edge-tts monkey-patch comments from upstream sync 2026-10-13 11:49:38 +01:00
lapy
a80ff5084b merge: sync upstream main 2026-10-13 (16 commits)
# Conflicts:
#	Dockerfile-server-base
#	main/manager-web/src/router/index.js
#	main/xiaozhi-server/config/manage_api_client.py
#	main/xiaozhi-server/core/handle/receiveAudioHandle.py
2026-10-13 11:48:47 +01:00
lapy
cd83c805f5 chore(westernization): add rebase-verification tooling and docs
The October rebase silently shipped runtime-breaking merge artifacts that
neither the web build nor the test suites caught (blank models page,
ReferenceError on role open, broken provider management). Make every one
of those failure classes fail loudly and early:

- manager-web/scripts/integrity-check.js: AST pass (acorn + eslint-scope)
  for undefined identifiers (lost imports, dropped function params and
  const bindings), vue-template-compiler pass for mismatched tags, and a
  duplicate-options-key pass (double 'computed:' clobbering). Negative-
  tested against reproductions of all three shipped bugs.
- manager-web/scripts/check-i18n.js rewritten for the fork: base locale
  is en, locales discovered dynamically, plus a pass that fails when any
  $t('a.b') key referenced in src/ has no definition (upstream rebases
  kept adding views with keys never added downstream).
- scripts/westernization_rebase_check.sh: one-command gate chaining audit,
  integrity, i18n parity, snapshot/contract/unit tests and the production
  build; heavier Java/Python suites run only when toolchains exist.
- scripts/translate_han_llm.py: vendored from the one-off /tmp tool used
  for the translation sweep; repo-relative paths, endpoint/model via
  TRANSLATE_API/TRANSLATE_MODEL env, cache gitignored.
- CI: the Vue job now runs integrity-check, check:i18n, test:snapshot and
  test:contract before test:unit; new nightly Upstream Sync Check workflow
  dry-merges upstream/main into a throwaway branch and runs the same web
  gates so a breaking incoming merge alerts before a human sync.
- westernization.md: tooling table, five known merge-corruption failure
  classes with symptoms and repair strategy, translator usage, updated
  rebase order and good-outcome checklist.

acorn and eslint-scope are now explicit devDependencies.
2026-10-13 11:35:11 +01:00
lapy
50b9d6974d fix(i18n): repair locale drift found by rewritten checker
- drop first duplicate 'roleConfig.functionName' in all locales (the
  later duplicate won at runtime; the first is dead)
- rename en 'language.ptBR' to 'language.pt_BR' to match the labelKey
  used by the language switcher in i18n/index.js (the switcher showed a
  raw key for Portuguese)
- drop dead 'language.zhCN/zhTW' labels from en (zh locales are removed
  downstream)
- add knowledgeFileUpload pagination/test keys missing in de, pt_BR, vi
2026-10-13 11:34:51 +01:00
lapy
40a3e7ca55 fix(web): repair merge-corrupted templates and provider page
Template-compile scan (vue-template-compiler over all .vue files) found
four files with mismatched tags, all fallout from the upstream rebase:

- CustomDialog.vue: the confirm footer button opened with <el-button> and
  closed with </CustomButton>, and the options object declared a second
  computed: block that clobbered the first (killing effectiveCancelText/
  effectiveConfirmText => blank modal buttons). Merge the computed blocks,
  restore data(), close the button tag.
- AddWisdomBodyDialog.vue: duplicate legacy body plus a stray </el-dialog>
  for a <CustomDialog> root; drop the dead duplicate.
- FirmwareDialog.vue: finished the half-applied el-dialog -> CustomDialog
  conversion (confirm/cancel wiring, dialogVisible in data).
- ProviderManagement.vue: the merge interleaved the old el-table markup
  with the new CustomTable template, producing a structurally broken page.
  Adopt upstream's clean CustomTable version and re-apply the four Han
  strings (comments/title/error text).

Also add 4 i18n keys referenced but missing from every locale
(common.noData / addFailure / updateFailure, message.searchFailed) in
en, de, pt_BR and vi.

Verified: 0 template compile errors, 0 missing i18n keys, audit clean.
2026-10-13 11:12:03 +01:00
lapy
583c5304a2 fix(web): restore merge-dropped API signatures and lost methods
The rebase-merge silently dropped parameter lists and const bindings
from several API methods, so calling them threw ReferenceError at
runtime (e.g. 'request is not defined' when opening a role, which
broke tag/plugin loading):

- agent.js: restore getAgentSnapshots/getAgentSnapshot/restoreAgentSnapshot/
  deleteAgentSnapshot (deleted by the merge but still used by
  AgentSnapshotDialog) and repair getAgentTags signature + request binding
- model.js: restore onTerminalFailure/retryCount/retryStartedAt params and
  const request bindings on getModelNames/getLlmModelCodeList/getModelVoices;
  restore getRAGModels used by KnowledgeBaseDialog
- device.js: restore dropped failCallback params on five methods
- admin.js: restore failCallback param on addParam (guarded call)
- register/retrievePassword: log the response object instead of the
  nonexistent 'error' identifier in the captcha else-branch

Verified with an AST no-undef scan (acorn+eslint-scope) across all
.vue/.js sources and an Api.* cross-reference against module exports.
agentSnapshotApi regression tests pass (7/7).
2026-10-13 11:11:51 +01:00
wengzh
60c2a7ee17
Merge pull request #3431 from xinnan-tech/py-content-text
Py content text
2026-10-13 17:13:42 +08:00
Sakura-RanChen
a01f0aa29b 去除没必要的测试,上游为str不需要防御性增加 2026-10-13 16:54:42 +08:00
korexil
4445aa7510
fix: FunASR 识别结果以 JSON 原样进入对话历史 (#3411)
FunASR 返回 {"content","language","emotion"} 时,startToChat 只在含 speaker
字段时才解包,否则整段 JSON 字符串会作为用户消息交给 LLM 并写入对话历史。
现在没有 speaker 时只取 content。
2026-10-13 16:44:13 +08:00
wengzh
dc86a780a2
Merge pull request #3418 from xinnan-tech/py-test
Py test
2026-10-13 15:47:30 +08:00
Sakura-RanChen
2057b99aeb 迁移测试用例,优化相关注释 2026-10-13 14:31:21 +08:00
wengzh
7957817a72
Merge pull request #3425 from xinnan-tech/chore/dependabot-monthly-groups
Dependabot 改月度更新并按用途分组
2026-10-13 11:41:15 +08:00
hrz
a6eeb107f4 fix(deps): 补 dependabot ignore portalocker
requirements.txt 把 portalocker 锁在 3.x,4.x 与 qdrant-client<1.20 的
portalocker<4.0 冲突 (PR #3360)。Dependabot 默认推 4.x 升级会破约束。
依 openrz 评审 P1 在 ignore 列表追加 portalocker 一项。
2026-10-13 11:28:37 +08:00
wengzh
847337cabb
Merge pull request #3419 from xinnan-tech/fix/3391-route-guard-whiteList
fix(router): 路由守卫改 anon 白名单反向匹配
2026-10-13 11:15:15 +08:00
Sakura-RanChen
b8f23ffa66 调整相关代码 2026-10-13 10:40:47 +08:00
lww9029
dc581d7185 fix: 修复登录状态下还能访问白名单路由问题 2026-10-13 10:36:25 +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
hrz
505925fb21 Dependabot 改月度更新并按用途分组
原本每周跑一次会刷很多零碎 PR,看着烦。改成每月一次,并把第三方 AI 服务、本地模型、网络栈拆成几组聚一起,每组出一个 PR 就行。被锁住的 torch/numpy/websockets 几个直接忽略掉,免得它推升级 PR 进来。
2026-10-13 09:34:02 +08:00
lapy
b5d624bc46
Merge pull request #1 from lapy/rebase/upstream-main-20261011
fix(web): add missing CustomDialog import in ModelEditDialog
2026-10-13 00:31:01 +02:00
lapy
232b43fa6b fix(web): add missing CustomDialog import in ModelEditDialog
The component used the shorthand `components: { CustomDialog }` without a
matching import, so the shared webpack chunk threw
`ReferenceError: CustomDialog is not defined` at evaluation time.
vue-router then registered `undefined` as the ModelConfig view and the
models page rendered blank with no console error.

Fixes blank #/model-config page.
2026-10-12 23:24:56 +01:00
lapy
7898b88b3e chore(audit): single Python implementation, no rg/python divergence
CI runs had no rg on the runner, so the bash script fell back to its python
branch with a different file set (no extension skips; sees gitignored tracked
files) and a different verdict than local rg runs. One deterministic scanner
now serves both: git ls-files walk, NUL sniff + extension skip for binary
blobs (model .cmo3/.can3/.moc3/.jit files decode to CJK-looking garbage),
allowlist for the opentype.js LCID table line, exception zones unchanged.
2026-10-12 17:24:17 +01:00
lapy
830c778b03 i18n(digital-human): translate Live2D display names in model metadata
cdi3.json (parameter/ArtMesh display names) and physics3.json (physics
setting names) of the Hiyori/Natori sample models carried Chinese labels;
Ids are untouched so runtime behaviour is unchanged.
2026-10-12 17:23:56 +01:00
lapy
8361713041 fix(mobile): translate env file comments to English 2026-10-12 17:23:56 +01:00
lapy
6bc3d6bde7 fix(api): dedupe maven-compiler-plugin declaration
Merge of bdb25382 (proc/lint flags) with upstream's compiler pin left two
<plugin> entries for the same GA. Maven 3.9+ (CI) treats duplicate plugin
declarations as a fatal POM error; only 3.8 tolerated it as a warning.
Merged configuration: source/target 21, proc=full, lint args, lombok
annotation processor path.
2026-10-12 17:23:56 +01:00
lapy
56e83aaec0 fix(web): generator bundle resolves its route under the console mount path
The previous rebuild baked createWebHistory('./') which vue-router normalizes
to '/.' and matches nothing - the page rendered only the header shell. The
bundle now derives its router base from document.baseURI, verified in a real
browser at /generator/: step wizard renders, zero Han in the UI.
2026-10-12 14:25:20 +01:00
lapy
13a627af6b chore(audit): generator code bundle no longer exempt from Han scan
The rebuilt bundle ships translated strings, so westernization_audit.sh now
scans generator/assets + index.html as live source (allowlisting the one
third-party opentype.js LCID font-name table line). The exception narrows to
generator/static device data, which the firmware consumes byte-for-byte.
westernization.md documents the checkout location and rebuild flow.
2026-10-12 14:16:35 +01:00
lapy
39ba5efd1b chore(web): rebuild vendored generator from translated source
Regenerated from the westernized xiaozhi-assets-generator checkout:
- code bundle is now Han-free (locales, toasts, log messages translated upstream)
- built with relative base ./ so the console's /generator/ mount actually
  resolves its assets (upstream default /tools/assets-generator/ 404s there,
  matching upstream's older relative-path vendored copy)
- static/ device data (charsets, fonts, emoji gifs, wakenet blobs) unchanged
2026-10-12 14:16:35 +01:00
hrz
4aa63baf75 fix(router): 路由守卫改 anon 白名单反向匹配
业务路由越加越多,原来硬编码的 8 项守卫名单跟不上了,
未登录直接进十来个业务页看到骨架再被踢,体感抖。

守卫改成只对登录、注册、找回密码、根路径这四页放行,其余一律查 token。
顺手把 9 处没人读的 meta.requiresAuth 和 meta.title 死字段删了。
2026-10-12 18:02:36 +08:00
Sakura-RanChen
e5f326285e update: 优化client 生命周期对齐业务请求——重试内连接复用、锁外构造、safe_close 可打断重试 2026-10-12 15:42:51 +08:00
hrz
4576e391bb
fix(ci): 阿里云 PyPI 镜像 metadata 缺失回退官方源 (#3417)
基镜像构建挂了——日志显示 pip 在装 requirements.txt 阶段退出码 1,
罪魁是阿里云 pypi 镜像对 mcp==1.22.0 的元数据文件 404。

装包那行加 --extra-index-url https://pypi.org/simple,
主源没货时自动去官方源捞。
2026-10-12 10:28:35 +08:00
Yanhan Ruan
ef1d24e40d
fix(server): 修复临时事件循环结束后 HTTP 客户端未释放的问题 (#3416) 2026-10-12 10:00:28 +08:00
lapy
3d2e6909e5 docs: remove dead vicp.fun demo block and broken translated READMEs
- README: replace upstream-only demo endpoints with self-host tip; refresh
  TTS/ASR provider tables (ElevenLabs, Kokoro added; Sherpa dropped)
- delete de/pt_BR/vi README forks whose links and content rotted; point users
  to the English docs tree instead
2026-10-11 18:54:44 +01:00
lapy
6b05efdb07 fix(mobile): remove duplicate provider/speedPitch route entries in pages.json 2026-10-11 18:54:44 +01:00
lapy
7e09042f40 chore(server): drop ad-hoc dependency/integration scratch scripts
update_dependencies.py pinned 'latest 2025' versions outside requirements.txt,
test_all_integrations.py and TEST_RESULTS_SUMMARY.md were one-off run artefacts;
pytest covers the same provider contracts.
2026-10-11 18:54:37 +01:00
lapy
bb74a719a1 fix(web): repair merge-corrupted views and restore build
- global.scss: restore scrollbar-style mixin and dialog overlay tiers
- ModelConfig/ModelEditDialog/home: replace /deep/ with ::v-deep, fix CSS
  comments and malformed template nesting
- AgentTemplateManagement/DictManagement/ParamsManagement/VoiceCloneManagement:
  restore script blocks corrupted by merge conflict resolution
- package.json: re-add v-code-diff; npm run build passes cleanly
- router: drop KnowledgeFileUpload route (view removed upstream in 0eb0a600)
- login/register: point legal links at -en pages, delete duplicate CN html
2026-10-11 18:54:32 +01:00
lapy
a72af7e55f fix(api): align seed-data cleanup changeset with Western defaults
202610111200 now purges stale RSS feeds (dead reuters feeds since 2020),
replaces CN Home-Assistant entity placeholders with generic English ids and
keeps the Han-free seed assertion green in LiquibaseWesternizationIntegrationTest.
2026-10-11 18:54:32 +01:00
lapy
ff23ac3f7d fix(server): restore merge-lost runtime fixes and western defaults
- hass_state: use httpx (async) instead of undefined requests/asyncio.TimeoutError
- prompt_manager: call sync get_weather directly on executor thread; drop lunar plumbing
- register: repopulate module_func_map so module-level plugins expand to functions
- whisper/kokoro: run blocking transcribe/HTTP calls via asyncio.to_thread
- edge TTS: re-apply volume/rate/pitch percentage params; elevenlabs: pass voice_settings
- add GeminiVLLM provider (google-genai) backing the GeminiVLLM config entry
- get_news: dedicated NEWS cache (15m) and live Western RSS defaults; drop dead newsnow branch
- play_music: return Action.RECORD so playback turns enter dialogue history
- ota_handler: default timezone_offset 0; config: prompt_template, HA entities, voice, language
- agent-base-prompt.txt: rebuilt from upstream engineered English baseline
- tests: drop shims/expectations for providers removed by the western provider set
2026-10-11 18:54:25 +01:00
lapy
70771b4209 chore(westernization): translate remaining Han text across code, UI and docs
Final localization pass over everything the audit covers, driven by the
local qwen3.8:instruct endpoint (thinking disabled) with placeholder-
masked, cached, resumable batches:

- Python server: comments, docstrings, log/error messages, prompt text
- manager-api Java: javadoc, exception messages, Swagger summaries,
  westernized test fixtures (locale strings, signed-URL examples)
- manager-web / manager-mobile: component comments and misc leftovers
  (functional split regexes such as /[、;;,,]/ left byte-identical)
- digital-human: HTML/UI text, JS comments, wake-word defaults aligned
  with the server canonical English wake words
- docs: device-call guide, wakeword and search integration guides

Also widens the westernization audit exception to the whole vendored
generator bundle and retires the stale per-file exception list.
2026-10-11 17:58:15 +01:00
lapy
302ed23055 fix(web): validate stored language against supported locales
Drop the dead zh-CN/zh-TW Element locale imports, resolve any stored
language only when it is in supportedLanguages (else fall back to en),
and generalize the language-code tooltip example from zh-CN to en-US.
2026-10-11 17:58:09 +01:00
lapy
e786e948ec test(api): fix maskMiddle expected suffix
maskMiddle keeps a 4-char tail, so the masked '...e123' suffix is the
contract, not '...3123'.
2026-10-11 17:58:02 +01:00
lapy
934a349cdd test(api): make mock RedisUtils usable and stop aspect swallowing calls
Add @Override to the in-memory RedisUtils mock methods and enable
renren.redis.open in the test profile so RedisAspect routes to the mock
instead of short-circuiting cached lookups to null.
2026-10-11 17:58:02 +01:00
lapy
514928722d test(server): keep httpx shim a real subclass and fake edge-tts streaming
The mock AsyncClient/Client dropped wrapper methods (send,
build_request) that provider helpers rely on, so subclass the real
httpx clients and only override the transport seam. Also give
edge_tts.Communicate a fake async stream so the TTS text-to-speech
test no longer opens a real Bing websocket.
2026-10-11 17:58:02 +01:00
lapy
bdf184db01 fix(server): restore upstream config-load deadlock fix lost in rebase
check_config_file() must drive the coroutine with asyncio.run(), and
setup_logging() must accept an already-loaded config (or hit the cache)
instead of re-entering the event loop from a running loop.
2026-10-11 17:57:56 +01:00
lapy
6086ca1e18 fix(api): keep TimbreDetailsVO.sort nullable
Revert the field to Long so legacy timbre rows with a NULL sort keep
deserializing instead of blowing up on unboxing.
2026-10-11 17:57:52 +01:00
lapy
0ccaf3a6b1 fix(db): replay upstream changelog history and add westernization cleanup changeset
Register the upstream Liquibase changesets (202606231030..202609172100) that
were dropped during the rebase, and append a downstream cleanup changeset
(202610111200) that westernizes EdgeTTS field remarks, purges the retired
MinimaxStreamTTS rows and updates the HA / web-search plugin descriptors.

Extend the H2 replay harness to cover what the upstream SQL now needs:
- MySQL JSON_SET/REPLACE semantics incl. array-index paths ($[0].label)
- double-quoted string literals and multi-clause ALTER TABLE splitting
- assertions for the new cleanup changeset results
2026-10-11 17:57:49 +01:00
lapy
feb6edb47f fix(westernization): runtime English surface, voiceprint truth, CI gates
Server runtime:
- translate model-visible strings: direct_answer tool schema, web_search
  tool desc/errors/results, call_device tool desc/replies, hass_state
  desc/report strings; they were Chinese text fed to LLMs and devices
- replace Chinese pconline geocoder with ip-api.com (English city names)
- prompt_manager: drop dead Chinese WEEKDAY_MAP, stop forcing lang=zh_CN
  for weather, English fallback location
- delete orphan alibl_endpoint.py (no importers after AliBL removal) and
  dead initialize_voiceprint() calling a nonexistent ASR hook
- translate mcp_server_settings.json descriptors
- test_current_time: assert English weekday/date behavior (upstream test
  still expected Chinese weekdays)

Docs/branding:
- README and docs/guides/voiceprint.md: voiceprint IS implemented via the
  HTTP VoiceprintProvider; document the real protocol (health/identify)
  and privacy notes instead of falsely claiming the feature is missing
- issue templates: English

Ops:
- Dockerfile-server-base: drop Aliyun PyPI mirror from published image
- LICENSE: keep xinnan-tech copyright notice alongside downstream (MIT)
- CI: run westernization_audit as a gate; make smoke test failure fatal
- westernization.md: point python verification at the real pytest layout
2026-10-11 13:13:07 +01:00
lapy
cfe3da5c7b fix(rebase): send MCP initialize once and align python deps with upstream
The merge-rebase kept both the old downstream MCP initialize dispatch and
upstream's relocated one, so every capable device received two initialize
messages per connection. Keep only the post-hello send (upstream #3347).

requirements: drop chardet (removed upstream, unused here), restore
mcp-proxy 0.12.0, and remove the stale cozepy pin comment (cozepy is not a
downstream dependency).
2026-10-11 12:45:49 +01:00