JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.
Python
fix:修复历史会话下载文件url错误
strLights_a087e6a2bf1c
diff --git a/jiuwenswarm/channels/web/frontend/src/components/ChatPanel/MessageItem.tsx b/jiuwenswarm/channels/web/frontend/src/components/ChatPanel/MessageItem.tsxindex 1107c2e610..4eb8696e71 100644--- a/jiuwenswarm/channels/web/frontend/src/components/ChatPanel/MessageItem.tsx+++ b/jiuwenswarm/channels/web/frontend/src/components/ChatPanel/MessageItem.tsx@@ -785,7 +785,15 @@ function FileDownloadList({}) {const { t } = useTranslation();const [expiredSet, setExpiredSet] = useState<Set<number>>(new Set());- const fileDownloadUrl = (file: FileDownloadItem): string | undefined => file.download_url || file.url;++ const fileDownloadUrl = (file: FileDownloadItem): string | undefined => {+ if (file.download_url) return file.download_url;+ if (file.url) {+ return `/file-api/download?url=${encodeURIComponent(file.url)}&name=${encodeURIComponent(file.name || 'download')}`;+ }+ return undefined;+ };+const downloadProbeKey = files.map((file) => fileDownloadUrl(file) ?? '').join('\0');useEffect(() => {diff --git a/jiuwenswarm/channels/web/frontend/src/features/teamHistoryPanelRestore.ts b/jiuwenswarm/channels/web/frontend/src/features/teamHistoryPanelRestore.tsindex aba5587ecf..5f7277957b 100644--- a/jiuwenswarm/channels/web/frontend/src/features/teamHistoryPanelRestore.ts+++ b/jiuwenswarm/channels/web/frontend/src/features/teamHistoryPanelRestore.ts@@ -608,7 +608,8 @@ function collectTeamState(records: Record<string, unknown>[], sessionId: string)name: pickString(file, ['name']) || 'file',size: typeof file.size === 'number' ? file.size : undefined,mime_type: pickString(file, ['mime_type']) || undefined,- download_url: pickString(file, ['download_url', 'url']) || undefined,+ download_url: pickString(file, ['download_url']) || undefined,+ url: pickString(file, ['url']) || undefined,path: pickString(file, ['path']) || undefined,})): [];