Files
X-Financial/web/src/composables/workbenchAiMode/workbenchIntentActionPolicy.js

24 lines
822 B
JavaScript
Raw Normal View History

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' }
}