Skip to content

fix(router): 配置审查加载不出来 + benchmark query 噪声过滤 - #130

Open
ganisback wants to merge 2 commits into
mainfrom
fix/router-v2-profile-savings-tofixed-crash
Open

fix(router): 配置审查加载不出来 + benchmark query 噪声过滤#130
ganisback wants to merge 2 commits into
mainfrom
fix/router-v2-profile-savings-tofixed-crash

Conversation

@ganisback

Copy link
Copy Markdown
Collaborator

改动

两个相关修复,都针对 pool 优化路由:

1. 配置审查加载不出来(toFixed 崩溃)

RouterV2ProfileReviewsummary.savings!.toFixed(6) 非空断言,但后端 Savings 字段带 json:"...,omitempty"。collapsed 到单成员的 profile 里 Savings=0 被省略,前端拿到 undefined,undefined.toFixed 抛 TypeError,Preact 组件崩溃 → 配置审查空白。

改为 (summary.savings ?? 0).toFixed(6)

2. benchmark query 噪声过滤(依赖升级)

升级 semantic-router v0.1.0 → v0.2.0。新版本在 curation 时过滤 coding agent 注入的 user-role 噪声 turn(<task-notification>/<system-reminder>/<tool-use-id> 等),只取真实用户意图做 routing query 和 embedding。

之前 25 条评估 query 全是同一任务(llama.cpp 升级)的工具通知片段,导致校准塌缩到单成员。过滤后 128 条历史请求产出 53 个 distinct 真实 query。

验证

  • Chrome CDP 实测:配置审查完整渲染,0 异常
  • semantic-router 集成测试:过滤前全是 task-notification/URL,过滤后 53 distinct 真实 query,0 markup 残留
  • go build + golangci-lint 通过

关联

Generated with AI

ganisback and others added 2 commits August 30, 2026 10:16
RouterV2ProfileReview used summary.savings!.toFixed(6) with a non-null
assertion, but the backend tags Savings/SavingsFraction with
json:"...,omitempty". When routed cost equals baseline cost (collapsed to a
single member), Savings is 0 and omitted from the JSON, so the field is
undefined at runtime and undefined.toFixed throws
"Cannot read properties of undefined (reading 'toFixed')". The Preact
component crashes and the "配置审查" (profile review) tab renders blank.

Use (summary.savings ?? 0).toFixed(6) so a zero/missing savings shows
0.000000 instead of crashing. savings_fraction was already guarded with
|| 0; the cost fields are safe because they sit behind the
knownComparableCost branch which checks cost_known first.

Verified by driving the UI via CDP: the profile tab now renders fully
with 0 exceptions, including the previously crashing "预估已知节省
0.000000 ¥ (0.0%)" card.

Generated with AI

Co-Authored-By: csglite <xzhgan@gmail.com>
Pulls in agent-noise filtering in benchmark query curation
(OpenCSGs/semantic-router v0.2.0), which prevents coding-agent
tool/system turns (<task-notification>, <system-reminder>, etc.)
from being selected as the routing query and collapsing calibration
onto a single task family.

Generated with AI

Co-Authored-By: csglite <xzhgan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant