feat: 完善文档中心与报销申请交互及侧边栏重构
后端优化编排器报销查询和本体检测精度,增强报销单草稿保 存和附件回填逻辑,前端重构侧边栏组件支持折叠和图标导 航,完善文档中心状态筛选和详情提示,报销创建和审批详情 页优化会话管理和费用明细交互,新增助手应用服务和预设动 作工具函数,补充单元测试覆盖。
This commit is contained in:
46
web/src/utils/assistantSuggestedActionPrefill.js
Normal file
46
web/src/utils/assistantSuggestedActionPrefill.js
Normal file
@@ -0,0 +1,46 @@
|
||||
const APPLICATION_FIELD_PREFILLS = {
|
||||
time: '申请时间段:',
|
||||
time_range: '申请时间段:',
|
||||
location: '地点:',
|
||||
reason: '事由:',
|
||||
days: '天数:',
|
||||
transport_mode: '出行方式:',
|
||||
amount: '预计总费用:'
|
||||
}
|
||||
|
||||
export function resolveSuggestedActionPrefill(action = {}) {
|
||||
const payload = action?.payload && typeof action.payload === 'object' ? action.payload : {}
|
||||
const explicitPrefill = String(
|
||||
payload.prompt_prefill
|
||||
|| payload.input_prefill
|
||||
|| payload.prefill_text
|
||||
|| ''
|
||||
).trim()
|
||||
if (explicitPrefill) {
|
||||
return explicitPrefill
|
||||
}
|
||||
|
||||
const actionType = String(action?.action_type || '').trim()
|
||||
if (actionType !== 'prefill_composer') {
|
||||
return ''
|
||||
}
|
||||
|
||||
const applicationField = String(payload.application_field || '').trim()
|
||||
return APPLICATION_FIELD_PREFILLS[applicationField] || ''
|
||||
}
|
||||
|
||||
export function mergeComposerPrefill(currentDraft = '', prefill = '') {
|
||||
const normalizedPrefill = String(prefill || '').trim()
|
||||
if (!normalizedPrefill) {
|
||||
return String(currentDraft || '')
|
||||
}
|
||||
|
||||
const current = String(currentDraft || '')
|
||||
if (!current.trim()) {
|
||||
return normalizedPrefill
|
||||
}
|
||||
if (current.includes(normalizedPrefill)) {
|
||||
return current
|
||||
}
|
||||
return `${current.trimEnd()}\n${normalizedPrefill}`
|
||||
}
|
||||
Reference in New Issue
Block a user