feat: 完善文档中心与报销申请交互及侧边栏重构

后端优化编排器报销查询和本体检测精度,增强报销单草稿保
存和附件回填逻辑,前端重构侧边栏组件支持折叠和图标导
航,完善文档中心状态筛选和详情提示,报销创建和审批详情
页优化会话管理和费用明细交互,新增助手应用服务和预设动
作工具函数,补充单元测试覆盖。
This commit is contained in:
caoxiaozhu
2026-05-25 13:35:39 +08:00
parent 50b1c3f9a9
commit d0e946cf47
59 changed files with 5117 additions and 416 deletions

View 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}`
}