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 @@