From e737f7193253798affd86e6368d7581c99dbe490 Mon Sep 17 00:00:00 2001 From: icarus Date: Sat, 27 Sep 2025 18:28:08 +0800 Subject: [PATCH] feat(i18n): add unnamed translation and use in session creation Add "unnamed" translation in both zh-cn and en-us locales Use the translation as default name when creating new sessions --- src/renderer/src/i18n/locales/en-us.json | 1 + src/renderer/src/i18n/locales/zh-cn.json | 1 + src/renderer/src/pages/home/Tabs/components/Sessions.tsx | 5 +++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/renderer/src/i18n/locales/en-us.json b/src/renderer/src/i18n/locales/en-us.json index 904631e54e..ff78ec9014 100644 --- a/src/renderer/src/i18n/locales/en-us.json +++ b/src/renderer/src/i18n/locales/en-us.json @@ -1035,6 +1035,7 @@ "success": "Success", "swap": "Swap", "topics": "Topics", + "unnamed": "Unnamed", "update_success": "Update successfully", "upload_files": "Upload file", "warning": "Warning", diff --git a/src/renderer/src/i18n/locales/zh-cn.json b/src/renderer/src/i18n/locales/zh-cn.json index fec8b30733..b37a6adac8 100644 --- a/src/renderer/src/i18n/locales/zh-cn.json +++ b/src/renderer/src/i18n/locales/zh-cn.json @@ -1035,6 +1035,7 @@ "success": "成功", "swap": "交换", "topics": "话题", + "unnamed": "未命名", "update_success": "更新成功", "upload_files": "上传文件", "warning": "警告", diff --git a/src/renderer/src/pages/home/Tabs/components/Sessions.tsx b/src/renderer/src/pages/home/Tabs/components/Sessions.tsx index 5564978f90..f2e7d8f65d 100644 --- a/src/renderer/src/pages/home/Tabs/components/Sessions.tsx +++ b/src/renderer/src/pages/home/Tabs/components/Sessions.tsx @@ -45,13 +45,14 @@ const Sessions: React.FC = ({ agentId }) => { if (!agent) return const session = { ...agent, - id: undefined + id: undefined, + name: t('common.unnamed') } satisfies CreateSessionForm const created = await createSession(session) if (created) { dispatch(setActiveSessionIdAction({ agentId, sessionId: created.id })) } - }, [agent, agentId, createSession, dispatch]) + }, [agent, agentId, createSession, dispatch, t]) const handleDeleteSession = useCallback( async (id: string) => {