From 0358d3a67d16ca12f4af3efdde91c94321eadaf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=AC=E6=98=8E?= <83812544+Ed1s0nZ@users.noreply.github.com> Date: Fri, 22 May 2026 10:30:19 +0800 Subject: [PATCH] Add files via upload --- web/static/css/style.css | 59 ++++++++++++++++++++++++++++++++++++- web/static/i18n/en-US.json | 1 + web/static/i18n/zh-CN.json | 1 + web/static/js/chat-files.js | 19 +++++++++--- web/templates/index.html | 39 ++++++++++++++---------- 5 files changed, 99 insertions(+), 20 deletions(-) diff --git a/web/static/css/style.css b/web/static/css/style.css index ef5decad..a0594302 100644 --- a/web/static/css/style.css +++ b/web/static/css/style.css @@ -20223,9 +20223,66 @@ button.chat-files-dropdown-item:hover:not(:disabled) { width: 100%; } +/* 文件管理:重命名 / 新建文件夹 — 紧凑表单弹窗,无全局紫色标题条 */ +.chat-files-form-modal { + align-items: center; + justify-content: center; + padding: 24px 16px; +} + +.chat-files-form-modal-content { + width: 100%; + max-width: 420px; + margin: 0; + border-radius: 12px; + box-shadow: + 0 16px 48px rgba(15, 23, 42, 0.14), + 0 4px 12px rgba(15, 23, 42, 0.06); +} + +.chat-files-form-modal-header { + padding: 18px 24px !important; + border-bottom: 1px solid var(--border-color) !important; + background: var(--bg-primary) !important; +} + +.chat-files-form-modal-header::after { + display: none !important; +} + +.chat-files-form-modal-header h2 { + font-size: 1.0625rem !important; + font-weight: 600 !important; + color: var(--text-primary) !important; + background: none !important; + -webkit-background-clip: unset !important; + -webkit-text-fill-color: var(--text-primary) !important; + background-clip: unset !important; + letter-spacing: -0.02em !important; +} + +.chat-files-form-modal-header h2::before { + display: none !important; +} + +.chat-files-form-modal-close { + width: 32px !important; + height: 32px !important; + font-size: 1.25rem !important; + border-radius: 8px !important; + border: none !important; +} + +.chat-files-form-modal-close:hover { + background: var(--bg-secondary) !important; + color: var(--text-primary) !important; + transform: none !important; + border-color: transparent !important; +} + /* 新建文件夹弹窗:层次清晰、留白舒适,无强装饰 */ .chat-files-mkdir-modal-content { - max-width: 480px; + max-width: 420px; } .chat-files-mkdir-body { diff --git a/web/static/i18n/en-US.json b/web/static/i18n/en-US.json index 4b92fc12..871a96dc 100644 --- a/web/static/i18n/en-US.json +++ b/web/static/i18n/en-US.json @@ -1531,6 +1531,7 @@ "confirmDelete": "Delete this file?", "editTitle": "Edit file", "renameTitle": "Rename", + "renameCurrentFile": "Current file", "newFileName": "New file name", "empty": "No chat uploads yet", "errorLoad": "Failed to load", diff --git a/web/static/i18n/zh-CN.json b/web/static/i18n/zh-CN.json index d6910e8b..2c00e1bb 100644 --- a/web/static/i18n/zh-CN.json +++ b/web/static/i18n/zh-CN.json @@ -1520,6 +1520,7 @@ "confirmDelete": "确定删除该文件?", "editTitle": "编辑文件", "renameTitle": "重命名", + "renameCurrentFile": "当前文件", "newFileName": "新文件名", "empty": "暂无对话附件", "errorLoad": "加载失败", diff --git a/web/static/js/chat-files.js b/web/static/js/chat-files.js index 27bfbb3d..1c843733 100644 --- a/web/static/js/chat-files.js +++ b/web/static/js/chat-files.js @@ -1052,15 +1052,26 @@ async function saveChatFilesEdit() { function openChatFilesRename(relativePath, currentName) { chatFilesRenameRelativePath = relativePath; const input = document.getElementById('chat-files-rename-input'); + const hint = document.getElementById('chat-files-rename-path-hint'); const modal = document.getElementById('chat-files-rename-modal'); - if (input) input.value = currentName || ''; - if (modal) modal.style.display = 'block'; - setTimeout(() => { if (input) input.focus(); }, 100); + const pathText = relativePath ? ('chat_uploads/' + String(relativePath).replace(/\\/g, '/')) : 'chat_uploads'; + if (hint) hint.textContent = pathText; + if (input) { + input.value = currentName || ''; + input.select(); + } + if (modal) modal.style.display = 'flex'; + if (modal && typeof window.applyTranslations === 'function') { + window.applyTranslations(modal); + } + setTimeout(() => { if (input) { input.focus(); input.select(); } }, 100); } function closeChatFilesRenameModal() { const modal = document.getElementById('chat-files-rename-modal'); if (modal) modal.style.display = 'none'; + const hint = document.getElementById('chat-files-rename-path-hint'); + if (hint) hint.textContent = ''; chatFilesRenameRelativePath = ''; } @@ -1095,7 +1106,7 @@ function openChatFilesMkdirModal() { const p = chatFilesBrowsePath.join('/'); if (hint) hint.textContent = p ? ('chat_uploads/' + p) : 'chat_uploads'; if (input) input.value = ''; - if (modal) modal.style.display = 'block'; + if (modal) modal.style.display = 'flex'; if (modal && typeof window.applyTranslations === 'function') { window.applyTranslations(modal); } diff --git a/web/templates/index.html b/web/templates/index.html index 5b65e8fb..6d94bc83 100644 --- a/web/templates/index.html +++ b/web/templates/index.html @@ -2998,30 +2998,39 @@ -