global:
router:
learning:
enabled: true # 启用跨请求的 Router Learning
protection:
enabled: true # 启用模型连续性保护
scope: session # 按 Session ID 共享当前模型状态
identity:
headers:
session: x-session-id # 客户端需要传递这个请求头
conversation: x-conversation-id # Session Scope 下不参与状态键
routing:
strategy: priority # 多个 Decision 命中时,优先级高者胜出
signals:
keywords:
- name: economy_keywords
operator: OR # 任意一个关键词匹配即可
method: ngram # 使用字符 N-gram 近似匹配
keywords: ["经济", "通胀", "GDP", "economy", "inflation"]
case_sensitive: false
ngram_threshold: 0.4 # 相似度阈值
- name: math_keywords
operator: OR
method: ngram
keywords: ["方程", "积分", "矩阵", "equation", "calculus"]
case_sensitive: false
ngram_threshold: 0.4
decisions:
- name: math
priority: 200 # 高于 Economy Decision
rules:
operator: AND # 所有条件都要满足,此处只有一个
conditions:
- type: keyword # 引用上面的 Keyword Signal
name: math_keywords
modelRefs:
- model: math-model # Math Decision 的模型
adaptations:
mode: bypass # 跳过该 Decision 的全部 Router Learning
- name: economy
priority: 100
rules:
operator: AND
conditions:
- type: keyword
name: economy_keywords
modelRefs:
- model: economy-model