feat(web): AI 工作台文件预览/附件关联任务与草稿分支
- 新增 WorkbenchAiFilePreviewDialog 附件预览对话框及 useWorkbenchAiFilePreview,附件支持点击预览 - 新增 attachmentAssociationJobs/linkedReimbursementDraftJobs 前端服务与对应 composable,接入后台任务轮询与状态展示 - 新增 travelReimbursementDraftBranchModel 草稿分支模型,报销关联门控支持跳过/选择草稿 - PersonalWorkbenchAiMode 及各 composable(expense/document/steward/application-preview/attachment-association)重构适配,WorkbenchAiComposer/FileStrip 样式与交互完善 - DocumentsCenter/ReceiptFolder/TravelReimbursementCreate 等视图及 scripts 重构,风险/差旅规划/审批等工具适配 - 新增/更新前端测试:application-result-card、reimbursement-list-preview-fetch、guided-flow、composer-components 等
This commit is contained in:
@@ -151,6 +151,8 @@ export function createWorkbenchAiMessageRuntime() {
|
||||
: suggestedActions,
|
||||
applicationPreview: options.applicationPreview || null,
|
||||
draftPayload: options.draftPayload || null,
|
||||
attachmentAssociationJob: normalizeInlineAttachmentAssociationJob(options.attachmentAssociationJob || null),
|
||||
linkedReimbursementDraftJob: normalizeInlineLinkedReimbursementDraftJob(options.linkedReimbursementDraftJob || null),
|
||||
attachmentOcrDetails: normalizeInlineAttachmentOcrDetails(options.attachmentOcrDetails || null),
|
||||
text: options.text || normalizedContent,
|
||||
createdAt: options.createdAt || Date.now()
|
||||
@@ -166,6 +168,8 @@ export function createWorkbenchAiMessageRuntime() {
|
||||
suggestedActions: Array.isArray(message.suggestedActions) ? message.suggestedActions : [],
|
||||
applicationPreview: message.applicationPreview || null,
|
||||
draftPayload: message.draftPayload || null,
|
||||
attachmentAssociationJob: message.attachmentAssociationJob || null,
|
||||
linkedReimbursementDraftJob: message.linkedReimbursementDraftJob || null,
|
||||
attachmentOcrDetails: message.attachmentOcrDetails || null,
|
||||
text: message.text || message.content || ''
|
||||
})
|
||||
@@ -182,6 +186,8 @@ export function createWorkbenchAiMessageRuntime() {
|
||||
suggestedActions: Array.isArray(message.suggestedActions) ? message.suggestedActions : [],
|
||||
applicationPreview: message.applicationPreview || null,
|
||||
draftPayload: message.draftPayload || null,
|
||||
attachmentAssociationJob: normalizeInlineAttachmentAssociationJob(message.attachmentAssociationJob || null),
|
||||
linkedReimbursementDraftJob: normalizeInlineLinkedReimbursementDraftJob(message.linkedReimbursementDraftJob || null),
|
||||
attachmentOcrDetails: message.attachmentOcrDetails || null
|
||||
}
|
||||
}
|
||||
@@ -193,3 +199,52 @@ export function createWorkbenchAiMessageRuntime() {
|
||||
serializeRuntimeMessage
|
||||
}
|
||||
}
|
||||
|
||||
export function normalizeInlineAttachmentAssociationJob(job = null) {
|
||||
if (!job || typeof job !== 'object') {
|
||||
return null
|
||||
}
|
||||
const jobId = String(job.jobId || job.job_id || '').trim()
|
||||
if (!jobId) {
|
||||
return null
|
||||
}
|
||||
const status = String(job.status || 'queued').trim() || 'queued'
|
||||
const receiptIds = (Array.isArray(job.receiptIds) ? job.receiptIds : job.receipt_ids || [])
|
||||
.map((item) => String(item || '').trim())
|
||||
.filter(Boolean)
|
||||
return {
|
||||
jobId,
|
||||
status,
|
||||
message: String(job.message || '').trim(),
|
||||
receiptIds,
|
||||
claimId: String(job.claimId || job.claim_id || '').trim(),
|
||||
claimNo: String(job.claimNo || job.claim_no || '').trim(),
|
||||
uploadedCount: Number(job.uploadedCount ?? job.uploaded_count ?? 0) || 0,
|
||||
skippedCount: Number(job.skippedCount ?? job.skipped_count ?? 0) || 0,
|
||||
error: String(job.error || '').trim()
|
||||
}
|
||||
}
|
||||
|
||||
export function normalizeInlineLinkedReimbursementDraftJob(job = null) {
|
||||
if (!job || typeof job !== 'object') {
|
||||
return null
|
||||
}
|
||||
const jobId = String(job.jobId || job.job_id || '').trim()
|
||||
if (!jobId) {
|
||||
return null
|
||||
}
|
||||
const draftPayload = job.draftPayload && typeof job.draftPayload === 'object'
|
||||
? job.draftPayload
|
||||
: job.draft_payload && typeof job.draft_payload === 'object'
|
||||
? job.draft_payload
|
||||
: null
|
||||
return {
|
||||
jobId,
|
||||
status: String(job.status || 'queued').trim() || 'queued',
|
||||
message: String(job.message || '').trim(),
|
||||
error: String(job.error || '').trim(),
|
||||
runId: String(job.runId || job.run_id || '').trim(),
|
||||
applicationClaimNo: String(job.applicationClaimNo || job.application_claim_no || '').trim(),
|
||||
draftPayload
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user