Files
X-Financial/web/src/composables/workbenchAiMode/workbenchIntentActionPolicy.js
caoxiaozhu 59353308a2 feat(web): AI 意图规划置信度阈值与动作策略细化
- workbenchAiIntentPlannerModel 新增 WORKBENCH_AI_INTENT_CONFIDENCE_THRESHOLD 与 isLowConfidenceTravelApplicationPlan,shouldRequestWorkbenchAiIntentPlan 增加业务关键词前置过滤
- resolveExecutableTravelApplicationPlan 区分 requestedSubmit 与提交确认(submitRequiresConfirmation),autoSubmit 不再直接置真
- workbenchIntentActionPolicy 改用 policyDecision 路由(need_confirmation/query_candidates),透传 riskLevel/requiresSelection/requiresConfirmation
- workbenchIntentFrameModel 补充 query 动作识别,usePersonalWorkbenchAiMode/useWorkbenchAiActionRouter/useWorkbenchAiApplicationPreviewFlow 接入低置信度与确认流程
- 更新 intent-planner-model/intent-frame-model/application-gate-model/fast-preview 测试
2026-06-25 10:55:49 +08:00

32 lines
1.1 KiB
JavaScript

const QUERY_CANDIDATE_ACTIONS = new Set(['delete', 'approve', 'reject', 'query'])
export function resolveWorkbenchIntentActionRoute(frame = null) {
if (!frame) {
return { nextStep: 'pass_through' }
}
if (frame.safetyLevel === 'blocked') {
return { nextStep: 'blocked', reason: '高风险批量动作需要先选择具体单据。' }
}
if (frame.action === 'ask_policy') {
return { nextStep: 'pass_through' }
}
if (frame.policyDecision === 'need_confirmation') {
return {
nextStep: 'open_context_confirm',
riskLevel: frame.riskLevel,
requiresSelection: Boolean(frame.requiresSelection),
requiresConfirmation: Boolean(frame.requiresConfirmation)
}
}
if (frame.policyDecision === 'query_candidates' && QUERY_CANDIDATE_ACTIONS.has(frame.action)) {
return {
nextStep: 'query_candidates',
queryPrompt: frame.normalizedQuery || '',
riskLevel: frame.riskLevel,
requiresSelection: Boolean(frame.requiresSelection),
requiresConfirmation: Boolean(frame.requiresConfirmation)
}
}
return { nextStep: 'pass_through' }
}