From 2ae47a041a78c7c6da89d6469e629d87ec656301 Mon Sep 17 00:00:00 2001 From: jingrow Date: Mon, 3 Nov 2025 02:08:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=8A=82=E7=82=B9=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E9=A1=B5=E4=B8=80=E9=94=AE=E5=8F=91=E5=B8=83=E5=88=B0?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E5=B8=82=E5=9C=BA=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/jingrow/frontend/src/shared/api/nodes.ts | 24 +- .../local_ai_node/PublishProgressModal.vue | 208 ++++++++++++++++++ .../local_ai_node/local_ai_node_toolbar.vue | 104 +++++++-- apps/jingrow/jingrow/api/node_management.py | 14 +- 4 files changed, 320 insertions(+), 30 deletions(-) create mode 100644 apps/jingrow/frontend/src/views/pagetype/local_ai_node/PublishProgressModal.vue diff --git a/apps/jingrow/frontend/src/shared/api/nodes.ts b/apps/jingrow/frontend/src/shared/api/nodes.ts index cf1a86b..5de10ce 100644 --- a/apps/jingrow/frontend/src/shared/api/nodes.ts +++ b/apps/jingrow/frontend/src/shared/api/nodes.ts @@ -150,7 +150,7 @@ export const importLocalNodes = async (): Promise<{ success: boolean; matched: n } // 打包节点为zip文件 -export const packageNode = async (nodeType: string): Promise => { +export const packageNode = async (nodeType: string): Promise<{ blob: Blob; filename: string }> => { try { const response = await axios.post( `/jingrow/node/package/${encodeURIComponent(nodeType)}`, @@ -161,7 +161,27 @@ export const packageNode = async (nodeType: string): Promise => { responseType: 'blob' } ) - return response.data + + // 从 Content-Disposition header 中提取文件名 + let filename = `${nodeType}.zip` + const contentDisposition = response.headers['content-disposition'] + if (contentDisposition) { + const filenameMatch = contentDisposition.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/) + if (filenameMatch && filenameMatch[1]) { + filename = filenameMatch[1].replace(/['"]/g, '') + // 处理 URL 编码的文件名 + try { + filename = decodeURIComponent(filename) + } catch { + // 如果解码失败,使用原始值 + } + } + } + + return { + blob: response.data, + filename + } } catch (error) { console.error('打包节点失败:', error) throw error diff --git a/apps/jingrow/frontend/src/views/pagetype/local_ai_node/PublishProgressModal.vue b/apps/jingrow/frontend/src/views/pagetype/local_ai_node/PublishProgressModal.vue new file mode 100644 index 0000000..2d21f32 --- /dev/null +++ b/apps/jingrow/frontend/src/views/pagetype/local_ai_node/PublishProgressModal.vue @@ -0,0 +1,208 @@ + + + + + + diff --git a/apps/jingrow/frontend/src/views/pagetype/local_ai_node/local_ai_node_toolbar.vue b/apps/jingrow/frontend/src/views/pagetype/local_ai_node/local_ai_node_toolbar.vue index 80bdf22..8d088d1 100644 --- a/apps/jingrow/frontend/src/views/pagetype/local_ai_node/local_ai_node_toolbar.vue +++ b/apps/jingrow/frontend/src/views/pagetype/local_ai_node/local_ai_node_toolbar.vue @@ -88,6 +88,15 @@ @close="showSchemaEditor = false" /> + + +