feat(web): AI 工作台命令意图解析与动作策略

- 新增 workbenchIntentFrameModel,解析删除/审批/查询/咨询政策等意图帧,含风险等级、目标模式(当前上下文/筛选候选)与日期归一化
- 新增 workbenchIntentActionPolicy,按意图帧路由下一步(直通/拦截批量/上下文确认/查询候选)
- 新增 workbenchAiCommandIntentModel 与 useWorkbenchAiCommandIntents,识别草稿删除意图并解析最近草稿载荷生成引导
- usePersonalWorkbenchAiMode 接入命令意图处理,personal-workbench-ai-mode.css 适配
- 新增 command-intent-model/intent-frame-model 测试
This commit is contained in:
caoxiaozhu
2026-06-24 22:58:59 +08:00
parent a0f6d9f702
commit 3eb78d343a
8 changed files with 732 additions and 2 deletions

View File

@@ -0,0 +1,23 @@
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.targetMode === 'current_context' && frame.safetyLevel === 'confirm_required') {
return { nextStep: 'open_context_confirm' }
}
if (frame.targetMode === 'filtered_candidates' && QUERY_CANDIDATE_ACTIONS.has(frame.action)) {
return {
nextStep: 'query_candidates',
queryPrompt: frame.normalizedQuery || ''
}
}
return { nextStep: 'pass_through' }
}