feat(web): AI 工作台意图规划与规划思考模型
- 新增 workbenchAiIntentPlannerModel,基于 LLM function_call 解析建单/草稿/提交意图,区分 model 与 rule_fallback 来源 - 新增 workbenchAiPlanningThinkingModel 合并规划思考事件流,按 eventId 去重合并 - application gate/preview 模型接入意图规划,usePersonalWorkbenchAiMode/useWorkbenchAiStewardFlow/useWorkbenchAiActionRouter 链路适配,支持上下文提交 - steward 服务与 stewardPlanModel 适配新动作结构,receipt-folder-view 微调样式 - 新增 intent-planner-model/application-context-submit/steward-actions-service 测试,更新 gate-model/action-router/plan-message-copy/fast-preview 测试
This commit is contained in:
54
web/tests/steward-actions-service.test.mjs
Normal file
54
web/tests/steward-actions-service.test.mjs
Normal file
@@ -0,0 +1,54 @@
|
||||
import assert from 'node:assert/strict'
|
||||
|
||||
import { executeStewardAction } from '../src/services/steward.js'
|
||||
|
||||
async function testExecuteStewardActionUsesActionEndpoint() {
|
||||
let capturedUrl = ''
|
||||
let capturedOptions = null
|
||||
|
||||
global.fetch = async (url, options) => {
|
||||
capturedUrl = String(url)
|
||||
capturedOptions = options
|
||||
return {
|
||||
ok: true,
|
||||
async json() {
|
||||
return {
|
||||
action_type: 'save_application_draft',
|
||||
status: 'succeeded',
|
||||
message: '申请草稿已保存。',
|
||||
result_payload: {
|
||||
draft_payload: {
|
||||
claim_id: 'claim-action-draft',
|
||||
claim_no: 'A12345678',
|
||||
status: 'draft'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const payload = await executeStewardAction({
|
||||
action_type: 'save_application_draft',
|
||||
message: '保存草稿',
|
||||
task: {
|
||||
task_id: 'task-app-1',
|
||||
task_type: 'expense_application'
|
||||
}
|
||||
})
|
||||
|
||||
assert.equal(capturedUrl, '/api/v1/steward/actions/execute')
|
||||
assert.equal(capturedOptions.method, 'POST')
|
||||
assert.equal(JSON.parse(capturedOptions.body).action_type, 'save_application_draft')
|
||||
assert.equal(payload.status, 'succeeded')
|
||||
}
|
||||
|
||||
async function run() {
|
||||
await testExecuteStewardActionUsesActionEndpoint()
|
||||
console.log('steward actions service tests passed')
|
||||
}
|
||||
|
||||
run().catch((error) => {
|
||||
console.error(error)
|
||||
process.exit(1)
|
||||
})
|
||||
Reference in New Issue
Block a user