fix(growth,runtime,desktop): E2E 验证 4 项 Bug 修复
Some checks are pending
CI / Lint & TypeCheck (push) Waiting to run
CI / Unit Tests (push) Waiting to run
CI / Build Frontend (push) Waiting to run
CI / Rust Check (push) Waiting to run
CI / Security Scan (push) Waiting to run
CI / E2E Tests (push) Blocked by required conditions

P1 BUG-1: SemanticScorer CJK 分词缺失导致 TF-IDF 相似度为 0
- 新增 CJK bigram 分词: "北京工作" → ["北京","京工","工作","北京工作"]
- 非CJK文本保持原有分割逻辑
- 3 个新测试: bigram 生成 + 混合文本 + CJK 相似度>0

P1 BUG-2: streamStore lifecycle:end 未记录 token 使用量
- AgentStreamDelta 增加 input_tokens/output_tokens 字段
- lifecycle:end 处理中检查并调用 addTokenUsage

P2 BUG-3: NlScheduleParser "X点半" 解析为整点
- 所有时间正则增加可选的 (半) 捕获组
- extract_minute 辅助函数: 半 → 30

P2 BUG-4: NlScheduleParser "工作日每天" 未转为 1-5
- RE_WORKDAY_EXACT 支持 (每天|每日)? 中缀
- try_workday 优先级提升至 try_every_day 之前

E2E 报告: docs/E2E_TEST_REPORT_2026_04_19.md
测试: 806 passed / 0 failed (含 9 个新增测试)
This commit is contained in:
iven
2026-04-20 00:07:07 +08:00
parent 39768ff598
commit 24b866fc28
5 changed files with 405 additions and 21 deletions

View File

@@ -55,6 +55,9 @@ export interface AgentStreamDelta {
phase?: 'start' | 'end' | 'error';
runId?: string;
error?: string;
// Token usage fields (from lifecycle:end)
input_tokens?: number;
output_tokens?: number;
// Hand event fields
handName?: string;
handStatus?: string;

View File

@@ -779,6 +779,14 @@ export const useStreamStore = create<StreamState>()(
set({ isStreaming: false, activeRunId: null });
if (delta.phase === 'end') {
// Record token usage if present in lifecycle:end event
const inputTokens = delta.input_tokens;
const outputTokens = delta.output_tokens;
if (typeof inputTokens === 'number' && typeof outputTokens === 'number'
&& inputTokens > 0 && outputTokens > 0) {
useMessageStore.getState().addTokenUsage(inputTokens, outputTokens);
}
const latestMsgs = _chat?.getMessages() || [];
const completedMsg = latestMsgs.find(m => m.id === streamingMsg.id);
if (completedMsg?.content) {