From bd863f6d381f89623328b9c0e23c00b99eef3aa1 Mon Sep 17 00:00:00 2001 From: JOJO <1498581755@qq.com> Date: Fri, 13 Mar 2026 11:40:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E5=9B=BE=E7=89=87/?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E4=B8=8A=E4=BC=A0=E5=92=8C=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 支持从本地一次选择多个文件上传 - 图片选择器上传完成后自动关闭 - 输入框和用户消息块显示缩略图(60x60px)而非文件名 - 输入框缩略图悬停时显示删除按钮(右上角 × 符号) - 统一图片/视频预览样式,提升用户体验 Co-Authored-By: Claude Sonnet 4.5 --- static/src/app/methods/upload.ts | 2 + static/src/components/chat/ChatArea.vue | 13 +++- static/src/components/input/InputComposer.vue | 68 +++++++++++++++---- .../styles/components/chat/_chat-area.scss | 19 ++++-- 4 files changed, 83 insertions(+), 19 deletions(-) diff --git a/static/src/app/methods/upload.ts b/static/src/app/methods/upload.ts index 54e329e..897f62d 100644 --- a/static/src/app/methods/upload.ts +++ b/static/src/app/methods/upload.ts @@ -125,6 +125,8 @@ export const uploadMethods = { this.inputAddSelectedImage(item.path); this.upsertImageEntry(item.path, item.filename); }); + // 上传完成后自动关闭选择窗口 + this.closeImagePicker(); }, async handleLocalVideoFiles(files) { diff --git a/static/src/components/chat/ChatArea.vue b/static/src/components/chat/ChatArea.vue index cb95b6d..e4bfd3a 100644 --- a/static/src/components/chat/ChatArea.vue +++ b/static/src/components/chat/ChatArea.vue @@ -10,10 +10,14 @@
{{ msg.content }}
- {{ formatImageName(img) }} +
+ +
- {{ formatImageName(video) }} +
+ +
@@ -430,6 +434,11 @@ function formatImageName(path: string): string { return parts[parts.length - 1] || path; } +function getPreviewUrl(path: string): string { + if (!path) return ''; + return `/api/gui/files/download?path=${encodeURIComponent(path)}`; +} + const isStackable = (action: any) => action && (action.type === 'thinking' || action.type === 'tool'); const isEmptyTextAction = (action: any) => { if (!action || action.type !== 'text') { diff --git a/static/src/components/input/InputComposer.vue b/static/src/components/input/InputComposer.vue index d2a0981..4d047b4 100644 --- a/static/src/components/input/InputComposer.vue +++ b/static/src/components/input/InputComposer.vue @@ -10,19 +10,19 @@ 'has-text': (inputMessage || '').trim().length > 0 }" > - +
- - {{ formatImageName(img) }} - - +
+ + +
- - {{ formatImageName(video) }} - - +
+ + +