按已确认需求提供独立安全模型配置、真实探测、正式字典字段评估与原问题译中,持久批次支持只补空白、暂停恢复、有限重试、幂等和逐字段依据。覆盖固定规则、本地语言、组织关联与主表有效看板共用治理侧读模型,保留源生产和冻结历史。 验证:完整 make verify 退出0,702项Go与329项前端通过;默认118项外部/隔离集成明确跳过,另跑完整镜像及组织隔离PG竞态。12并发、输入漂移、过期租约、暂停/恢复及有限重试通过。用户授权的百炼 deepseek-v4.1-flash 完成真实后台与浏览器评估/翻译;552行、16列、11块看板及完整PNG、独立配置页测试/保存、重开恢复和零JS异常通过。仅非业务样本外发,自动处理关闭,原payload不变。 上线前治理库已做导出快照原生备份并真实恢复,60表行数与17个QA表内容哈希一致;不修改DobotAI生产或隧道。本提交时尚未部署,线上验收须独立完成。
This commit is contained in:
@@ -0,0 +1,111 @@
|
||||
import { it, expect } from 'vitest'
|
||||
import { renderToStaticMarkup } from 'react-dom/server'
|
||||
import { QAAIWorkbench, QAAIEvidenceView } from './QAAI'
|
||||
import type { AIStatus, AIEvidence } from './qaAITypes'
|
||||
const status: AIStatus = {
|
||||
settings: {
|
||||
revision: 1,
|
||||
base_url: 'https://model.example.invalid/v1',
|
||||
model: 'fixture',
|
||||
key_configured: true,
|
||||
verification: 'verified',
|
||||
checked_at: null,
|
||||
automatic_evaluation: true,
|
||||
automatic_translation: false,
|
||||
storage_ready: true,
|
||||
},
|
||||
worker_ready: true,
|
||||
queues: [{ kind: 'evaluation', queued: 2, running: 1, retry: 0, failed: 1, paused: 0, succeeded: 2, skipped: 0 }],
|
||||
batches: [],
|
||||
recent_tasks: [],
|
||||
recent_tasks_limited: false,
|
||||
}
|
||||
it('shows open-ended automatic queue counts without fabricating a percentage', () => {
|
||||
const html = renderToStaticMarkup(
|
||||
<QAAIWorkbench
|
||||
initial={status}
|
||||
query={{ start: '2026-10-05T00:00:00Z', end: '2026-10-12T00:00:00Z', keyword: 'executed-query', cursor: '' }}
|
||||
/>
|
||||
)
|
||||
for (const value of ['补缺评估', '补缺中文翻译', '当前已执行筛选', '后台任务', '排队 2', '执行 1', '失败 1'])
|
||||
expect(html).toContain(value)
|
||||
expect(html).not.toContain('100%')
|
||||
})
|
||||
it('exposes persistent pause, resume and failed-only retry without claiming completion is success', () => {
|
||||
const batches: AIStatus['batches'] = [
|
||||
{
|
||||
id: 'active-batch',
|
||||
kind: 'evaluation',
|
||||
state: 'active',
|
||||
total: 2,
|
||||
succeeded: 0,
|
||||
failed: 1,
|
||||
skipped: 0,
|
||||
running: 0,
|
||||
queued: 1,
|
||||
retry: 0,
|
||||
paused: 0,
|
||||
created_at: '2026-10-19T00:00:00Z',
|
||||
},
|
||||
{
|
||||
id: 'paused-batch',
|
||||
kind: 'translation',
|
||||
state: 'paused',
|
||||
total: 1,
|
||||
succeeded: 0,
|
||||
failed: 0,
|
||||
skipped: 0,
|
||||
running: 0,
|
||||
queued: 0,
|
||||
retry: 0,
|
||||
paused: 1,
|
||||
created_at: '2026-10-19T00:00:00Z',
|
||||
},
|
||||
]
|
||||
const html = renderToStaticMarkup(<QAAIWorkbench initial={{ ...status, batches }} query={null} />)
|
||||
for (const value of ['暂停批次', '恢复批次', '重试失败项', '已结束不代表全部成功', '已发出的请求完成后暂停后续请求'])
|
||||
expect(html).toContain(value)
|
||||
})
|
||||
it('renders original evidence quotes, actual model/version and applied-versus-skipped provenance', () => {
|
||||
const evidence: AIEvidence = {
|
||||
id: 'w',
|
||||
record_id: 'r',
|
||||
kind: 'evaluation',
|
||||
state: 'succeeded',
|
||||
stage: 'completed',
|
||||
attempt: 1,
|
||||
error_code: '',
|
||||
skip_reason: '',
|
||||
started_at: '2026-10-19T00:00:00Z',
|
||||
updated_at: '2026-10-19T00:00:01Z',
|
||||
input_hash: 'a'.repeat(64),
|
||||
config_revision: 1,
|
||||
prompt_version: 'prompt-fixture-v1',
|
||||
dictionary_version: 'dict-fixture-v1',
|
||||
actual_model: 'actual-fixture-model',
|
||||
result: {
|
||||
fields: {
|
||||
product_category: {
|
||||
value: 'MG400',
|
||||
basis: 'semantic_only',
|
||||
reason: '原问题明确包含型号',
|
||||
quotes: [{ source: 'question', text: 'MG400 怎么连接?', reference_index: 0 }],
|
||||
},
|
||||
},
|
||||
},
|
||||
applied_fields: { product_category: 'MG400' },
|
||||
skipped_fields: {},
|
||||
}
|
||||
const html = renderToStaticMarkup(<QAAIEvidenceView evidence={[evidence]} />)
|
||||
for (const value of [
|
||||
'字段结论与依据',
|
||||
'原问题明确包含型号',
|
||||
'MG400 怎么连接?',
|
||||
'仅语义判断',
|
||||
'actual-fixture-model',
|
||||
'prompt-fixture-v1',
|
||||
'dict-fixture-v1',
|
||||
'已回填',
|
||||
])
|
||||
expect(html).toContain(value)
|
||||
})
|
||||
Reference in New Issue
Block a user