feat(web): 工作台 AI 模式与差旅/风险建议交互优化

- 新增 PersonalWorkbenchAiMode 组件、AI 侧边栏与 orb 机器人视觉资源
- 新增 aiApplicationDraftModel / aiExpenseDraftModel / aiWorkbenchConversationStore
  及业务准入 aiSidebarBusinessAccess,支撑 AI 模式下的申请与报销草稿
- 顶栏、侧边栏、工作台样式重构,适配 AI 模式切换与响应式布局
- 同步 steward plan/off_topic、差旅报销引导流、风险建议卡片等测试
This commit is contained in:
caoxiaozhu
2026-06-18 22:12:24 +08:00
parent a6674a1e76
commit 0cde1f8990
65 changed files with 8011 additions and 1608 deletions

View File

@@ -0,0 +1,51 @@
import assert from 'node:assert/strict'
import test from 'node:test'
import {
applyAiApplicationAnswer,
buildAiApplicationStepPrompt,
buildAiApplicationSummary,
createAiApplicationDraft,
getAiApplicationCurrentStep,
isAiApplicationDraftComplete
} from '../src/utils/aiApplicationDraftModel.js'
test('application draft starts at the reason step', () => {
const draft = createAiApplicationDraft('travel', '差旅费')
assert.equal(draft.expenseType, 'travel')
assert.equal(draft.expenseTypeLabel, '差旅费')
assert.equal(draft.stepKey, 'reason')
assert.equal(getAiApplicationCurrentStep(draft).key, 'reason')
})
test('answers advance through fields in order and reach summary', () => {
let draft = createAiApplicationDraft('travel', '差旅费')
draft = applyAiApplicationAnswer(draft, '去上海支持项目部署', [])
assert.equal(draft.stepKey, 'time_range')
draft = applyAiApplicationAnswer(draft, '2026-06-20 至 2026-06-22出差 3 天', [])
assert.equal(draft.stepKey, 'location')
draft = applyAiApplicationAnswer(draft, '上海', [])
assert.equal(draft.stepKey, 'amount')
draft = applyAiApplicationAnswer(draft, '约 2358 元', [])
assert.ok(isAiApplicationDraftComplete(draft))
})
test('step prompt names the type and the current field', () => {
const draft = createAiApplicationDraft('travel', '差旅费')
const prompt = buildAiApplicationStepPrompt(draft)
assert.match(prompt, /差旅费/)
assert.match(prompt, /事由/)
})
test('summary lists every filled field', () => {
let draft = createAiApplicationDraft('travel', '差旅费')
draft = applyAiApplicationAnswer(draft, '去上海支持项目部署', [])
draft = applyAiApplicationAnswer(draft, '2026-06-20 至 2026-06-22出差 3 天', [])
draft = applyAiApplicationAnswer(draft, '上海', [])
draft = applyAiApplicationAnswer(draft, '约 2358 元', [])
const summary = buildAiApplicationSummary(draft)
assert.match(summary, /差旅费/)
assert.match(summary, /去上海支持项目部署/)
assert.match(summary, /2026-06-20 至 2026-06-22出差 3 天/)
assert.match(summary, /约 2358 元/)
})