From d48875bd7a314684c858724e641246ce9423c084 Mon Sep 17 00:00:00 2001 From: 2910410219 <2910410219@qq.com> Date: Fri, 21 Aug 2026 20:09:20 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=B7=A5=E4=BD=9C=E7=A9=BA?= =?UTF-8?q?=E9=97=B4=E4=B8=8B=E8=BD=BD=EF=BC=9A=E5=AF=B9=E8=B1=A1=E5=90=8D?= =?UTF-8?q?=E4=BC=A0=E5=8F=82=E9=80=82=E9=85=8D=E5=90=8E=E7=AB=AF=E7=9B=B8?= =?UTF-8?q?=E5=AF=B9=E8=B7=AF=E5=BE=84=E3=80=81=E4=B8=8B=E8=BD=BD=E6=84=9F?= =?UTF-8?q?=E7=9F=A5=EF=BC=88toast+=E6=8C=89=E9=92=AE=E7=BA=A7=EF=BC=89?= =?UTF-8?q?=E3=80=815=E5=88=86=E9=92=9F=E8=B6=85=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - downloadAsset 重写:content 相对路径直接作下载参数,兼容历史完整 URL 去域名; blob 校验拒绝 JSON 错误体,避免生成坏文件;文件名带扩展名 - 下载感知:统一加下载中轻量 toast(旋转图标、不锁页面),工作空间按钮级 「下载中…」禁用;成功/失败替换为结果提示 - 新增 downloadWorkspaceFile(workflow 域独立 API):下载超时放宽到 5 分钟, 不动 creation 共享 downloadToFile Co-Authored-By: Claude --- src/api/settings/workflow/index.ts | 14 ++++++ src/views/home/components/Sidebar.vue | 20 ++++++++- src/views/home/index.vue | 63 ++++++++++++++++++--------- 3 files changed, 76 insertions(+), 21 deletions(-) diff --git a/src/api/settings/workflow/index.ts b/src/api/settings/workflow/index.ts index 2d48f0e..332e9ce 100644 --- a/src/api/settings/workflow/index.ts +++ b/src/api/settings/workflow/index.ts @@ -1,4 +1,5 @@ import request from '/@/utils/request'; +import type { RequestOptions } from '/@/utils/request'; // ===== 节点库(V2 结构,workflow 专用;creation 继续使用 creation/index.ts 的旧结构)===== export interface NodeLibraryPresetOption { @@ -134,3 +135,16 @@ export function getSubFlowWorkflowDetail(id: string) { params: { id }, }) as Promise<{ code: number; message: string; data: any }>; } + +// 工作空间文件下载(首页工作流/工作空间专用):与 creation 的 downloadToFile 同一后端接口, +// 但工作空间文件可能较大(视频/音频),下载超时放宽到 5 分钟;不改动 creation 共享 API 的超时 +export function downloadWorkspaceFile(data: { fileURL: string }, requestOptions?: RequestOptions) { + return request({ + url: '/oss/file/downloadToBrowser', + method: 'post', + data, + responseType: 'blob', + timeout: 5 * 60 * 1000, + requestOptions, + }); +} diff --git a/src/views/home/components/Sidebar.vue b/src/views/home/components/Sidebar.vue index 62f1f55..d4498e7 100644 --- a/src/views/home/components/Sidebar.vue +++ b/src/views/home/components/Sidebar.vue @@ -77,7 +77,13 @@ {{ fileNode.label }}
- +
@@ -120,6 +126,8 @@ interface Props { workspaceFailed?: boolean; // 工作空间是否已成功加载:懒加载成功后才不再触发;失败保持 false → 切回 tab 自动重试 workspaceLoaded?: boolean; + // 工作空间正在下载的文件 id:对应「下载」按钮显示下载中并禁用(按钮级感知,不影响其他功能) + downloadingFileId?: string | null; treeNodes: TreeNode[]; treeLoading: boolean; } @@ -144,6 +152,7 @@ const props = withDefaults(defineProps(), { historyLoadingMore: false, workspaceFailed: false, workspaceLoaded: false, + downloadingFileId: null, }); const emit = defineEmits(); @@ -498,6 +507,15 @@ const handleDeleteNode = (data: TreeNode) => emit('delete-node', data); background: #dbeafe; } + &:disabled { + opacity: 0.6; + cursor: not-allowed; + + &:hover { + background: transparent; + } + } + &--del { color: #ef4444; diff --git a/src/views/home/index.vue b/src/views/home/index.vue index 8353cd4..4792d74 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -11,6 +11,7 @@ :tree-loading="treeLoading" :workspace-failed="workspaceTreeFailed" :workspace-loaded="workspaceTreeLoaded" + :downloading-file-id="downloadingFileId" @menu-change="handleMenuChange" @new-chat="handleCreateHistory" @select-history="handleSelectHistory" @@ -91,8 +92,9 @@