refactor(frontend): split large reimbursement and audit modules
This commit is contained in:
40
web/src/utils/expenseAssistantActions.js
Normal file
40
web/src/utils/expenseAssistantActions.js
Normal file
@@ -0,0 +1,40 @@
|
||||
const EXPENSE_SCENE_SELECTION_OPTIONS = [
|
||||
{ key: 'travel', label: '差旅费', description: '出差行程、住宿、跨城交通等费用', icon: 'mdi mdi-bag-suitcase-outline' },
|
||||
{ key: 'transport', label: '交通费', description: '市内交通、打车、停车、通行等费用', icon: 'mdi mdi-car-outline' },
|
||||
{ key: 'hotel', label: '住宿费', description: '单独住宿或酒店发票报销', icon: 'mdi mdi-bed-outline' },
|
||||
{ key: 'entertainment', label: '业务招待费', description: '客户接待、餐饮招待等费用', icon: 'mdi mdi-food-fork-drink' },
|
||||
{ key: 'office', label: '办公费', description: '办公用品、低值易耗品等费用', icon: 'mdi mdi-briefcase-outline' },
|
||||
{ key: 'other', label: '其他费用', description: '暂不属于以上类型的费用', icon: 'mdi mdi-dots-horizontal-circle-outline' }
|
||||
]
|
||||
|
||||
const EXPENSE_INTENT_CONFIRMATION_ACTION = {
|
||||
label: '我要报销',
|
||||
description: '按报销流程继续,并选择具体费用场景',
|
||||
icon: 'mdi mdi-receipt-text-check-outline',
|
||||
action_type: 'confirm_expense_intent'
|
||||
}
|
||||
|
||||
export function buildExpenseSceneSelectionActions(rawText) {
|
||||
const originalMessage = String(rawText || '').trim()
|
||||
return EXPENSE_SCENE_SELECTION_OPTIONS.map((option) => ({
|
||||
label: option.label,
|
||||
description: option.description,
|
||||
icon: option.icon,
|
||||
action_type: 'select_expense_type',
|
||||
payload: {
|
||||
expense_type: option.key,
|
||||
expense_type_label: option.label,
|
||||
original_message: originalMessage
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
export function buildExpenseIntentConfirmationActions(rawText) {
|
||||
const originalMessage = String(rawText || '').trim()
|
||||
return [{
|
||||
...EXPENSE_INTENT_CONFIRMATION_ACTION,
|
||||
payload: {
|
||||
original_message: originalMessage
|
||||
}
|
||||
}]
|
||||
}
|
||||
@@ -6,7 +6,7 @@ const DEFAULT_INTENT_LABELS = {
|
||||
explain: '解释',
|
||||
compare: '对比',
|
||||
risk_check: '风险检查',
|
||||
draft: '草稿生成',
|
||||
draft: '信息核对',
|
||||
operate: '动作请求'
|
||||
}
|
||||
|
||||
|
||||
6
web/src/utils/suggestedActionKey.js
Normal file
6
web/src/utils/suggestedActionKey.js
Normal file
@@ -0,0 +1,6 @@
|
||||
export function buildSuggestedActionKey(action) {
|
||||
const actionType = String(action?.action_type || '').trim()
|
||||
const payload = action?.payload && typeof action.payload === 'object' ? action.payload : {}
|
||||
const payloadKey = String(payload.expense_type || payload.expense_type_label || action?.label || '').trim()
|
||||
return `${actionType}:${payloadKey}`
|
||||
}
|
||||
Reference in New Issue
Block a user