From b732913cab9b78ce5dbfe47588974dae6b65ca45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B2=E9=B8=BF=E5=AE=87?= Date: Mon, 14 Apr 2025 18:41:47 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix:=20=E5=9C=A8macOS=E4=B8=8A=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=BA=94=E7=94=A8=E6=BF=80=E6=B4=BB=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E7=A1=AE=E4=BF=9D=E7=AA=97=E5=8F=A3=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=92=8C=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 史鸿宇 --- electron/main/index.ts | 13 +++++++++---- electron/main/window/create.ts | 7 ------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/electron/main/index.ts b/electron/main/index.ts index 9d5ae3a..0a59a44 100644 --- a/electron/main/index.ts +++ b/electron/main/index.ts @@ -51,7 +51,7 @@ app.on('window-all-closed', () => { } }); -// 在macOS上,当应用图标被点击时重置退出标志 +// 在macOS上,当应用图标被点击时重置退出标志和显示主窗口 app.on('activate', () => { isQuitting = false; }); @@ -84,16 +84,21 @@ async function startup() { win = createDefaultWindow(); chatWindow = createChatWindow(); + app.on('activate', () => { + isQuitting = false; if (BrowserWindow.getAllWindows().length === 0) { + // 如果没有窗口,则创建新窗口 win = createDefaultWindow(); chatWindow = createChatWindow(); + } else { + // 如果窗口存在但被隐藏,则显示主窗口 + if (win && !win.isDestroyed()) { + win.show(); + } } }); - tray.on('click', () => { - win.show(); - }); win.on('close', (event) => { // 如果应用正在退出(例如通过Cmd+Q触发),则允许窗口正常关闭 if (isQuitting) { diff --git a/electron/main/window/create.ts b/electron/main/window/create.ts index 3400e99..5b43d7d 100644 --- a/electron/main/window/create.ts +++ b/electron/main/window/create.ts @@ -63,13 +63,6 @@ function setupWindowControls(win: BrowserWindow) { win.webContents.send('window-maximized-change', false); } }); - - // 添加关闭前确认 - win.on('close', (e) => { - if (win === defaultWindow) { - // 可以在这里添加关闭确认逻辑 - } - }); } let defaultWindow: BrowserWindow | null = null; -- Gitee From d8eecd44d008bbbf55fa613cbf52ae8195cef84b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B2=E9=B8=BF=E5=AE=87?= Date: Mon, 14 Apr 2025 19:01:37 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix(electron):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=85=A8=E5=B1=80=E5=BF=AB=E6=8D=B7=E9=94=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 史鸿宇 --- electron/main/index.ts | 86 +++++++++++++++++++++++++++++++++- electron/main/window/create.ts | 7 +-- 2 files changed, 86 insertions(+), 7 deletions(-) diff --git a/electron/main/index.ts b/electron/main/index.ts index 0a59a44..38dd254 100644 --- a/electron/main/index.ts +++ b/electron/main/index.ts @@ -12,8 +12,9 @@ import { globalShortcut, nativeTheme, BrowserWindow, + dialog, } from 'electron'; -import { createDefaultWindow, createTray, createChatWindow } from './window'; +import { createDefaultWindow, createChatWindow, createTray } from './window'; import type { INLSConfiguration } from './common/nls'; import { cachePath, commonCacheConfPath, updateConf } from './common/conf'; @@ -28,9 +29,71 @@ const osLocale = processZhLocale( (app.getPreferredSystemLanguages()?.[0] ?? 'en').toLowerCase(), ); +// 定义全局快捷键 +const CHAT_SHORTCUT_KEY = + process.platform === 'darwin' ? 'Cmd+Option+O' : 'Ctrl+Alt+O'; + // 添加表示应用是否正在退出的标志位 let isQuitting = false; +// 添加是否已注册快捷键的标志 +let isShortcutRegistered = false; + +// 在macOS上,检查是否已经获得辅助功能权限 +function checkAccessibilityPermission(): boolean { + if (process.platform !== 'darwin') return true; + + try { + return app.isAccessibilitySupportEnabled(); + } catch (err) { + console.error('Failed to check accessibility permission:', err); + return false; + } +} + +// 注册全局快捷键 +function registerGlobalShortcut() { + // 如果已经注册了快捷键,先取消注册 + if (isShortcutRegistered) { + globalShortcut.unregister(CHAT_SHORTCUT_KEY); + } + + // 注册新的快捷键 + const success = globalShortcut.register(CHAT_SHORTCUT_KEY, () => { + const chatWindow = BrowserWindow.getAllWindows().find((win) => + win.webContents.getURL().includes('chat'), + ); + + if (chatWindow) { + if (chatWindow.isMinimized()) chatWindow.restore(); + chatWindow.show(); + chatWindow.focus(); + } else { + // 如果没有找到聊天窗口,则创建一个新的 + const newChatWindow = createChatWindow(); + newChatWindow.show(); + newChatWindow.focus(); + } + }); + + isShortcutRegistered = success; + + if (!success) { + console.error('Failed to register global shortcut'); + // 在macOS上,提示用户需要授予辅助功能权限 + if (process.platform === 'darwin' && !checkAccessibilityPermission()) { + dialog.showMessageBox({ + type: 'info', + title: '需要辅助功能权限', + message: `要使用快捷键 ${CHAT_SHORTCUT_KEY} 功能,请在系统偏好设置中,授予应用辅助功能权限。`, + buttons: ['好的'], + }); + } + } + + return success; +} + app.once('ready', () => { onReady(); }); @@ -71,6 +134,27 @@ async function onReady() { process.env['EULERCOPILOT_CACHE_PATH'] = cachePath || ''; await startup(); + + // 注册全局快捷键 + registerGlobalShortcut(); + + // 在macOS上,监听辅助功能权限变化,重新注册快捷键 + if (process.platform === 'darwin') { + app.accessibilitySupportEnabled = checkAccessibilityPermission(); + + app.on( + 'accessibility-support-changed', + (event, accessibilitySupportEnabled) => { + console.log( + 'Accessibility support changed:', + accessibilitySupportEnabled, + ); + if (accessibilitySupportEnabled) { + registerGlobalShortcut(); + } + }, + ); + } } catch (error) {} } diff --git a/electron/main/window/create.ts b/electron/main/window/create.ts index 5b43d7d..b1b4aab 100644 --- a/electron/main/window/create.ts +++ b/electron/main/window/create.ts @@ -113,12 +113,7 @@ export function createChatWindow(): BrowserWindow { chatWindow = createWindow(chatWindowOptions, hash, 'chatWindow'); - const shortcutKey = - process.platform === 'darwin' ? 'Cmd+Option+O' : 'Ctrl+Alt+O'; - - globalShortcut.register(shortcutKey, () => { - chatWindow && chatWindow.show(); - }); + // 移除这里的快捷键注册,现在在应用启动时全局注册 return chatWindow; } -- Gitee From 2c23885e64a2ad4f5ad68ea5b0b44679d57ea7a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B2=E9=B8=BF=E5=AE=87?= Date: Mon, 14 Apr 2025 19:06:19 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20=E7=A7=BB=E9=99=A4=E6=97=A0=E6=95=88?= =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 史鸿宇 --- electron/main/window/create.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/electron/main/window/create.ts b/electron/main/window/create.ts index b1b4aab..72cf62c 100644 --- a/electron/main/window/create.ts +++ b/electron/main/window/create.ts @@ -113,8 +113,6 @@ export function createChatWindow(): BrowserWindow { chatWindow = createWindow(chatWindowOptions, hash, 'chatWindow'); - // 移除这里的快捷键注册,现在在应用启动时全局注册 - return chatWindow; } -- Gitee From 2d3180bba1673ff45e0c608c50c91884232a09d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B2=E9=B8=BF=E5=AE=87?= Date: Mon, 14 Apr 2025 20:31:01 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E7=89=88=E6=9D=83?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E8=87=B32023-2025=E5=B9=B4=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E8=A1=A5=E9=BD=90Mulan=20PSL=20v2=E8=AE=B8=E5=8F=AF=E8=AF=81?= =?UTF-8?q?=E5=A3=B0=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 史鸿宇 --- electron/main/common/conf.ts | 2 + electron/main/common/nls.ts | 2 + electron/main/common/platform.ts | 2 + electron/main/common/product.ts | 2 + electron/main/index.ts | 2 + electron/main/node/userDataPath.ts | 2 + electron/main/window/create.ts | 2 + electron/main/window/index.ts | 2 + electron/main/window/options.ts | 2 + electron/main/window/tray.ts | 2 + electron/preload/index.ts | 2 + env.d.ts | 2 +- src/apis/appCenter/appCenterService.ts | 2 +- src/apis/appCenter/index.ts | 2 +- src/apis/index.ts | 2 +- src/apis/paths/account.ts | 2 +- src/apis/paths/api.ts | 2 +- src/apis/paths/apikey.ts | 16 +++++-- src/apis/paths/app.ts | 2 +- src/apis/paths/conversation.ts | 10 +---- src/apis/paths/external.ts | 2 +- src/apis/paths/index.ts | 2 +- src/apis/paths/knowledge.ts | 2 +- src/apis/server.ts | 8 ++-- src/apis/tools.ts | 2 +- src/apis/workFlow/index.ts | 2 +- src/apis/workFlow/workFlowService.ts | 2 +- src/components/dialoguePanel/type.ts | 2 +- src/components/sessionCard/type.ts | 2 +- src/conf/version.ts | 2 +- src/main.ts | 2 +- src/router/index.ts | 2 +- src/store/account.ts | 4 +- src/store/conversation.ts | 12 +++--- src/store/historySession.ts | 2 +- src/store/index.ts | 2 +- src/utils/electron.ts | 2 + src/utils/index.ts | 2 +- src/utils/marked.ts | 2 +- src/utils/tools.ts | 2 +- src/views/createapp/components/types.ts | 2 +- src/views/dialogue/constants.ts | 2 +- src/views/dialogue/types.ts | 2 +- vite.config.ts | 57 +++++++++++++------------ 44 files changed, 106 insertions(+), 77 deletions(-) diff --git a/electron/main/common/conf.ts b/electron/main/common/conf.ts index 0fb68b2..5f4c99e 100644 --- a/electron/main/common/conf.ts +++ b/electron/main/common/conf.ts @@ -1,3 +1,5 @@ +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. +// licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: // http://license.coscl.org.cn/MulanPSL2 diff --git a/electron/main/common/nls.ts b/electron/main/common/nls.ts index 0c3e1c5..e16be02 100644 --- a/electron/main/common/nls.ts +++ b/electron/main/common/nls.ts @@ -1,3 +1,5 @@ +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. +// licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: // http://license.coscl.org.cn/MulanPSL2 diff --git a/electron/main/common/platform.ts b/electron/main/common/platform.ts index c339dd8..7f78c8a 100644 --- a/electron/main/common/platform.ts +++ b/electron/main/common/platform.ts @@ -1,3 +1,5 @@ +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. +// licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: // http://license.coscl.org.cn/MulanPSL2 diff --git a/electron/main/common/product.ts b/electron/main/common/product.ts index f2aca97..b90384f 100644 --- a/electron/main/common/product.ts +++ b/electron/main/common/product.ts @@ -1,3 +1,5 @@ +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. +// licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: // http://license.coscl.org.cn/MulanPSL2 diff --git a/electron/main/index.ts b/electron/main/index.ts index 38dd254..22c68d6 100644 --- a/electron/main/index.ts +++ b/electron/main/index.ts @@ -1,3 +1,5 @@ +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. +// licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: // http://license.coscl.org.cn/MulanPSL2 diff --git a/electron/main/node/userDataPath.ts b/electron/main/node/userDataPath.ts index fdfe261..806e9ec 100644 --- a/electron/main/node/userDataPath.ts +++ b/electron/main/node/userDataPath.ts @@ -1,3 +1,5 @@ +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. +// licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: // http://license.coscl.org.cn/MulanPSL2 diff --git a/electron/main/window/create.ts b/electron/main/window/create.ts index 72cf62c..1f29b72 100644 --- a/electron/main/window/create.ts +++ b/electron/main/window/create.ts @@ -1,3 +1,5 @@ +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. +// licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: // http://license.coscl.org.cn/MulanPSL2 diff --git a/electron/main/window/index.ts b/electron/main/window/index.ts index 21a4390..b7773d6 100644 --- a/electron/main/window/index.ts +++ b/electron/main/window/index.ts @@ -1,3 +1,5 @@ +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. +// licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: // http://license.coscl.org.cn/MulanPSL2 diff --git a/electron/main/window/options.ts b/electron/main/window/options.ts index f48f00e..e7049c8 100644 --- a/electron/main/window/options.ts +++ b/electron/main/window/options.ts @@ -1,3 +1,5 @@ +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. +// licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: // http://license.coscl.org.cn/MulanPSL2 diff --git a/electron/main/window/tray.ts b/electron/main/window/tray.ts index 1c07b91..246afec 100644 --- a/electron/main/window/tray.ts +++ b/electron/main/window/tray.ts @@ -1,3 +1,5 @@ +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. +// licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: // http://license.coscl.org.cn/MulanPSL2 diff --git a/electron/preload/index.ts b/electron/preload/index.ts index cbea3f1..2700a19 100644 --- a/electron/preload/index.ts +++ b/electron/preload/index.ts @@ -1,3 +1,5 @@ +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. +// licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: // http://license.coscl.org.cn/MulanPSL2 diff --git a/env.d.ts b/env.d.ts index 4c00daf..43df7b9 100644 --- a/env.d.ts +++ b/env.d.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. // licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: diff --git a/src/apis/appCenter/appCenterService.ts b/src/apis/appCenter/appCenterService.ts index 9ec8328..ac2b346 100644 --- a/src/apis/appCenter/appCenterService.ts +++ b/src/apis/appCenter/appCenterService.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. import { post, get, del, put } from 'src/apis/server'; import type { FcResponse } from 'src/apis/server'; import { QueryAppListParamsType, CreateOrUpdateAppParamsType } from './type'; diff --git a/src/apis/appCenter/index.ts b/src/apis/appCenter/index.ts index 95d1ce0..f842150 100644 --- a/src/apis/appCenter/index.ts +++ b/src/apis/appCenter/index.ts @@ -1,2 +1,2 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. export * from './appCenterService'; diff --git a/src/apis/index.ts b/src/apis/index.ts index 8591598..530a741 100644 --- a/src/apis/index.ts +++ b/src/apis/index.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. // licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: diff --git a/src/apis/paths/account.ts b/src/apis/paths/account.ts index 6ff6b4c..27fe833 100644 --- a/src/apis/paths/account.ts +++ b/src/apis/paths/account.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. // licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: diff --git a/src/apis/paths/api.ts b/src/apis/paths/api.ts index 8538d5d..96c5d1d 100644 --- a/src/apis/paths/api.ts +++ b/src/apis/paths/api.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. import { post, get, del, put } from 'src/apis/server'; import type { FcResponse } from 'src/apis/server'; import { QueryApiListParamsType, CreateOrUpdateApiParamsType } from './type'; diff --git a/src/apis/paths/apikey.ts b/src/apis/paths/apikey.ts index 3848437..6ffdb0c 100644 --- a/src/apis/paths/apikey.ts +++ b/src/apis/paths/apikey.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. // licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: @@ -14,9 +14,17 @@ import type { FcResponse } from 'src/apis/server'; * 验证用户信息 * @returns */ -export const getApiKey = (): Promise<[any, FcResponse<{ - api_key: string; -}> | undefined]> => { +export const getApiKey = (): Promise< + [ + any, + ( + | FcResponse<{ + api_key: string; + }> + | undefined + ), + ] +> => { return get('/api/auth/key'); }; diff --git a/src/apis/paths/app.ts b/src/apis/paths/app.ts index 3a87663..51995ec 100644 --- a/src/apis/paths/app.ts +++ b/src/apis/paths/app.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. // licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: diff --git a/src/apis/paths/conversation.ts b/src/apis/paths/conversation.ts index 08a052f..bfeb68e 100644 --- a/src/apis/paths/conversation.ts +++ b/src/apis/paths/conversation.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. // licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: @@ -18,13 +18,7 @@ const BASE_URL = '/api/conversation'; * @returns */ export const stopGeneration = (): Promise< - [ - any, - ( - | FcResponse - | undefined - ), - ] + [any, FcResponse | undefined] > => { return post(`/api/stop`); }; diff --git a/src/apis/paths/external.ts b/src/apis/paths/external.ts index d46588e..7bd1730 100644 --- a/src/apis/paths/external.ts +++ b/src/apis/paths/external.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. // licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: diff --git a/src/apis/paths/index.ts b/src/apis/paths/index.ts index 17d6d4b..f87c8a5 100644 --- a/src/apis/paths/index.ts +++ b/src/apis/paths/index.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. // licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: diff --git a/src/apis/paths/knowledge.ts b/src/apis/paths/knowledge.ts index 8016773..7ce9d72 100644 --- a/src/apis/paths/knowledge.ts +++ b/src/apis/paths/knowledge.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. // licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: diff --git a/src/apis/server.ts b/src/apis/server.ts index 64d34b3..3e165fc 100644 --- a/src/apis/server.ts +++ b/src/apis/server.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. // licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: @@ -34,8 +34,10 @@ export interface IAnyObj { export type Fn = (data: FcResponse) => unknown; - -const baseURL = import.meta.env.MODE === 'electron-production' ? import.meta.env.VITE_BASE_PROXY_URL : './'; +const baseURL = + import.meta.env.MODE === 'electron-production' + ? import.meta.env.VITE_BASE_PROXY_URL + : './'; // 创建 axios 实例 export const server = axios.create({ baseURL, diff --git a/src/apis/tools.ts b/src/apis/tools.ts index ad08b01..df279e1 100644 --- a/src/apis/tools.ts +++ b/src/apis/tools.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. // licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: diff --git a/src/apis/workFlow/index.ts b/src/apis/workFlow/index.ts index fba2fe8..516f17b 100644 --- a/src/apis/workFlow/index.ts +++ b/src/apis/workFlow/index.ts @@ -1,2 +1,2 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. export * from './workFlowService'; diff --git a/src/apis/workFlow/workFlowService.ts b/src/apis/workFlow/workFlowService.ts index d6b6a39..3f094d9 100644 --- a/src/apis/workFlow/workFlowService.ts +++ b/src/apis/workFlow/workFlowService.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. import { post, get, del, put } from 'src/apis/server'; import type { FcResponse } from 'src/apis/server'; import { diff --git a/src/components/dialoguePanel/type.ts b/src/components/dialoguePanel/type.ts index 68ce239..5d02cb4 100644 --- a/src/components/dialoguePanel/type.ts +++ b/src/components/dialoguePanel/type.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. // licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: diff --git a/src/components/sessionCard/type.ts b/src/components/sessionCard/type.ts index a6d0d04..91d1be3 100644 --- a/src/components/sessionCard/type.ts +++ b/src/components/sessionCard/type.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. // licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: diff --git a/src/conf/version.ts b/src/conf/version.ts index c54a707..82f3d1e 100644 --- a/src/conf/version.ts +++ b/src/conf/version.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. // licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: diff --git a/src/main.ts b/src/main.ts index a3853b3..769aad8 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. // licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: diff --git a/src/router/index.ts b/src/router/index.ts index e9124f9..78d8616 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. // licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: diff --git a/src/store/account.ts b/src/store/account.ts index 89385b6..81fc318 100644 --- a/src/store/account.ts +++ b/src/store/account.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. // licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: @@ -49,7 +49,7 @@ export const useAccountStore = defineStore('account', () => { async function getAuthUrl(action: string) { const [_, res] = await api.queryAuthUrl(action); - if (!_&&res) { + if (!_ && res) { return res.result.url; } return null; diff --git a/src/store/conversation.ts b/src/store/conversation.ts index 51d0cd6..6780233 100644 --- a/src/store/conversation.ts +++ b/src/store/conversation.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. // licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: @@ -89,15 +89,15 @@ export const useSessionStore = defineStore('conversation', () => { **/ function splitDataString(input) { if (input.includes('"data: ')) { - return [input]; + return [input]; } - const parts = input.split(/data: /g).filter(part => part.trim() !== ''); + const parts = input.split(/data: /g).filter((part) => part.trim() !== ''); if (input.startsWith('data: ')) { - return parts.map(part => 'data: ' + part); + return parts.map((part) => 'data: ' + part); } else { - return [parts[0], ...parts.slice(1).map(part => 'data: ' + part)]; + return [parts[0], ...parts.slice(1).map((part) => 'data: ' + part)]; } -} + } /** * 请求流式数据 * @param params diff --git a/src/store/historySession.ts b/src/store/historySession.ts index 6157073..61e1c18 100644 --- a/src/store/historySession.ts +++ b/src/store/historySession.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. // licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: diff --git a/src/store/index.ts b/src/store/index.ts index 3119618..1152883 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. // licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: diff --git a/src/utils/electron.ts b/src/utils/electron.ts index a72d74e..59f2575 100644 --- a/src/utils/electron.ts +++ b/src/utils/electron.ts @@ -1,3 +1,5 @@ +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. +// licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: // http://license.coscl.org.cn/MulanPSL2 diff --git a/src/utils/index.ts b/src/utils/index.ts index d139273..9d09235 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. // licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: diff --git a/src/utils/marked.ts b/src/utils/marked.ts index 34861d2..2677e49 100644 --- a/src/utils/marked.ts +++ b/src/utils/marked.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. // licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: diff --git a/src/utils/tools.ts b/src/utils/tools.ts index af58040..9a4474d 100644 --- a/src/utils/tools.ts +++ b/src/utils/tools.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. // licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: diff --git a/src/views/createapp/components/types.ts b/src/views/createapp/components/types.ts index e80c3b4..b66bfee 100644 --- a/src/views/createapp/components/types.ts +++ b/src/views/createapp/components/types.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. // licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: diff --git a/src/views/dialogue/constants.ts b/src/views/dialogue/constants.ts index 6b25d81..2836a40 100644 --- a/src/views/dialogue/constants.ts +++ b/src/views/dialogue/constants.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. // licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: diff --git a/src/views/dialogue/types.ts b/src/views/dialogue/types.ts index 8ede5f9..2789fff 100644 --- a/src/views/dialogue/types.ts +++ b/src/views/dialogue/types.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. // licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: diff --git a/vite.config.ts b/vite.config.ts index 179aadd..4e3ead9 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,4 +1,4 @@ -// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. +// Copyright (c) Huawei Technologies Co., Ltd. 2023-2025. All rights reserved. // licensed under the Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: @@ -7,57 +7,58 @@ // IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR // PURPOSE. // See the Mulan PSL v2 for more details. -import { defineConfig, loadEnv } from "vite"; -import vue from "@vitejs/plugin-vue"; -import Qiankun from 'vite-plugin-qiankun' +import { defineConfig, loadEnv } from 'vite'; +import vue from '@vitejs/plugin-vue'; +import Qiankun from 'vite-plugin-qiankun'; -import { resolve } from "path"; -import type { UserConfigExport } from "vite"; +import { resolve } from 'path'; +import type { UserConfigExport } from 'vite'; // import babel from '@rollup/plugin-babel'; // https://vitejs.dev/config/ export default ({ mode }): UserConfigExport => { const env = loadEnv(mode, process.cwd()); - const { - VITE_BASE_URL - } = env - - const baseUrl = mode === 'micro' ? VITE_BASE_URL : './' + const { VITE_BASE_URL } = env; + + const baseUrl = mode === 'micro' ? VITE_BASE_URL : './'; return defineConfig({ base: baseUrl, resolve: { alias: { - "@": resolve(__dirname, "./src"), - src: resolve(__dirname, "./src"), - assets: resolve(__dirname, "./src/assets"), - components: resolve(__dirname, "./src/components"), + '@': resolve(__dirname, './src'), + src: resolve(__dirname, './src'), + assets: resolve(__dirname, './src/assets'), + components: resolve(__dirname, './src/components'), }, }, plugins: [ vue(), - Qiankun("copilot", { - useDevMode: mode === 'development' - }) + Qiankun('copilot', { + useDevMode: mode === 'development', + }), ], build: { rollupOptions: { output: { manualChunks(id) { if (/\/opendesign2\/themes\/es\/(.*?)\//.test(id)) { - return "opendesign2"; + return 'opendesign2'; } if (/\/opendesign-icons\/themes\/es\/(.*?)\//.test(id)) { - return "opendesign-icons"; + return 'opendesign-icons'; } - if (/\/element-plus\/es\/components\/(.*?)\/(.*)\/?style/.test(id)) { - return "element-plus"; + if ( + /\/element-plus\/es\/components\/(.*?)\/(.*)\/?style/.test(id) + ) { + return 'element-plus'; } }, chunkFileNames: (chunkInfo: any) => { const faceadeModuleId = chunkInfo.faceadeModuleId - ? chunkInfo.faceadeModuleId.split("/") + ? chunkInfo.faceadeModuleId.split('/') : []; - const fileName = faceadeModuleId[faceadeModuleId.length - 2] || "[name]"; + const fileName = + faceadeModuleId[faceadeModuleId.length - 2] || '[name]'; return `assets/${fileName}.[hash].js`; }, }, @@ -65,20 +66,20 @@ export default ({ mode }): UserConfigExport => { }, server: { - host: "localhost", + host: 'localhost', hmr: true, port: 3000, origin: 'http://localhost:3000', headers: { - "Access-Control-Allow-Origin": "*", + 'Access-Control-Allow-Origin': '*', }, proxy: { - "/api": { + '/api': { target: env.VITE_BASE_PROXY_URL, changeOrigin: true, ws: false, rewrite: (path: string) => path, - cookieDomainRewrite: '.euler-copilot-master.test.osinfra.cn' + cookieDomainRewrite: '.euler-copilot-master.test.osinfra.cn', }, }, }, -- Gitee