From a20df89ee754aea73be88fb8a8ecd2226b59d855 Mon Sep 17 00:00:00 2001 From: 2977094657 <2977094657@qq.com> Date: Mon, 9 Feb 2026 00:15:47 +0800 Subject: [PATCH] =?UTF-8?q?improvement(chat):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E7=AD=9B=E9=80=89=E4=B8=8E=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- desktop/src/main.cjs | 19 + desktop/src/preload.cjs | 2 + frontend/assets/css/tailwind.css | 20 +- frontend/pages/chat/[[username]].vue | 941 ++++++++++++------ .../chat_export_service.py | 150 +-- .../routers/chat_export.py | 8 +- ...est_chat_export_message_types_semantics.py | 418 ++++++++ 7 files changed, 1203 insertions(+), 355 deletions(-) create mode 100644 tests/test_chat_export_message_types_semantics.py diff --git a/desktop/src/main.cjs b/desktop/src/main.cjs index a2321bc..25524c6 100644 --- a/desktop/src/main.cjs +++ b/desktop/src/main.cjs @@ -611,6 +611,25 @@ function registerWindowIpc() { return getCloseBehavior(); } }); + + ipcMain.handle("dialog:chooseDirectory", async (_event, options) => { + try { + const result = await dialog.showOpenDialog({ + title: String(options?.title || "选择文件夹"), + properties: ["openDirectory", "createDirectory"], + }); + return { + canceled: !!result?.canceled, + filePaths: Array.isArray(result?.filePaths) ? result.filePaths : [], + }; + } catch (err) { + logMain(`[main] dialog:chooseDirectory failed: ${err?.message || err}`); + return { + canceled: true, + filePaths: [], + }; + } + }); } async function main() { diff --git a/desktop/src/preload.cjs b/desktop/src/preload.cjs index 1f1eea2..f40b33d 100644 --- a/desktop/src/preload.cjs +++ b/desktop/src/preload.cjs @@ -11,4 +11,6 @@ contextBridge.exposeInMainWorld("wechatDesktop", { getCloseBehavior: () => ipcRenderer.invoke("app:getCloseBehavior"), setCloseBehavior: (behavior) => ipcRenderer.invoke("app:setCloseBehavior", String(behavior || "")), + + chooseDirectory: (options = {}) => ipcRenderer.invoke("dialog:chooseDirectory", options), }); diff --git a/frontend/assets/css/tailwind.css b/frontend/assets/css/tailwind.css index 96d1bc2..3bce7b4 100644 --- a/frontend/assets/css/tailwind.css +++ b/frontend/assets/css/tailwind.css @@ -730,35 +730,39 @@ } .header-btn { - @apply flex items-center gap-1.5 text-xs px-3 py-1.5 rounded-lg bg-white border border-gray-200 text-gray-700 transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed; + @apply flex items-center gap-1.5 text-xs px-3 py-1.5 rounded-md bg-white border border-gray-200 text-gray-700 transition-all duration-150 disabled:opacity-50 disabled:cursor-not-allowed shadow-sm; } .header-btn:hover:not(:disabled) { - @apply bg-gray-50 border-gray-300; + @apply bg-gray-50 border-gray-300 shadow; } .header-btn:active:not(:disabled) { - @apply bg-gray-100; + @apply bg-gray-100 scale-95; + } + + .header-btn svg { + @apply w-3.5 h-3.5; } .header-btn-icon { - @apply w-8 h-8 flex items-center justify-center rounded-lg bg-white border border-gray-200 text-gray-600 transition-all duration-200; + @apply w-8 h-8 flex items-center justify-center rounded-lg bg-transparent border border-transparent text-gray-600 transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed; } .header-btn-icon:hover { - @apply bg-gray-50 border-gray-300 text-gray-800; + @apply bg-transparent border-transparent text-gray-800; } .header-btn-icon-active { - @apply bg-[#03C160]/10 border-[#03C160] text-[#03C160]; + @apply bg-transparent border-transparent text-[#03C160]; } .header-btn-icon-active:hover { - @apply bg-[#03C160]/15; + @apply bg-transparent; } .message-filter-select { - @apply text-xs px-2 py-1.5 rounded-lg bg-white border border-gray-200 text-gray-700 focus:outline-none focus:ring-2 focus:ring-[#03C160]/20 focus:border-[#03C160] transition-all disabled:opacity-50 disabled:cursor-not-allowed; + @apply text-xs px-2 py-1.5 rounded-lg bg-transparent border-0 text-gray-700 focus:outline-none focus:ring-0 transition-all disabled:opacity-50 disabled:cursor-not-allowed; } /* 搜索侧边栏样式 */ diff --git a/frontend/pages/chat/[[username]].vue b/frontend/pages/chat/[[username]].vue index 3bda422..03bf0de 100644 --- a/frontend/pages/chat/[[username]].vue +++ b/frontend/pages/chat/[[username]].vue @@ -60,6 +60,26 @@ + +
+
+
+ +
+
+
+ + + +
+
+ +
+
-
+
@@ -199,7 +237,7 @@