Files
CyberGril/config/models.yaml
T
xiaomoandmultica-agent 958c6962fb HEL-908 R1/R2 rework (HEL-909 review): whole-turn reasoning gate + cg.interrupt data channel
R1 — reasoning separation truly closed. The streaming hold leaked wholesale
on real token arrival (review A1: 'private reasoning '*20 beyond the 128-char
bound, no sentence ender; review A2: a Chinese sentence ender released the
hold) AND the adapter consumed the stray closer, so the app-level turn split
could never recover — the previous 'persistence and receipt always clean'
claim was false and is retracted. Per the engineering ruling the adapter now
has two explicit endpoint modes (GOV-006, no heuristics, no new engine):
buffer_turn (TurnReasoningGate) emits NOTHING during generation, splits the
whole turn at stream end and only then delivers the clean visible text; it
is set explicitly for all tiers in config/models.yaml (first visible text
waits for the full generation; cancelled/timed-out turns emit nothing and
end exactly as before — recorded and test-pinned, low latency NOT claimed).
stream (default, backward compatible) keeps explicit-tag/field semantics and
passes stray closers through unmodified so the turn-level split keeps its
signal. Both review strings and the recorded id=12 stream replay clean at
every chunk size through the real adapter and the real app into chat.delta,
the archive and the receipt; normal zh/en preserved byte-for-byte; unclosed
explicit thinking still fails honestly.

R2 — an authoritative interrupt when the LLM already finalized and TTS is
still playing (review evidence C: zero interrupts, old audio played out).
The page's existing hush() entry (ChatPanel untouched) now also publishes
{"v":1} on the room's own reliable data channel topic cg.interrupt
(fire-and-forget: a dropped publish never blocks or breaks the text send);
the worker subscribes data_received, validates topic/sender/payload and
calls session.interrupt(force=True) — the SDK's own programmatic interrupt,
force confirmed against the installed 1.8.8 source (non-force raises
RuntimeError on allow_interruptions=False speech). Failures log loudly; the
listener is unloaded via add_shutdown_callback; the server-cancel path in
llm_chat_api also interrupts with force and logs failures.

Verification (offline, zero real requests): real-SDK harness 8/8 including a
real SpeechHandle with a genuinely pending playout wait released by the
cg.interrupt message after a clean chat.final (evidence-C shape) plus the
full validation matrix; .venv311 full suite 480 passed / 8 skipped (2
test_r3 failures pre-exist at 5625de6); web npm ci from the existing lock,
typecheck 0 errors, lint 0 errors + 1 pre-existing warning, vitest 148/148,
build ok; ruff clean; check_requirements vs origin/main and b8ec832 with the
corrected handoff.

Co-authored-by: multica-agent <github@multica.ai>
2026-10-28 22:21:16 +08:00

150 lines
5.7 KiB
YAML
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.
# =============================================================================
# 模型选型 —— 全项目唯一允许写模型版本号的地方
# =============================================================================
#
# 三层架构:大模型按「关键时刻」分配,不按时间分配。
#
# none 纯规则。心跳、主动性判定、填充词、表情。不调用任何模型。
# low 本地小模型。生活事件、记忆压缩、事实抽取、输出初筛。
# standard 中档。投机响应的第二段、短上下文场景。
# high 旗舰。主对话、主动联系、危机场景。
#
# 一个 60 秒心跳只做四则运算(情绪衰减方程),给它模型是架构错误。
#
# 版本依据:2026-10 调研。每季度复核一次。
# =============================================================================
tiers:
# ---- 旗舰:人设浓度最高的时刻 ----
high:
provider: openai_compat
model: halogen-qwen3.8-flash-next
base_url: http://192.168.200.11:8731/v1
api_key_env: null
timeout: 60.0
temperature: 0.85
# HEL-908/909:该端点会把隐式开头思考(无 <think>、模板预填)混入 content,
# 只能整轮缓冲后分离;首段可见文本因此等整轮生成完成(见 reasoning.py)。
reasoning: buffer_turn
# ---- 中档:可以指向同一个模型,但配更短的上下文预算 ----
# 省钱的杠杆通常不是换更小的模型,而是少喂上下文。
standard:
provider: openai_compat
model: halogen-qwen3.8-flash-next
base_url: http://192.168.200.11:8731/v1
api_key_env: null
timeout: 40.0
temperature: 0.7
reasoning: buffer_turn
# ---- 本地小模型:后台任务的主力 ----
# 没有本地服务时,把它指向 openai_compat 的远端小模型即可。
low:
provider: openai_compat
model: halogen-qwen3.8-flash-next
base_url: http://192.168.200.11:8731/v1
api_key_env: null
timeout: 20.0
temperature: 0.4
reasoning: buffer_turn
# ---- 场景 → 档位 ----
# 改这里就能调成本结构,不用改代码。
routing:
# 对话
dialogue_main: high # 主对话台词
dialogue_followup: standard # 投机响应的第二段
proactive_message: high # 主动联系的措辞
crisis: high # 危机场景,永不降级
# 后台
life_event: low # 每天 1–4 条生活事件
memory_gist: low # 记忆压缩(量最大)
fact_extract: low # 语义事实抽取
output_guard: low # 输出校验
pattern_detect: low # 关系模式识别
# 无模型(这些写 dead 也应该是 none)
filler: none # 填充词:从状态核心查表
tick: none # 心跳:纯数学
reach_out: none # 主动性判断:纯规则
avatar_drive: none # 表情姿态:由 State 直接算
# ---- 预算 ----
# 没有预算控制的架构,在第一个月账单出来时就会崩。
# HEL-882:请求次数硬顶与 token 一样是真实硬闸(发送前原子预占,到顶拒绝,
# 重启不归零)。以下数值全部是「未批准」的 fail-closed 默认:执行表
# docs/budget-plan-hel874.md A/C 部分待批上限不构成批准,批准前一律 0=拒绝。
budget:
daily_tokens: 2000000
warn_ratio: 0.7
hard_stop_ratio: 0.95
daily_requests:
dialogue: 0 # 主对话+主动措辞+危机(C 表建议 60/日,待批)
life: 0 # 生活事件生成(C 表建议 8/日,待批)
background: 0 # gist/判定/成长(C 表建议 40/日,待批)
semantic: 0 # Mem0 提取 LLM(C 表建议 40/日,待批)
# total_requests: 55 # A 部分一次性团队检查总请求硬顶(待批,由总管填)
# total_tokens: 500000 # A 部分一次性总 token 硬顶(待批,由总管填)
# =============================================================================
# 语音链路
# =============================================================================
# ---- 主 ASR ----
# 内部契约是「事件流」:partial → final。
# 如果你的后端只有「文件进→文本出」,它会以 supports_partial=False 降级,
# 端点检测会退化成纯能量判定(会抢话)。
asr:
provider: scripted # 起步用 scripted;生产换流式后端
model: qwen3-asr-1.7b
language: zh
# ---- 副语言旁路 ----
# 独立于主 ASR。2026-10 仍不存在「中文流式识别 + 结构化副语言」的单一模型。
# 关掉它,伴侣就不知道用户笑了,只知道看到了「哈哈」两个字。
paralinguistic:
provider: scripted
model: sensevoice-small
window_ms: 1500
enabled: true
# ---- TTS ----
# 注意 provider 能力差异:
# silence / cosyvoice → 支持 speech_tags([laughter] [breath])
# openai_compat → 不支持,标签会被剥掉并上报降级
tts:
provider: silence
model: fun-cosyvoice3-0.5b
voice_ref: null # 零样本克隆参考音频,3–10 秒
sample_rate: 16000
# ---- VAD ----
# Silero v6 只吃 16kHz。改 sample_rate 前先确认模型支持。
vad:
provider: energy # 起步用 energy;生产换 silero
model: silero-v6
sample_rate: 16000
# ---- 轮次判定 ----
# 两段式的第二段:判断「说完了没」,不是「有没有声音」。
turn:
provider: heuristic
silence_min_ms: 150
silence_hard_end_ms: 800 # 伴侣场景建议 700–900,宁可多等不抢话
# ---- Embedding ----
embedding:
provider: openai_compat
model: qwen3-embedding-0.6b
base_url: null
api_key_env: null
dim: 1024
# ---- 形象 ----
avatar:
route: vrm
renderer: three.js
lipsync: envelope