- 待发箱抽屉: ChatInput ⏰ 入口 + OutboxDrawer + useAiOutbox IPC 封装
- U2 进度语义三层: 内容层(最近动作) + 静默三档降速脉冲, 永不自动判死
- 流式心跳自愈: 竞态窗口旧任务迟到完成事件误收敛的自愈判定(949 前端兜底)
- 953 截断提示: 末条气泡渲染截断标记 + 继续输出按钮, 事件契约透传
21 lines
999 B
JavaScript
21 lines
999 B
JavaScript
// 心跳自愈判定纯函数单测(看板 949)—— 仓库无 vitest,走 node 内置测试跑(零第三方依赖):
|
|
// node --test tests/streamSelfHeal.test.mjs
|
|
// 契约:仅「后端生成中 且 前端流式态丢失」自愈 —— 与迟到收尾仲裁(后端 true 且前端 true
|
|
// 才拦截)判定域互补,两机制不同时动作。
|
|
import test from 'node:test'
|
|
import assert from 'node:assert/strict'
|
|
import { shouldSelfHealStreaming } from '../src/composables/ai/streamSelfHeal.ts'
|
|
|
|
test('自愈:后端生成中而前端流式态丢失(force_send 竞态误杀场景)', () => {
|
|
assert.equal(shouldSelfHealStreaming(true, false), true)
|
|
})
|
|
|
|
test('不自愈:后端生成中且前端仍在流式(迟到仲裁管辖域)', () => {
|
|
assert.equal(shouldSelfHealStreaming(true, true), false)
|
|
})
|
|
|
|
test('不自愈:后端已终止(真收尾,收敛语义正确)', () => {
|
|
assert.equal(shouldSelfHealStreaming(false, true), false)
|
|
assert.equal(shouldSelfHealStreaming(false, false), false)
|
|
})
|