feat(v2): T4 Workspace 交流文本协议(schema/校验/渲染/rollup)

This commit is contained in:
tzt
2026-08-30 21:03:52 +08:00
parent 78a410b773
commit 3ed37a1d30
4 changed files with 861 additions and 75 deletions
+113 -49
View File
@@ -1,49 +1,113 @@
# ============================================================
# 多专业小模型 + 路由模型系统 — 配置
# 默认全 mock 模式(零依赖、离线可跑)。要接入真实模型,把对应
# 后端 type 改为 hf / api 即可(见 README)。
# ============================================================
system:
name: multi-expert-router
version: 0.1.0
router:
low_confidence_threshold: 0.60 # 分类置信度低于此值 -> 直接走大模型
judge_fallback_threshold: 0.70 # Judge 质量分低于此值 -> 升级大模型
default_temperature: 0.2
classifier:
type: rule # rule(零依赖)| hftransformers
model: Qwen/Qwen3-0.6B
confidence_floor: 0.55
domains:
- code
- math
- legal
- medical
- general
experts:
code: { type: mock, model: Qwen/Qwen2.5-Coder-7B-Instruct }
math: { type: mock, model: Qwen/Qwen3-4B-Instruct }
legal: { type: mock, model: Qwen/Qwen3-4B-Instruct }
medical: { type: mock, model: Qwen/Qwen3-4B-Instruct }
general: { type: mock, model: Qwen/Qwen3-1.7B-Instruct }
fallback:
type: mock # mock | apiOpenAI 兼容,如 DeepSeek
model: deepseek-chat
base_url: https://api.deepseek.com/v1
api_key_env: DEEPSEEK_API_KEY
judge:
type: rule # rule(零依赖)| llm
model: Qwen/Qwen3-1.7B-Instruct
cache:
enabled: true
semantic_enabled: true # 语义缓存(字符 n-gram 相似度,零依赖)
similarity_threshold: 0.88
promote_frequency: 5 # 命中 N 次后提升为精确缓存␍
# ============================================================
# 多专业小模型 + 路由模型系统 — 配置
# 默认全 mock 模式(零依赖、离线可跑)。要接入真实模型,把对应
# 后端 type 改为 hf / api 即可(见 README)。
# ============================================================
system:
name: multi-expert-router
version: 0.1.0
router:
low_confidence_threshold: 0.60 # 分类置信度低于此值 -> 直接走最后处理者
judge_fallback_threshold: 0.70 # Judge 质量分低于此值 -> 升级最后处理者
default_temperature: 0.2
# 专家系统内核执行配置(L0 默认零参数)
execution:
mode: rule # rule(默认,L0 零参数)| hybrid
planner: rule # rule(规则拆解)| hf(可选小模型拆解)
expert_backend: rule # rule(规则执行器)| hf | api(本地小模型按需加载)
model_level: L0 # L0 纯规则 | L1 分类/Planner增强 | L2 领域生成
max_plan_depth: 3 # 任务拆解深度上限
classifier:
type: rule # rule(零依赖)| hftransformers
model: Qwen/Qwen3-0.6B
confidence_floor: 0.55
domains:
- code
- math
- legal
- medical
- finance
- life
- education
- general
# 两级路由:大领域分组(用户接口指定 group → 组内路由模型 → 组内专业小模型)
# 组内路由模型只识别本组领域,体积约为统一路由模型的 1/4
domain_groups:
tech: [code, math]
professional: [legal, medical, finance]
lifestyle: [life, education]
general: [general]
experts:
code: { type: mock, model: Qwen/Qwen2.5-Coder-7B-Instruct }
math: { type: mock, model: Qwen/Qwen3-4B-Instruct }
legal: { type: mock, model: Qwen/Qwen3-4B-Instruct }
medical: { type: mock, model: Qwen/Qwen3-4B-Instruct }
finance: { type: mock, model: Qwen/Qwen3-4B-Instruct }
life: { type: mock, model: Qwen/Qwen3-1.7B-Instruct }
education: { type: mock, model: Qwen/Qwen3-1.7B-Instruct }
general: { type: mock, model: Qwen/Qwen3-1.7B-Instruct }
fallback:
type: mock # none(降级模板)| mock | local(本地≤8B 按需加载)| api
model: deepseek-chat
base_url: https://api.deepseek.com/v1
api_key_env: DEEPSEEK_API_KEY
judge:
type: rule # rule(零依赖)| llm
model: Qwen/Qwen3-1.7B-Instruct
cache:
enabled: true
semantic_enabled: true # 语义缓存(字符 n-gram 相似度,零依赖)
similarity_threshold: 0.88
promote_frequency: 5 # 命中 N 次后提升为精确缓存
# ============================================================
# v2:端云协同 LLM 协作系统(《实现方案_v2》)配置段
# v1 段(上方)保留,供 legacy 路由(POST /chat/legacy)使用。
# ============================================================
runtime:
llama_server:
binary: bin/llama-server.exe # 捆绑上游 release,不改源码(D1)
model: models/qwen3.5-4b-q4_k_m.gguf
port: 8901
hw_profile: auto # auto | gpu12 | gpu8 | cpu
extra_args: ["-fa", "-ctk", "q8_0", "-ctv", "q8_0", "--cache-reuse", "256"]
tiers: # 三档硬件模板(保守默认,可手动覆盖)
gpu12: {ngl: 99, ctx: 32768}
gpu8: {ngl: 14, ctx: 16384}
cpu: {ngl: 0, ctx: 8192}
architect: # 大模型(API
model: deepseek-chat
base_url: https://api.deepseek.com/v1
api_key_env: DEEPSEEK_API_KEY
temperature: 0.2
timeout_s: 60
worker: # 小模型(本地)
backend: llama_server
temperature: 0.3
max_fix_attempts: 2
per_step_timeout_s: 300
pipeline:
fast_path: true
rounds_cap: 6
api_token_cap: 8000
breach_policy: architect_do # architect_do | local_only
review:
queue_db: data/review.sqlite3
sample_rate: 0.10 # 随机抽样送审
force_tags: [safety] # brief.tags 命中即强制送审