From d11c6e8c0bb2a7a675597b67c06366db3a09f62e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jack=E9=AD=8F?= Date: Mon, 18 Aug 2025 17:41:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96=E6=A0=87=E8=AF=86?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=8C=E5=81=9C=E6=AD=A2=E5=9B=9E=E7=AD=94?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/main/common/locale.ts | 2 +- electron/main/common/platform.ts | 2 +- src/apis/paths/conversation.ts | 4 ++-- src/components/commonFooter/CommonFooter.vue | 4 ++-- src/i18n/index.ts | 6 +++--- src/i18n/lang/en.ts | 21 ++++++++++++++++--- src/i18n/lang/zh-cn.ts | 2 ++ src/store/conversation.ts | 18 +++++++++------- src/store/lang.ts | 4 ++-- .../workFlowConfig/workFlowDialog.vue | 4 ++-- .../dialogue/components/DialogueSession.vue | 2 +- src/views/dialogue/components/TitleBar.vue | 4 ++-- 12 files changed, 46 insertions(+), 27 deletions(-) diff --git a/electron/main/common/locale.ts b/electron/main/common/locale.ts index a2d6daa..06078c8 100644 --- a/electron/main/common/locale.ts +++ b/electron/main/common/locale.ts @@ -30,7 +30,7 @@ export function processZhLocale(appLocale: string): string { // country codes, assume they use Simplified Chinese. // For other cases, assume they use Traditional. if (['hans', 'cn', 'sg', 'my'].includes(region)) { - return 'zh_cn'; + return 'zh'; } return 'zh_tw'; diff --git a/electron/main/common/platform.ts b/electron/main/common/platform.ts index 1d499b4..df78f47 100644 --- a/electron/main/common/platform.ts +++ b/electron/main/common/platform.ts @@ -9,7 +9,7 @@ // See the Mulan PSL v2 for more details. import * as nls from './nls'; -export const LANGUAGE_DEFAULT = 'zh_cn'; +export const LANGUAGE_DEFAULT = 'zh'; let _isWindows = false; let _isMacintosh = false; diff --git a/src/apis/paths/conversation.ts b/src/apis/paths/conversation.ts index 8c3057b..db3bbd2 100644 --- a/src/apis/paths/conversation.ts +++ b/src/apis/paths/conversation.ts @@ -17,10 +17,10 @@ const BASE_URL = '/api/conversation'; * 停止生成 * @returns */ -export const stopGeneration = (): Promise< +export const stopGeneration = (taskId: string): Promise< [any, FcResponse | undefined] > => { - return post(`/api/stop`); + return post(`/api/stop?taskId=${taskId}`); }; /** diff --git a/src/components/commonFooter/CommonFooter.vue b/src/components/commonFooter/CommonFooter.vue index 527eb53..b88448b 100644 --- a/src/components/commonFooter/CommonFooter.vue +++ b/src/components/commonFooter/CommonFooter.vue @@ -13,7 +13,7 @@ const policy = ref(''); */ const readAgreement = async () => { const localLang = localStorage.getItem('copilot_language'); - const locale = (localLang && JSON.parse(localLang).language) || 'zh_cn'; + const locale = (localLang && JSON.parse(localLang).language) || 'zh'; const response = locale === 'en' ? await import('src/conf/agreement-en.md?raw') @@ -24,7 +24,7 @@ const readAgreement = async () => { const readPolicy = async () => { const localLang = localStorage.getItem('copilot_language'); - const locale = (localLang && JSON.parse(localLang).language) || 'zh_cn'; + const locale = (localLang && JSON.parse(localLang).language) || 'zh'; const response = locale === 'en' ? await import('src/conf/policy-en.md?raw') diff --git a/src/i18n/index.ts b/src/i18n/index.ts index 6139ced..7fe3eb0 100644 --- a/src/i18n/index.ts +++ b/src/i18n/index.ts @@ -1,16 +1,16 @@ import { createI18n } from 'vue-i18n'; // 语言包 -import zh_cn from './lang/zh-cn'; +import zh from './lang/zh-cn'; import en from './lang/en'; const localLang = localStorage.getItem('copilot_language'); -const locale = (localLang && JSON.parse(localLang).language) || 'zh_cn'; +const locale = (localLang && JSON.parse(localLang).language) || 'zh'; const i18n = createI18n({ legacy: false, // 设置为 false,启用 composition API 模式 locale, messages: { - zh_cn, + zh, en, }, }); diff --git a/src/i18n/lang/en.ts b/src/i18n/lang/en.ts index c61da9e..a21f565 100644 --- a/src/i18n/lang/en.ts +++ b/src/i18n/lang/en.ts @@ -111,6 +111,8 @@ export default { cancel: 'Cancel', all_select: 'All', installed: 'Installed', + not_active: 'Not Active', + active: 'Active', }, upload_icon: 'Upload Icon', please_upload_icon: 'Upload an icon.', @@ -157,6 +159,10 @@ export default { app_config: 'App Config', workflow_app: 'Create Workflow App', mcp_app: 'Create Agent App', + create_mcp_app: 'Create MCP App', + create_workflow_app: 'Create Workflow App', + mcp_app_desc: 'Build plugin/Agent apps to quickly create personal AI assistants', + workflow_app_desc: 'Create drag-and-drop workflow apps to craft production-grade AI solutions', confirm_delete_app: 'Are you sure you want to delete this APP?', create_or_edit_workflow_first: 'Create/Edit a workflow first.', ui_preview: 'UI Preview', @@ -170,8 +176,8 @@ export default { multi_Dialogue_select: 'Number of Turns', ability_Configuration: 'Capabilities', MCPService: 'MCP Services', - CPService_add: 'Add MCP Service', - ermissionConfiguration: 'Permissions', + MCPService_add: 'Add MCP Service', + permissionConfiguration: 'Permissions', permission: 'Permissions', permission_public: 'Public (visible to all)', permission_private: 'Private (visible only to me)', @@ -223,7 +229,7 @@ export default { service_agreement: 'Service Agreement', privacy_policy: 'Privacy Policy', contact_us: 'Contact Us', - version: 'Version 0.9.6-Beta', + version: 'Version 0.10.0-Beta', }, history: { new_chat: 'New Chat', @@ -390,4 +396,13 @@ export default { prev: 'Previous', next: 'Next', }, + zoom: { + reduce: 'Zoom Out', + amplify: 'Zoom In', + adaptive: 'Fit to Screen', + scaleTo50: 'Zoom to 50%', + scaleTo100: 'Zoom to 100%', + scaleTo150: 'Zoom to 150%', + scaleTo200: 'Zoom to 200%', + }, }; diff --git a/src/i18n/lang/zh-cn.ts b/src/i18n/lang/zh-cn.ts index ed5dd34..965054a 100644 --- a/src/i18n/lang/zh-cn.ts +++ b/src/i18n/lang/zh-cn.ts @@ -111,6 +111,8 @@ export default { cancel: '取消', all_select: '全部', installed: '已安装', + not_active: '未激活', + active: '已激活', }, upload_icon: '上传图标', please_upload_icon: '请上传图标', diff --git a/src/store/conversation.ts b/src/store/conversation.ts index 41dc2f8..a1fd154 100644 --- a/src/store/conversation.ts +++ b/src/store/conversation.ts @@ -51,12 +51,12 @@ export const useSessionStore = defineStore('conversation', () => { // #endregion - const { language } = useLangStore(); - + const langStore = useLangStore(); // 是否暂停回答 const isPaused = ref(false); // 会话列表 const conversationList = ref([]); + const currentMessage = ref({}); const app = ref({ appId: '', name: '', @@ -236,6 +236,7 @@ export const useSessionStore = defineStore('conversation', () => { if ('event' in message) { switch (eventType) { case 'text.add': + currentMessage.value = message; dataTransfers.textAdd(conversationItem, message); break; case 'heartbeat': @@ -301,7 +302,7 @@ export const useSessionStore = defineStore('conversation', () => { conversationId: params.conversationId, features: features, groupId: params.groupId, - language, + language: langStore.language, question: params.question, // record_id: params.qaRecordId, }), @@ -320,6 +321,7 @@ export const useSessionStore = defineStore('conversation', () => { }, conversationId: params.conversationId, debug: true, + language: langStore.language, question: params.question, }), openWhenHidden: true, @@ -342,7 +344,7 @@ export const useSessionStore = defineStore('conversation', () => { }, conversationId: params.conversationId, features: features, - language, + language: langStore.language, groupId: params.groupId, question: params.question, record_id: params.qaRecordId, @@ -368,7 +370,7 @@ export const useSessionStore = defineStore('conversation', () => { conversationId: params.conversationId, features: features, groupId: params.groupId, - language, + language: langStore.language, question: params.question, record_id: params.qaRecordId, }), @@ -451,7 +453,6 @@ export const useSessionStore = defineStore('conversation', () => { handleMsgDataShow(params, ev, conversationItem); }, }; - if (params.user_selected_flow) { // 之前的对话历史记录 await funcFetch.fetchHistory(streamUrl, params, pp, fetchParams); @@ -610,7 +611,7 @@ export const useSessionStore = defineStore('conversation', () => { targetItem.message[0] += '暂停生成'; targetItem.isFinish = true; cancel(); - const resp = await api.stopGeneration(); + const resp = await api.stopGeneration(currentMessage.value.taskId); if (resp?.[1]?.code === 200) { isAnswerGenerating.value = false; } @@ -793,7 +794,7 @@ export const useSessionStore = defineStore('conversation', () => { ] as RobotConversationItem ).isFinish = true; cancel(); - const resp = await api.stopGeneration(); + const resp = await api.stopGeneration(currentMessage.value.taskId); if (resp?.[1]?.code === 200) { isAnswerGenerating.value = false; } @@ -810,6 +811,7 @@ export const useSessionStore = defineStore('conversation', () => { dialogueRef, app, appList, + currentMessage, sendQuestion, pausedStream, stopDebug, diff --git a/src/store/lang.ts b/src/store/lang.ts index 4c5c359..bdfec2e 100644 --- a/src/store/lang.ts +++ b/src/store/lang.ts @@ -9,7 +9,7 @@ export const useLangStore = defineStore( const i18n = useI18n(); const language = ref(); - const changeLanguage = (lang: 'zh_cn' | 'en') => { + const changeLanguage = (lang: 'zh' | 'en') => { language.value = lang; i18n.locale.value = language.value; if (ipcRenderer) { @@ -26,7 +26,7 @@ export const useLangStore = defineStore( electronProcess.env['EULERCOPILOT_NLS_CONFIG'] && changeLanguage(nlsConfig.userLocale); } else { - !language.value && changeLanguage('zh_cn'); + !language.value && changeLanguage('zh'); } }); return { diff --git a/src/views/createapp/components/workFlowConfig/workFlowDialog.vue b/src/views/createapp/components/workFlowConfig/workFlowDialog.vue index 25ed229..b66a5ff 100644 --- a/src/views/createapp/components/workFlowConfig/workFlowDialog.vue +++ b/src/views/createapp/components/workFlowConfig/workFlowDialog.vue @@ -126,7 +126,7 @@ const handleSubmit = (formEl: FormInstance | undefined) => { apiId: 'startId', nodeId: 'Empty', serviceId: 'start', - name: '开始', + name: i18n.global.t('main.start'), callId: 'start', description: 'startNode', editable: false, @@ -141,7 +141,7 @@ const handleSubmit = (formEl: FormInstance | undefined) => { apiId: 'endId', nodeId: 'Empty', serviceId: 'end', - name: '结束', + name: i18n.global.t('main.end') , callId: 'end', description: 'endNode', editable: false, diff --git a/src/views/dialogue/components/DialogueSession.vue b/src/views/dialogue/components/DialogueSession.vue index 8faa249..a6ffacc 100644 --- a/src/views/dialogue/components/DialogueSession.vue +++ b/src/views/dialogue/components/DialogueSession.vue @@ -851,7 +851,7 @@ const getFormatFileList = (ConversationItem,str)=>{