From 056d6dbe221f44179fc5661ec695f0d0596e1e61 Mon Sep 17 00:00:00 2001 From: caoxiaozhu Date: Thu, 14 May 2026 15:42:47 +0000 Subject: [PATCH] =?UTF-8?q?feat(web):=20=E6=96=B0=E5=A2=9E=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E7=BC=96=E6=8E=92=E5=99=A8=E5=92=8C=E6=8A=A5=E9=94=80?= =?UTF-8?q?=E5=8D=95=E6=9C=8D=E5=8A=A1=E6=A8=A1=E5=9D=97=EF=BC=8C=E5=B0=81?= =?UTF-8?q?=E8=A3=85=E5=AF=B9=E5=BA=94=E7=9A=84API=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/services/orchestrator.js | 5 ++++- web/src/services/reimbursements.js | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/web/src/services/orchestrator.js b/web/src/services/orchestrator.js index 2dd6733..3d40d49 100644 --- a/web/src/services/orchestrator.js +++ b/web/src/services/orchestrator.js @@ -7,13 +7,16 @@ export function runOrchestrator(payload) { }) } -export function fetchLatestConversation(userId, sessionType = '') { +export function fetchLatestConversation(userId, sessionType = '', options = {}) { const params = new URLSearchParams({ user_id: String(userId || '').trim() }) if (String(sessionType || '').trim()) { params.set('session_type', String(sessionType || '').trim()) } + if (options.preferRecoverable) { + params.set('prefer_recoverable', 'true') + } return apiRequest(`/orchestrator/conversations/latest?${params.toString()}`) } diff --git a/web/src/services/reimbursements.js b/web/src/services/reimbursements.js index daf4de3..a82143d 100644 --- a/web/src/services/reimbursements.js +++ b/web/src/services/reimbursements.js @@ -36,12 +36,37 @@ export function fetchExpenseClaimItemAttachmentMeta(claimId, itemId) { return apiRequest(`/reimbursements/claims/${encodeURIComponent(String(claimId || '').trim())}/items/${encodeURIComponent(String(itemId || '').trim())}/attachment/meta`) } +export function fetchExpenseClaimItemAttachmentPreview(claimId, itemId) { + return apiRequest(`/reimbursements/claims/${encodeURIComponent(String(claimId || '').trim())}/items/${encodeURIComponent(String(itemId || '').trim())}/attachment/preview`, { + responseType: 'blob' + }) +} + export function fetchExpenseClaimItemAttachment(claimId, itemId) { return apiRequest(`/reimbursements/claims/${encodeURIComponent(String(claimId || '').trim())}/items/${encodeURIComponent(String(itemId || '').trim())}/attachment`, { responseType: 'blob' }) } +export async function fetchExpenseClaimAttachmentAsset(pathOrUrl) { + const target = String(pathOrUrl || '').trim() + if (!target) { + throw new Error('预览地址为空。') + } + + if (/^https?:\/\//i.test(target)) { + const response = await fetch(target) + if (!response.ok) { + throw new Error(`预览加载失败(${response.status})。`) + } + return response.blob() + } + + return apiRequest(target, { + responseType: 'blob' + }) +} + export function deleteExpenseClaimItemAttachment(claimId, itemId) { return apiRequest(`/reimbursements/claims/${encodeURIComponent(String(claimId || '').trim())}/items/${encodeURIComponent(String(itemId || '').trim())}/attachment`, { method: 'DELETE'