Add files via upload

This commit is contained in:
公明
2026-05-22 10:30:19 +08:00
committed by GitHub
parent 9b82f265fd
commit 0358d3a67d
5 changed files with 99 additions and 20 deletions
+58 -1
View File
@@ -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 {
+1
View File
@@ -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",
+1
View File
@@ -1520,6 +1520,7 @@
"confirmDelete": "确定删除该文件?",
"editTitle": "编辑文件",
"renameTitle": "重命名",
"renameCurrentFile": "当前文件",
"newFileName": "新文件名",
"empty": "暂无对话附件",
"errorLoad": "加载失败",
+15 -4
View File
@@ -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);
}
+24 -15
View File
@@ -2998,30 +2998,39 @@
</div>
</div>
<div id="chat-files-rename-modal" class="modal">
<div class="modal-content" style="max-width: 480px;">
<div class="modal-header">
<div id="chat-files-rename-modal" class="modal chat-files-form-modal">
<div class="modal-content chat-files-form-modal-content chat-files-mkdir-modal-content">
<div class="modal-header chat-files-form-modal-header">
<h2 data-i18n="chatFilesPage.renameTitle">重命名</h2>
<span class="modal-close" onclick="closeChatFilesRenameModal()">&times;</span>
<span class="modal-close chat-files-form-modal-close" onclick="closeChatFilesRenameModal()" aria-label="Close">&times;</span>
</div>
<div class="modal-body">
<label class="chat-files-rename-label">
<span data-i18n="chatFilesPage.newFileName">文件</span>
<input type="text" id="chat-files-rename-input" class="form-control" />
<div class="modal-body chat-files-mkdir-body">
<div class="chat-files-mkdir-location">
<div class="chat-files-mkdir-location-caption" data-i18n="chatFilesPage.renameCurrentFile">当前文件</div>
<div class="chat-files-mkdir-path-box">
<code class="chat-files-mkdir-path" id="chat-files-rename-path-hint"></code>
</div>
</div>
<label class="chat-files-rename-label chat-files-mkdir-label">
<span class="chat-files-mkdir-field-name">
<svg class="chat-files-mkdir-field-icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/></svg>
<span data-i18n="chatFilesPage.newFileName">新文件名</span>
</span>
<input type="text" id="chat-files-rename-input" class="form-control chat-files-mkdir-input" autocomplete="off" />
</label>
</div>
<div class="modal-footer">
<button type="button" class="btn-secondary" onclick="closeChatFilesRenameModal()" data-i18n="common.cancel">取消</button>
<button type="button" class="btn-primary" onclick="submitChatFilesRename()" data-i18n="common.ok">确定</button>
<div class="modal-footer chat-files-mkdir-footer">
<button type="button" class="btn-secondary chat-files-mkdir-btn-cancel" onclick="closeChatFilesRenameModal()" data-i18n="common.cancel">取消</button>
<button type="button" class="btn-primary chat-files-mkdir-btn-submit" onclick="submitChatFilesRename()" data-i18n="common.ok">确定</button>
</div>
</div>
</div>
<div id="chat-files-mkdir-modal" class="modal">
<div class="modal-content chat-files-mkdir-modal-content">
<div class="modal-header">
<div id="chat-files-mkdir-modal" class="modal chat-files-form-modal">
<div class="modal-content chat-files-form-modal-content chat-files-mkdir-modal-content">
<div class="modal-header chat-files-form-modal-header">
<h2 data-i18n="chatFilesPage.newFolderTitle">新建文件夹</h2>
<span class="modal-close" onclick="closeChatFilesMkdirModal()">&times;</span>
<span class="modal-close chat-files-form-modal-close" onclick="closeChatFilesMkdirModal()" aria-label="Close">&times;</span>
</div>
<div class="modal-body chat-files-mkdir-body">
<div class="chat-files-mkdir-location" aria-live="polite">