JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.
Python
feat: internationalize web UI
lairuofeid538ee3d9235
diff --git a/jiuwenclaw/web/package-lock.json b/jiuwenclaw/web/package-lock.jsonindex eaae7f29dc..6899da7ed7 100644--- a/jiuwenclaw/web/package-lock.json+++ b/jiuwenclaw/web/package-lock.json@@ -10,8 +10,11 @@"dependencies": {"@tailwindcss/typography": "^0.5.19","clsx": "^2.1.0",+ "i18next": "^25.8.18",+ "i18next-browser-languagedetector": "^8.2.1","react": "^18.2.0","react-dom": "^18.2.0",+ "react-i18next": "^16.5.8","react-markdown": "^10.1.0","remark-gfm": "^4.0.1","zustand": "^4.5.0"@@ -300,6 +303,15 @@"@babel/core": "^7.0.0-0"}},+ "node_modules/@babel/runtime": {+ "version": "7.28.6",+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.6.tgz",+ "integrity": "sha512-05WQkdpL9COIMz4LjTxGpPNCdlpyimKppYNoJ5Di5EUObifl8t4tuLuUBBZEpoLYOmfvIWrsp9fCl0HoPRVTdA==",+ "license": "MIT",+ "engines": {+ "node": ">=6.9.0"+ }+ },"node_modules/@babel/template": {"version": "7.28.6","resolved": "https://registry.npmjs.org/@babel/template/-/template-7.28.6.tgz",@@ -2929,6 +2941,15 @@"url": "https://opencollective.com/unified"}},+ "node_modules/html-parse-stringify": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/html-parse-stringify/-/html-parse-stringify-3.0.1.tgz",+ "integrity": "sha512-KknJ50kTInJ7qIScF3jeaFRpMpE8/lfiTdzf/twXyPBLAGrLRTmkz3AdTnKeh40X8k9L2fdYwEp/42WGXIRGcg==",+ "license": "MIT",+ "dependencies": {+ "void-elements": "3.1.0"+ }+ },"node_modules/html-url-attributes": {"version": "3.0.1","resolved": "https://registry.npmjs.org/html-url-attributes/-/html-url-attributes-3.0.1.tgz",@@ -2939,6 +2960,46 @@"url": "https://opencollective.com/unified"}},+ "node_modules/i18next": {+ "version": "25.8.18",+ "resolved": "https://registry.npmjs.org/i18next/-/i18next-25.8.18.tgz",+ "integrity": "sha512-lzY5X83BiL5AP77+9DydbrqkQHFN9hUzWGjqjLpPcp5ZOzuu1aSoKaU3xbBLSjWx9dAzW431y+d+aogxOZaKRA==",+ "funding": [+ {+ "type": "individual",+ "url": "https://locize.com"+ },+ {+ "type": "individual",+ "url": "https://locize.com/i18next.html"+ },+ {+ "type": "individual",+ "url": "https://www.i18next.com/how-to/faq#i18next-is-awesome.-how-can-i-support-the-project"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "@babel/runtime": "^7.28.6"+ },+ "peerDependencies": {+ "typescript": "^5"+ },+ "peerDependenciesMeta": {+ "typescript": {+ "optional": true+ }+ }+ },+ "node_modules/i18next-browser-languagedetector": {+ "version": "8.2.1",+ "resolved": "https://registry.npmjs.org/i18next-browser-languagedetector/-/i18next-browser-languagedetector-8.2.1.tgz",+ "integrity": "sha512-bZg8+4bdmaOiApD7N7BPT9W8MLZG+nPTOFlLiJiT8uzKXFjhxw4v2ierCXOwB5sFDMtuA5G4kgYZ0AznZxQ/cw==",+ "license": "MIT",+ "dependencies": {+ "@babel/runtime": "^7.23.2"+ }+ },"node_modules/ignore": {"version": "5.3.2","resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",@@ -4686,6 +4747,33 @@"react": "^18.3.1"}},+ "node_modules/react-i18next": {+ "version": "16.5.8",+ "resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-16.5.8.tgz",+ "integrity": "sha512-2ABeHHlakxVY+LSirD+OiERxFL6+zip0PaHo979bgwzeHg27Sqc82xxXWIrSFmfWX0ZkrvXMHwhsi/NGUf5VQg==",+ "license": "MIT",+ "dependencies": {+ "@babel/runtime": "^7.28.4",+ "html-parse-stringify": "^3.0.1",+ "use-sync-external-store": "^1.6.0"+ },+ "peerDependencies": {+ "i18next": ">= 25.6.2",+ "react": ">= 16.8.0",+ "typescript": "^5"+ },+ "peerDependenciesMeta": {+ "react-dom": {+ "optional": true+ },+ "react-native": {+ "optional": true+ },+ "typescript": {+ "optional": true+ }+ }+ },"node_modules/react-markdown": {"version": "10.1.0","resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-10.1.0.tgz",@@ -5307,7 +5395,7 @@"version": "5.9.3","resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz","integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",- "dev": true,+ "devOptional": true,"license": "Apache-2.0","peer": true,"bin": {@@ -5557,6 +5645,15 @@}}},+ "node_modules/void-elements": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-3.1.0.tgz",+ "integrity": "sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w==",+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },"node_modules/which": {"version": "2.0.2","resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",diff --git a/jiuwenclaw/web/package.json b/jiuwenclaw/web/package.jsonindex bd7444e9e5..9aa6c7155f 100644--- a/jiuwenclaw/web/package.json+++ b/jiuwenclaw/web/package.json@@ -14,8 +14,11 @@"dependencies": {"@tailwindcss/typography": "^0.5.19","clsx": "^2.1.0",+ "i18next": "^25.8.18",+ "i18next-browser-languagedetector": "^8.2.1","react": "^18.2.0","react-dom": "^18.2.0",+ "react-i18next": "^16.5.8","react-markdown": "^10.1.0","remark-gfm": "^4.0.1","zustand": "^4.5.0"diff --git a/jiuwenclaw/web/src/App.tsx b/jiuwenclaw/web/src/App.tsxindex 5fcf92f475..0c5631f552 100644--- a/jiuwenclaw/web/src/App.tsx+++ b/jiuwenclaw/web/src/App.tsx@@ -22,6 +22,7 @@ import { HeartbeatMessageModal } from './features/HeartbeatMessageModal';import { useWebSocket } from './hooks';import { AgentMode } from './types';import { useSessionStore, useChatStore, useTodoStore } from './stores';+import { useTranslation } from 'react-i18next';import './App.css';type MainNavKey = 'chat' | 'skills' | 'agents' | 'sessions' | 'heartbeat' | 'cron' | 'channels' | 'configpanel' | 'logspanel' | 'browserpanel';@@ -51,35 +52,64 @@ class ErrorBoundary extends Component<render() {if (this.state.hasError) {- return (- <div className="flex items-center justify-center h-screen bg-bg text-text p-8">- <div className="max-w-2xl card">- <h1 className="text-2xl font-bold text-danger mb-4">- 应用加载出错- </h1>- <p className="text-text-muted mb-4">- {this.state.error?.message || '未知错误'}- </p>- <pre className="bg-secondary p-4 rounded-lg text-sm overflow-auto max-h-64 font-mono">- {this.state.error?.stack}- </pre>- <button- onClick={() => window.location.reload()}- className="btn primary mt-4"- >- 刷新页面- </button>- </div>- </div>- );+ return <ErrorFallback error={this.state.error} />;}-return this.props.children;}}+function ErrorFallback({ error }: { error: Error | null }) {+ const { t } = useTranslation();+ return (+ <div className="flex items-center justify-center h-screen bg-bg text-text p-8">+ <div className="max-w-2xl card">+ <h1 className="text-2xl font-bold text-danger mb-4">+ {t('app.errorTitle')}+ </h1>+ <p className="text-text-muted mb-4">+ {error?.message || t('app.unknownError')}+ </p>+ <pre className="bg-secondary p-4 rounded-lg text-sm overflow-auto max-h-64 font-mono">+ {error?.stack}+ </pre>+ <button+ onClick={() => window.location.reload()}+ className="btn primary mt-4"+ >+ {t('app.reload')}+ </button>+ </div>+ </div>+ );+}++// 语言切换组件+function LanguageSwitcher() {+ const { i18n } = useTranslation();+ const isZh = i18n.language.startsWith('zh');+ return (+ <div className="flex items-center gap-1 rounded-lg bg-secondary/60 px-2 py-1">+ <button+ type="button"+ onClick={() => i18n.changeLanguage('zh')}+ className={`text-xs px-2 py-1 rounded ${isZh ? 'bg-accent text-white font-medium' : 'text-text-muted hover:text-text'}`}+ >+ 中+ </button>+ <button+ type="button"+ onClick={() => i18n.changeLanguage('en')}+ className={`text-xs px-2 py-1 rounded ${!isZh ? 'bg-accent text-white font-medium' : 'text-text-muted hover:text-text'}`}+ >+ En+ </button>+ </div>+ );+}+// 主题切换组件function ThemeToggle() {+ const { t } = useTranslation();const [theme, setTheme] = useState(() => {return localStorage.getItem('theme') || 'light';});@@ -103,7 +133,7 @@ function ThemeToggle() {<buttonclassName={`theme-toggle__button ${theme === 'system' ? 'active' : ''}`}onClick={() => toggleTheme('system')}- title="跟随系统"+ title={t('app.themeSystem')}><svg className="w-3.5 h-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><rect x="2" y="3" width="20" height="14" rx="2" ry="2" />@@ -114,7 +144,7 @@ function ThemeToggle() {<buttonclassName={`theme-toggle__button ${theme === 'dark' ? 'active' : ''}`}onClick={() => toggleTheme('dark')}- title="深色模式"+ title={t('app.themeDark')}><svg className="w-3.5 h-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />@@ -123,7 +153,7 @@ function ThemeToggle() {<buttonclassName={`theme-toggle__button ${theme === 'light' ? 'active' : ''}`}onClick={() => toggleTheme('light')}- title="浅色模式"+ title={t('app.themeLight')}><svg className="w-3.5 h-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><circle cx="12" cy="12" r="5" />@@ -172,6 +202,7 @@ function storeSessionId(sessionId: string | null) {}function AppContent() {+ const { t } = useTranslation();// 优先使用存储的会话 ID,避免每次刷新创建新会话const [sessionId, setSessionId] = useState<string>(() => {const stored = getStoredSessionId();@@ -199,7 +230,7 @@ function AppContent() {const { clearMessages, isProcessing } = useChatStore();const { clearTodos } = useTodoStore();- // WebSocket 连接 - provider 由后端配置决定,前端默认不在 URL query 传递+ // WebSocket 连接 - provider 由后端配置决定 - provider 由后端配置决定,前端默认不在 URL query 传递const {isConnected,request,@@ -263,9 +294,9 @@ function AppContent() {} catch (error) {console.error('Failed to fetch config:', error);setServerConfig(null);- setConfigError('无法通过 WebSocket 获取后端配置,已使用默认配置');+ setConfigError(t('app.configError'));}- }, [request]);+ }, [request, t]);const clearRestartAutoCloseTimer = useCallback(() => {if (restartAutoCloseTimerRef.current != null) {@@ -485,10 +516,13 @@ function AppContent() {<div className="pill"><span className={`statusDot ${isConnected ? 'ok' : ''}`} /><span className="mono text-sm">- {isConnected ? '已连接' : '未连接'}+ {isConnected ? t('connection.connected') : t('connection.disconnected')}</span></div>+ {/* 语言切换 */}+ <LanguageSwitcher />+{/* 主题切换 */}<ThemeToggle /></div>@@ -506,11 +540,11 @@ function AppContent() {{configError && (<div className="card mb-4"><div className="text-sm text-text-muted">- {configError}。请先启动 E2E 后端(如+ {configError}. {t('app.configErrorHint')}<span className="mono"> python -m tests.web_gateway_jiuwenclaw_integration </span>- ,默认监听 19000)。若后端不在本机或端口不同,可在+ {t('app.configErrorDefault')}<span className="mono"> jiuwenclaw/web/.env.local </span>- 设置 <span className="mono">VITE_API_BASE</span> 和 <span className="mono">VITE_WS_BASE</span>。+ {t('app.configErrorEnv')} <span className="mono">VITE_API_BASE</span> {t('common.and')} <span className="mono">VITE_WS_BASE</span>.</div></div>)}@@ -600,7 +634,7 @@ function AppContent() {{!isConnected && (<div className="app-toast-wrapper app-toast-wrapper--top"><div className="app-connection-toast animate-rise">- {serverConfig ? '正在连接服务器...' : '加载配置中...'}+ {serverConfig ? t('connection.connecting') : t('connection.loadingConfig')}</div></div>)}@@ -609,7 +643,7 @@ function AppContent() {{newSessionToastVisible && (<div className="app-toast-wrapper app-toast-wrapper--top-center"><div className="app-session-toast animate-rise">- 已新建会话+ {t('chat.sessionCreated')}</div></div>)}@@ -621,7 +655,7 @@ function AppContent() {<div className="app-heartbeat-toast__header"><div className="app-heartbeat-toast__title"><span className="app-heartbeat-toast__dot animate-pulse" />- <span className="text-xs font-medium text-text">心跳消息</span>+ <span className="text-xs font-medium text-text">{t('app.heartbeatTitle')}</span></div><buttontype="button"@@ -630,7 +664,7 @@ function AppContent() {clearHeartbeatToastTimer();}}className="app-heartbeat-toast__close"- aria-label="关闭"+ aria-label={t('app.heartbeatClose')}><svg className="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={2}><path strokeLinecap="round" strokeLinejoin="round" d="M6 18L18 6M6 6l12 12" />@@ -645,7 +679,7 @@ function AppContent() {clearHeartbeatToastTimer();}}className="app-heartbeat-toast__content text-sm"- title="点击查看完整心跳消息"+ title={t('app.heartbeatViewFull')}><span className="app-heartbeat-toast__preview">{heartbeatToastPreview}@@ -671,14 +705,14 @@ function AppContent() {</div>)}<h3 className="text-base font-semibold text-text mb-1">- {!restartSuccess ? '正在重启服务' : appliedWithoutRestart ? '配置已生效' : '重启成功'}+ {!restartSuccess ? t('app.restarting') : appliedWithoutRestart ? t('app.configApplied') : t('app.restartSuccess')}</h3><p className="text-sm text-text-muted mb-5">{!restartSuccess- ? '正在等待后端重新启动并恢复连接,请稍候...'+ ? t('app.restartWaiting'): appliedWithoutRestart- ? '配置已热更新,窗口将在 5 秒后自动关闭。'- : '后端已启动成功,窗口将在 5 秒后自动关闭。'}+ ? t('app.configAppliedDesc')+ : t('app.restartSuccessDesc')}</p>{restartSuccess && (<button@@ -686,7 +720,7 @@ function AppContent() {onClick={closeRestartModal}className="btn primary !px-4 !py-2">- 确定+ {t('common.ok')}</button>)}</div>diff --git a/jiuwenclaw/web/src/components/AgentPanel/FileViewer.tsx b/jiuwenclaw/web/src/components/AgentPanel/FileViewer.tsxindex 02afd0e716..d2673a14f7 100644--- a/jiuwenclaw/web/src/components/AgentPanel/FileViewer.tsx+++ b/jiuwenclaw/web/src/components/AgentPanel/FileViewer.tsx@@ -1,4 +1,5 @@import { useState, useEffect } from 'react';+import { useTranslation } from 'react-i18next';import ReactMarkdown from 'react-markdown';interface FileViewerProps {@@ -7,6 +8,7 @@ interface FileViewerProps {}export function FileViewer({ filePath, fileName }: FileViewerProps) {+ const { t } = useTranslation();const [content, setContent] = useState<string>('');const [draftContent, setDraftContent] = useState<string>('');const [loading, setLoading] = useState(false);@@ -51,8 +53,8 @@ export function FileViewer({ filePath, fileName }: FileViewerProps) {setContent(text);setDraftContent(text);} catch (err) {- console.error('文件加载失败:', err);- setError(err instanceof Error ? err.message : '未知错误');+ console.error('Failed to load file:', err);+ setError(err instanceof Error ? err.message : t('fileViewer.unknownError'));} finally {setLoading(false);}@@ -96,8 +98,8 @@ export function FileViewer({ filePath, fileName }: FileViewerProps) {setContent(draftContent);setIsEditing(false);} catch (err) {- console.error('文件保存失败:', err);- setSaveError(err instanceof Error ? err.message : '未知错误');+ console.error('Failed to save file:', err);+ setSaveError(err instanceof Error ? err.message : t('fileViewer.unknownError'));} finally {setSaving(false);}@@ -130,7 +132,7 @@ export function FileViewer({ filePath, fileName }: FileViewerProps) {onClick={handleCancelEdit}disabled={saving}>- 取消+ {t('common.cancel')}</button><buttontype="button"@@ -138,7 +140,7 @@ export function FileViewer({ filePath, fileName }: FileViewerProps) {onClick={handleSave}disabled={saving}>- {saving ? '保存中...' : '保存'}+ {saving ? t('common.saving') : t('common.save')}</button></>) : (@@ -147,7 +149,7 @@ export function FileViewer({ filePath, fileName }: FileViewerProps) {className="btn !px-3 !py-1.5"onClick={handleStartEdit}>- 编辑+ {t('fileViewer.edit')}</button>)}</div>@@ -160,7 +162,7 @@ export function FileViewer({ filePath, fileName }: FileViewerProps) {) : null}{fileNotFound ? (<div className="mt-2 rounded-md border border-warning/30 bg-warning/10 px-2.5 py-1.5 text-xs text-warning">- 文件不存在。请先在 <span className="mono">{filePath}</span> 创建该 Markdown 文件后再编辑。+ {t('fileViewer.fileMissingPrefix')} <span className="mono">{filePath}</span> {t('fileViewer.fileMissingSuffix')}</div>) : null}{saveError ? (@@ -190,10 +192,10 @@ export function FileViewer({ filePath, fileName }: FileViewerProps) {)) : (<div className="h-full flex items-center justify-center text-text-muted text-sm">- 该文件无法预览,仅支持 Markdown(.md/.mdx)文件+ {t('fileViewer.notPreviewable')}</div>)}</div></div>);-}\ No newline at end of file+}diff --git a/jiuwenclaw/web/src/components/AgentPanel/index.tsx b/jiuwenclaw/web/src/components/AgentPanel/index.tsxindex 5222504de9..f95278c97b 100644--- a/jiuwenclaw/web/src/components/AgentPanel/index.tsx+++ b/jiuwenclaw/web/src/components/AgentPanel/index.tsx@@ -1,4 +1,5 @@import { useEffect, useMemo, useState } from 'react';+import { useTranslation } from 'react-i18next';import { FileViewer } from './FileViewer';import { containsIgnoredDirectory } from '../../features/fileTreeFilters';@@ -38,8 +39,8 @@ interface TreeData {const compareByName = (a: string, b: string) => a.localeCompare(b, 'zh-Hans-CN');-const getFolderDisplayName = (folderKey: string) => {- if (folderKey === ROOT_FOLDER_KEY) return '根目录';+const getFolderDisplayName = (folderKey: string, t: (key: string) => string) => {+ if (folderKey === ROOT_FOLDER_KEY) return t('agent.root');const segments = folderKey.split('/').filter(Boolean);return segments[segments.length - 1] || folderKey;};@@ -78,7 +79,7 @@ const filterFolderData = (data: Record<string, FileInfo[]>) =>]),);-const buildTreeData = (data: Record<string, FileInfo[]>): TreeData => {+const buildTreeData = (data: Record<string, FileInfo[]>, t: (key: string) => string): TreeData => {const directoryKeys = new Set<string>([ROOT_FOLDER_KEY]);const sourceFolderKeys = Object.keys(data);@@ -101,7 +102,7 @@ const buildTreeData = (data: Record<string, FileInfo[]>): TreeData => {directoryKeys.forEach((folderKey) => {directoryMap.set(folderKey, {key: folderKey,- label: getFolderDisplayName(folderKey),+ label: getFolderDisplayName(folderKey, t),isSkillFolder: isSkillFolder(folderKey),childDirectoryKeys: [],files: [],@@ -128,7 +129,7 @@ const buildTreeData = (data: Record<string, FileInfo[]>): TreeData => {});directoryMap.forEach((node) => {- node.childDirectoryKeys.sort((a, b) => compareByName(getFolderDisplayName(a), getFolderDisplayName(b)));+ node.childDirectoryKeys.sort((a, b) => compareByName(getFolderDisplayName(a, t), getFolderDisplayName(b, t)));});const rootNode = directoryMap.get(ROOT_FOLDER_KEY);@@ -138,7 +139,7 @@ const buildTreeData = (data: Record<string, FileInfo[]>): TreeData => {...rootChildDirectoryKeys.map((key) => ({kind: 'directory' as const,key,- label: getFolderDisplayName(key),+ label: getFolderDisplayName(key, t),})),...rootFiles.map((file) => ({kind: 'file' as const,@@ -163,6 +164,7 @@ const buildTreeData = (data: Record<string, FileInfo[]>): TreeData => {};export function AgentPanel({ sessionId: _sessionId }: AgentPanelProps) {+ const { t } = useTranslation();const [folderData, setFolderData] = useState<Record<string, FileInfo[]>>({});const [loading, setLoading] = useState(true);const [refreshing, setRefreshing] = useState(false);@@ -195,7 +197,7 @@ export function AgentPanel({ sessionId: _sessionId }: AgentPanelProps) {setFolderData(data);setLoadError(null);- const nextTreeData = buildTreeData(data);+ const nextTreeData = buildTreeData(data, t);setSelectedFile((prev) => {if (!prev) {return null;@@ -215,12 +217,12 @@ export function AgentPanel({ sessionId: _sessionId }: AgentPanelProps) {return next;});} catch (err) {- console.error('读取文件列表失败:', err);+ console.error('Failed to load agent files:', err);setFolderData({});if (err instanceof Error && err.message.startsWith('REBUILD_FAILED:')) {- setLoadError('刷新失败:无法重建 agent 文件索引,请检查生成脚本日志。');+ setLoadError(t('agent.errors.refreshFailed'));} else {- setLoadError('无法读取 agent 文件列表,请检查 workspace/agent-data.json 是否已生成。');+ setLoadError(t('agent.errors.loadFailed'));}} finally {setLoading(false);@@ -237,7 +239,7 @@ export function AgentPanel({ sessionId: _sessionId }: AgentPanelProps) {void loadFolderData({ rebuildBeforeFetch: true });};- const treeData = useMemo(() => buildTreeData(folderData), [folderData]);+ const treeData = useMemo(() => buildTreeData(folderData, t), [folderData, t]);const expandFolderAndAncestors = (folderKey: string) => {setExpandedKeys((prev) => {@@ -356,7 +358,7 @@ export function AgentPanel({ sessionId: _sessionId }: AgentPanelProps) {<span className="flex-1 min-w-0 truncate">{file.name}</span>{!file.isMarkdown ? (<span className="text-[10px] px-1.5 py-0.5 rounded border border-border bg-secondary/40">- 不可预览+ {t('agent.notPreviewable')}</span>) : null}</button>@@ -373,19 +375,19 @@ export function AgentPanel({ sessionId: _sessionId }: AgentPanelProps) {<div className="card w-full h-full flex flex-col"><div className="flex items-center justify-between mb-3"><div>- <h2 className="text-lg font-semibold">智能体管理</h2>- <p className="text-sm text-text-muted mt-1">查看智能体工作区文件与记忆内容</p>+ <h2 className="text-lg font-semibold">{t('agent.title')}</h2>+ <p className="text-sm text-text-muted mt-1">{t('agent.subtitle')}</p></div><div className="flex items-center gap-2"><div className="flex items-center gap-2 text-xs text-text-muted"><span className="mono px-2.5 py-1 rounded-full border border-border bg-secondary/60">- {treeData.directoryCount} 个目录+ {t('agent.directoryCount', { count: treeData.directoryCount })}</span><span className="mono px-2.5 py-1 rounded-full border border-border bg-secondary/60">- {treeData.totalFileCount} 个文件+ {t('agent.fileCount', { count: treeData.totalFileCount })}</span><span className="mono px-2.5 py-1 rounded-full border border-border bg-secondary/60">- {treeData.markdownFileCount} 个可预览+ {t('agent.previewableCount', { count: treeData.markdownFileCount })}</span></div></div>@@ -402,9 +404,9 @@ export function AgentPanel({ sessionId: _sessionId }: AgentPanelProps) {<div className="px-4 py-3 bg-secondary/30 border-b border-border"><div className="flex items-start justify-between gap-4"><div>- <h3 className="text-sm font-medium text-text">工作区</h3>+ <h3 className="text-sm font-medium text-text">{t('agent.workspace')}</h3><p className="text-xs text-text-muted mt-1 mono">- {treeData.directoryCount} 个目录,{treeData.totalFileCount} 个文件+ {t('agent.workspaceMeta', { directories: treeData.directoryCount, files: treeData.totalFileCount })}</p></div><button@@ -412,15 +414,15 @@ export function AgentPanel({ sessionId: _sessionId }: AgentPanelProps) {onClick={handleRefresh}disabled={refreshing}className="btn !px-3 !py-1.5 disabled:opacity-50 disabled:cursor-not-allowed"- title="刷新列表"+ title={t('agent.refresh')}>- {refreshing ? '刷新中...' : '刷新'}+ {refreshing ? t('common.refreshing') : t('common.refresh')}</button></div></div><div className="flex-1 overflow-auto p-2">{treeData.rootChildDirectoryKeys.length === 0 && treeData.rootFiles.length === 0 ? (- <div className="h-full flex items-center justify-center text-sm text-text-muted">暂无文件</div>+ <div className="h-full flex items-center justify-center text-sm text-text-muted">{t('agent.empty')}</div>) : (<div className="space-y-0.5">{treeData.rootEntries.map((entry) => {@@ -455,7 +457,7 @@ export function AgentPanel({ sessionId: _sessionId }: AgentPanelProps) {<span className="flex-1 min-w-0 truncate">{file.name}</span>{!file.isMarkdown ? (<span className="text-[10px] px-1.5 py-0.5 rounded border border-border bg-secondary/40">- 不可预览+ {t('agent.notPreviewable')}</span>) : null}</button>@@ -479,15 +481,15 @@ export function AgentPanel({ sessionId: _sessionId }: AgentPanelProps) {</svg></span><div>- <h4 className="text-sm font-medium text-text">内容预览</h4>- <p className="text-xs text-text-muted mt-1">选择左侧 Markdown 文件查看</p>+ <h4 className="text-sm font-medium text-text">{t('agent.contentPreview')}</h4>+ <p className="text-xs text-text-muted mt-1">{t('agent.selectMarkdown')}</p></div></div></div><div className="flex-1 min-h-0 flex items-center justify-center"><div className="text-center text-text-muted">- <div className="mb-2 text-sm">请选择左侧 Markdown 文件查看内容</div>- <div className="text-xs mono">仅支持 Markdown(.md/.mdx)预览</div>+ <div className="mb-2 text-sm">{t('agent.selectMarkdownContent')}</div>+ <div className="text-xs mono">{t('agent.markdownOnly')}</div></div></div></>@@ -497,4 +499,4 @@ export function AgentPanel({ sessionId: _sessionId }: AgentPanelProps) {</div></div>);-}\ No newline at end of file+}diff --git a/jiuwenclaw/web/src/components/BrowserPanel/index.tsx b/jiuwenclaw/web/src/components/BrowserPanel/index.tsxindex df702e6a05..730bed6d37 100644--- a/jiuwenclaw/web/src/components/BrowserPanel/index.tsx+++ b/jiuwenclaw/web/src/components/BrowserPanel/index.tsx@@ -1,4 +1,5 @@import { useCallback, useEffect, useMemo, useState } from 'react';+import { useTranslation } from 'react-i18next';interface BrowserPathPayload {chrome_path?: unknown;@@ -27,6 +28,7 @@ function normalizeReturnCode(payload: unknown): number | null {}export function BrowserPanel({ isConnected, request }: BrowserPanelProps) {+ const { t } = useTranslation();const [chromePath, setChromePath] = useState('');const [initialPath, setInitialPath] = useState('');const [loading, setLoading] = useState(false);@@ -57,12 +59,12 @@ export function BrowserPanel({ isConnected, request }: BrowserPanelProps) {setChromePath(value);setInitialPath(value);} catch (loadError) {- const message = loadError instanceof Error ? loadError.message : '加载 Chrome 路径失败';+ const message = loadError instanceof Error ? loadError.message : t('browser.errors.loadPath');setError(message);} finally {setLoading(false);}- }, [request]);+ }, [request, t]);useEffect(() => {void loadPath();@@ -90,9 +92,9 @@ export function BrowserPanel({ isConnected, request }: BrowserPanelProps) {const savedPath = normalizeChromePath(payload) || nextPath;setChromePath(savedPath);setInitialPath(savedPath);- setSuccess('Chrome 路径已保存');+ setSuccess(t('browser.success.pathSaved'));} catch (saveError) {- const message = saveError instanceof Error ? saveError.message : '保存 Chrome 路径失败';+ const message = saveError instanceof Error ? saveError.message : t('browser.errors.savePath');setError(message);} finally {setSaving(false);@@ -109,7 +111,7 @@ export function BrowserPanel({ isConnected, request }: BrowserPanelProps) {}if (hasChanges) {clearFeedback();- setError('请先保存 Chrome 路径后再启动浏览器服务');+ setError(t('browser.errors.saveBeforeStart'));return;}setStarting(true);@@ -119,13 +121,13 @@ export function BrowserPanel({ isConnected, request }: BrowserPanelProps) {const payload = await request<BrowserStartPayload>('browser.start');const returncode = normalizeReturnCode(payload);if (returncode === null || returncode === 0) {- setSuccess('浏览器服务启动成功');+ setSuccess(t('browser.success.started'));} else {- setError(`浏览器服务启动失败,返回码 ${returncode}`);+ setError(t('browser.errors.startFailedWithCode', { code: returncode }));}} catch (startError) {- const message = startError instanceof Error ? startError.message : '启动浏览器服务失败';- setError(`浏览器服务启动失败:${message}`);+ const message = startError instanceof Error ? startError.message : t('browser.errors.startFailed');+ setError(t('browser.errors.startFailedWithMessage', { message }));} finally {setStarting(false);}@@ -136,9 +138,9 @@ export function BrowserPanel({ isConnected, request }: BrowserPanelProps) {<div className="card w-full h-full flex flex-col"><div className="flex items-center justify-between gap-4 mb-4"><div>- <h2 className="text-lg font-semibold">浏览器服务</h2>+ <h2 className="text-lg font-semibold">{t('browser.title')}</h2><p className="text-sm text-text-muted mt-1">- 配置浏览器路径,启动浏览器服务。+ {t('browser.subtitle')}</p></div><div className="flex items-center gap-2">@@ -148,7 +150,7 @@ export function BrowserPanel({ isConnected, request }: BrowserPanelProps) {disabled={saving || starting}className="btn !px-3 !py-1.5 disabled:opacity-50 disabled:cursor-not-allowed">- {loading ? '刷新中...' : '刷新路径'}+ {loading ? t('common.refreshing') : t('browser.refreshPath')}</button></div></div>@@ -166,7 +168,7 @@ export function BrowserPanel({ isConnected, request }: BrowserPanelProps) {<div className="rounded-xl border border-border bg-card/70 backdrop-blur-sm overflow-hidden shadow-sm"><div className="px-4 py-3 border-b border-border bg-secondary/30">- <span className="text-xs text-text-muted tracking-wider font-medium">CHROME 路径配置(Chrome地址栏输入:chrome://version查看,复制可执行文件路径)</span>+ <span className="text-xs text-text-muted tracking-wider font-medium">{t('browser.pathConfigHelp')}</span></div><div className="p-4 space-y-4"><label className="block space-y-1.5">@@ -179,14 +181,14 @@ export function BrowserPanel({ isConnected, request }: BrowserPanelProps) {if (error) setError(null);if (showPathError) setShowPathError(false);}}- placeholder="例如:/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"+ placeholder={t('browser.examplePath')}className="w-full rounded-md border border-border bg-bg px-3 py-2 text-[13px] text-text outline-none focus:border-accent"disabled={loading || saving || starting}/></label>{showPathError && !isPathValid ? (- <div className="text-xs text-danger">Chrome 路径不能为空</div>+ <div className="text-xs text-danger">{t('browser.errors.pathRequired')}</div>) : null}<div className="flex items-center gap-2">@@ -199,7 +201,7 @@ export function BrowserPanel({ isConnected, request }: BrowserPanelProps) {}}disabled={!hasChanges || saving || starting}>- 取消+ {t('common.cancel')}</button><buttontype="button"@@ -207,7 +209,7 @@ export function BrowserPanel({ isConnected, request }: BrowserPanelProps) {onClick={() => void handleSave()}disabled={!isConnected || !hasChanges || saving || starting || loading}>- {saving ? '保存中...' : '保存路径'}+ {saving ? t('common.saving') : t('browser.savePath')}</button><buttontype="button"@@ -216,13 +218,13 @@ export function BrowserPanel({ isConnected, request }: BrowserPanelProps) {disabled={!canStart}title={!isPathValid- ? '请先填写 Chrome 路径'+ ? t('browser.tooltips.fillPath'): hasChanges- ? '请先保存 Chrome 路径'+ ? t('browser.tooltips.savePath'): undefined}>- {starting ? '启动中...' : '启动浏览器服务'}+ {starting ? t('browser.starting') : t('browser.startService')}</button></div></div>diff --git a/jiuwenclaw/web/src/components/ChannelsPanel/index.tsx b/jiuwenclaw/web/src/components/ChannelsPanel/index.tsxindex 39a5d51cfe..dcc6423570 100644--- a/jiuwenclaw/web/src/components/ChannelsPanel/index.tsx+++ b/jiuwenclaw/web/src/components/ChannelsPanel/index.tsx@@ -1,4 +1,5 @@import { useCallback, useEffect, useMemo, useState } from 'react';+import { useTranslation } from 'react-i18next';import { webRequest } from '../../services/webClient';import './ChannelsPanel.css';@@ -8,7 +9,6 @@ interface ChannelsPanelProps {type ChannelItem = {channel_id: SupportedChannelId;- label: string;logo_src: string | null;enabled: boolean;};@@ -92,19 +92,19 @@ const DEFAULT_DINGTALK_CONF: DingTalkConfig = {allow_from: [],};-const SUPPORTED_CHANNELS: Array<{ channel_id: SupportedChannelId; label: string; logo_src: string | null }> = [- { channel_id: 'web', label: '网页', logo_src: null },- { channel_id: 'xiaoyi', label: '小艺', logo_src: '/xiaoyi.webp' },- { channel_id: 'feishu', label: '飞书', logo_src: '/feishu.webp' },- { channel_id: 'dingtalk', label: '钉钉', logo_src: '/dingtalk.png' },+const SUPPORTED_CHANNELS: Array<{ channel_id: SupportedChannelId; logo_src: string | null }> = [+ { channel_id: 'web', logo_src: null },+ { channel_id: 'xiaoyi', logo_src: '/xiaoyi.webp' },+ { channel_id: 'feishu', logo_src: '/feishu.webp' },+ { channel_id: 'dingtalk', logo_src: '/dingtalk.png' },];-function formatTime(iso: string | null): string {+function formatTime(iso: string | null, locale: string): string {if (!iso) return '-';const date = new Date(iso);if (Number.isNaN(date.getTime())) return '-';- return date.toLocaleTimeString('zh-CN', { hour12: false });+ return date.toLocaleTimeString(locale, { hour12: false });}function isSensitiveField(field: keyof FeishuDraft): boolean {@@ -147,6 +147,10 @@ function buildChannels(channels: unknown): ChannelItem[] {}));}+function getChannelLabel(t: (key: string) => string, channelId: SupportedChannelId): string {+ return t(`channels.labels.${channelId}`);+}+function normalizeFeishuConfig(input: unknown): FeishuConfig {if (!input || typeof input !== 'object') {return DEFAULT_FEISHU_CONF;@@ -284,12 +288,12 @@ function VisibilityIcon({ visible }: { visible: boolean }) {);}-function ChannelLogo({ channel }: { channel: ChannelItem }) {+function ChannelLogo({ channel, label }: { channel: ChannelItem; label: string }) {if (channel.logo_src) {return (<imgsrc={channel.logo_src}- alt={`${channel.label} logo`}+ alt={`${label} logo`}className="h-6 w-6 rounded-md border border-border object-contain bg-card"/>);@@ -326,6 +330,7 @@ function ChannelHeaderLogo({ channelId, label }: { channelId: SupportedChannelId}export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {+ const { t, i18n } = useTranslation();const [channels, setChannels] = useState<ChannelItem[]>(() => buildChannels([]));const [activeChannelId, setActiveChannelId] = useState<SupportedChannelId>('xiaoyi');const [loadState, setLoadState] = useState<LoadState>('idle');@@ -365,9 +370,9 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {} catch (err) {setChannels(buildChannels([]));setLoadState('error');- setError(err instanceof Error ? err.message : '获取 channels 失败');+ setError(err instanceof Error ? err.message : t('channels.errors.loadChannels'));}- }, []);+ }, [t]);useEffect(() => {void fetchChannels();@@ -384,11 +389,11 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {setDraft(draftFromFeishuConfig(normalized));setVisibleFields({});} catch (err) {- setSaveError(err instanceof Error ? err.message : '获取飞书配置失败');+ setSaveError(err instanceof Error ? err.message : t('channels.errors.loadFeishu'));} finally {setFeishuLoading(false);}- }, []);+ }, [t]);const fetchXiaoyiConfig = useCallback(async () => {setXiaoyiLoading(true);@@ -401,11 +406,11 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {setXiaoyiDraft(draftFromXiaoyiConfig(normalized));setXiaoyiVisibleFields({});} catch (err) {- setXiaoyiSaveError(err instanceof Error ? err.message : '获取小艺配置失败');+ setXiaoyiSaveError(err instanceof Error ? err.message : t('channels.errors.loadXiaoyi'));} finally {setXiaoyiLoading(false);}- }, []);+ }, [t]);const fetchDingtalkConfig = useCallback(async () => {setDingtalkLoading(true);@@ -418,11 +423,11 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {setDingtalkDraft(draftFromDingtalkConfig(normalized));setDingtalkVisibleFields({});} catch (err) {- setDingtalkSaveError(err instanceof Error ? err.message : '获取钉钉配置失败');+ setDingtalkSaveError(err instanceof Error ? err.message : t('channels.errors.loadDingtalk'));} finally {setDingtalkLoading(false);}- }, []);+ }, [t]);const handleSelectChannel = useCallback((channelId: SupportedChannelId) => {@@ -451,13 +456,13 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {const statusText = useMemo(() => {const enabledCount = channels.filter((channel) => channel.enabled).length;if (loadState === 'loading') {- return '加载中...';+ return t('common.loading');}if (loadState === 'error') {- return '加载失败';+ return t('channels.status.loadFailed');}- return `${enabledCount}/${channels.length} 已启用`;- }, [channels, loadState]);+ return t('channels.status.enabledSummary', { enabledCount, total: channels.length });+ }, [channels, loadState, t]);const hasConfigChanges = useMemo(() => {const baseDraft = draftFromFeishuConfig(feishuConfig);@@ -564,9 +569,9 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {const normalized = normalizeFeishuConfig(result?.config);setFeishuConfig(normalized);setDraft(draftFromFeishuConfig(normalized));- setSuccess('飞书配置已保存');+ setSuccess(t('channels.saved.feishu'));} catch (saveErr) {- const message = saveErr instanceof Error ? saveErr.message : '保存失败,请稍后重试';+ const message = saveErr instanceof Error ? saveErr.message : t('channels.errors.saveGeneric');setSaveError(message);} finally {setSaving(false);@@ -583,9 +588,9 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {const normalized = normalizeXiaoyiConfig(result?.config);setXiaoyiConfig(normalized);setXiaoyiDraft(draftFromXiaoyiConfig(normalized));- setXiaoyiSuccess('小艺配置已保存');+ setXiaoyiSuccess(t('channels.saved.xiaoyi'));} catch (saveErr) {- const message = saveErr instanceof Error ? saveErr.message : '保存失败,请稍后重试';+ const message = saveErr instanceof Error ? saveErr.message : t('channels.errors.saveGeneric');setXiaoyiSaveError(message);} finally {setXiaoyiSaving(false);@@ -602,9 +607,9 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {const normalized = normalizeDingtalkConfig(result?.config);setDingtalkConfig(normalized);setDingtalkDraft(draftFromDingtalkConfig(normalized));- setDingtalkSuccess('钉钉配置已保存');+ setDingtalkSuccess(t('channels.saved.dingtalk'));} catch (saveErr) {- const message = saveErr instanceof Error ? saveErr.message : '保存失败,请稍后重试';+ const message = saveErr instanceof Error ? saveErr.message : t('channels.errors.saveGeneric');setDingtalkSaveError(message);} finally {setDingtalkSaving(false);@@ -615,8 +620,8 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {const configErrorNotice = useMemo(() => {return Array.from(new Set([saveError, xiaoyiSaveError, dingtalkSaveError].filter((message): message is string => Boolean(message))),- ).join(';');- }, [dingtalkSaveError, saveError, xiaoyiSaveError]);+ ).join(t('common.and'));+ }, [dingtalkSaveError, saveError, t, xiaoyiSaveError]);useEffect(() => {if (!configErrorNotice) {return;@@ -643,17 +648,17 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {) : null}<div className="flex items-center justify-between gap-4 mb-4"><div>- <h2 className="text-lg font-semibold">频道管理</h2>- <p className="text-sm text-text-muted mt-1">查看并管理频道服务</p>+ <h2 className="text-lg font-semibold">{t('channels.title')}</h2>+ <p className="text-sm text-text-muted mt-1">{t('channels.subtitle')}</p></div><div className="flex items-center gap-2" /></div>{error ? (<div className="border border-[var(--border-danger)] bg-danger-subtle rounded-lg p-4 text-sm text-danger flex items-center justify-between">- <span>获取失败:{error}</span>+ <span>{t('channels.fetchFailed')}: {error}</span><button onClick={() => void fetchChannels()} className="btn !px-3 !py-1.5">- 重试+ {t('channels.retry')}</button></div>) : (@@ -662,9 +667,9 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {<div className="px-4 py-3 bg-secondary/30 border-b border-border"><div className="flex items-start justify-between gap-4"><div>- <h3 className="text-sm font-medium text-text">频道列表</h3>+ <h3 className="text-sm font-medium text-text">{t('channels.listTitle')}</h3><p className="text-xs text-text-muted mt-1 mono">- 频道个数:{statusText},刷新时间:{formatTime(lastUpdatedAt)}+ {t('channels.listMeta', { status: statusText, time: formatTime(lastUpdatedAt, i18n.language) })}</p></div><button@@ -673,7 +678,7 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {className="btn !px-3 !py-1.5 disabled:opacity-50 disabled:cursor-not-allowed"disabled={loadState === 'loading'}>- {loadState === 'loading' ? '刷新中...' : '刷新'}+ {loadState === 'loading' ? t('common.refreshing') : t('common.refresh')}</button></div></div>@@ -687,6 +692,7 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {<div className="space-y-2">{channels.map((channel, index) => {const isAdapting = ADAPTING_CHANNEL_IDS.has(channel.channel_id);+ const label = getChannelLabel(t, channel.channel_id);return (<buttontype="button"@@ -706,8 +712,8 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {<span className="text-xs px-2.5 py-1 rounded-full border border-border bg-secondary text-text-muted font-medium">#{index + 1}</span>- <ChannelLogo channel={channel} />- <span className="text-sm font-medium text-text">{channel.label}</span>+ <ChannelLogo channel={channel} label={label} />+ <span className="text-sm font-medium text-text">{label}</span><span className="mono text-xs px-2.5 py-1 rounded-md border border-border bg-secondary text-text-muted">{channel.channel_id}</span>@@ -721,7 +727,7 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {: 'text-text-muted border-border bg-secondary'}`}>- {isAdapting ? '适配中' : channel.enabled ? '已启用' : '未启用'}+ {isAdapting ? t('channels.status.adapting') : channel.enabled ? t('channels.status.enabled') : t('channels.status.disabled')}</span></div></button>@@ -737,15 +743,15 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {<div className="w-full h-full rounded-xl border border-border bg-card/70 backdrop-blur-sm overflow-hidden shadow-sm flex flex-col"><div className="px-4 py-3 bg-secondary/30 border-b border-border"><div className="flex items-center gap-3">- <ChannelHeaderLogo channelId="web" label="网页" />+ <ChannelHeaderLogo channelId="web" label={getChannelLabel(t, 'web')} /><div>- <h4 className="text-sm font-medium text-text">网页频道参数配置</h4>- <p className="text-xs text-text-muted mt-1">配置网页频道服务相关参数</p>+ <h4 className="text-sm font-medium text-text">{t('channels.config.webTitle')}</h4>+ <p className="text-xs text-text-muted mt-1">{t('channels.config.webSubtitle')}</p></div></div></div><div className="p-4 text-sm text-text-muted flex-1 overflow-auto flex items-center justify-center text-center">- 网页频道暂无配置,点击其他频道加载配置。+ {t('channels.config.webEmpty')}</div></div>) : null}@@ -755,10 +761,10 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {<div className="px-4 py-3 bg-secondary/30 border-b border-border"><div className="flex items-center justify-between gap-4"><div className="flex items-center gap-3">- <ChannelHeaderLogo channelId="xiaoyi" label="小艺" />+ <ChannelHeaderLogo channelId="xiaoyi" label={getChannelLabel(t, 'xiaoyi')} /><div>- <h4 className="text-sm font-medium text-text">小艺频道参数配置</h4>- <p className="text-xs text-text-muted mt-1">配置小艺频道服务相关参数</p>+ <h4 className="text-sm font-medium text-text">{t('channels.config.xiaoyiTitle')}</h4>+ <p className="text-xs text-text-muted mt-1">{t('channels.config.xiaoyiSubtitle')}</p></div></div><div className="flex items-center gap-2">@@ -768,7 +774,7 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {disabled={xiaoyiSaving || isConfigRefreshing}className="btn !px-3 !py-1.5 disabled:opacity-50 disabled:cursor-not-allowed">- {xiaoyiLoading ? '刷新中...' : '刷新'}+ {xiaoyiLoading ? t('common.refreshing') : t('common.refresh')}</button><buttontype="button"@@ -776,7 +782,7 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {disabled={!hasXiaoyiConfigChanges || xiaoyiSaving}className="btn !px-3 !py-1.5 disabled:opacity-50 disabled:cursor-not-allowed">- 取消+ {t('common.cancel')}</button><buttontype="button"@@ -784,7 +790,7 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {disabled={!hasXiaoyiConfigChanges || xiaoyiSaving || !isConnected}className="btn primary !px-3 !py-1.5 disabled:opacity-50 disabled:cursor-not-allowed">- {xiaoyiSaving ? '保存中...' : '保存'}+ {xiaoyiSaving ? t('common.saving') : t('common.save')}</button></div></div>@@ -798,7 +804,7 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {<div className="p-4 pt-3 flex-1 overflow-auto">{xiaoyiLoading ? (- <div className="text-sm text-text-muted">正在加载小艺配置...</div>+ <div className="text-sm text-text-muted">{t('channels.loading.xiaoyi')}</div>) : (<table className="w-full text-sm"><tbody>@@ -831,7 +837,7 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {type={isSensitiveXiaoyiField(field) && !xiaoyiVisibleFields[field] ? 'password' : 'text'}value={xiaoyiDraft[field]}onChange={(e) => handleXiaoyiFieldChange(field, e.target.value)}- placeholder="请输入配置值"+ placeholder={t('channels.placeholders.configValue')}className={`w-full rounded-md border border-border bg-bg px-3 py-2 text-[13px] outline-none focus:border-accent ${isSensitiveXiaoyiField(field) ? 'pr-10' : ''}`}@@ -841,8 +847,8 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {type="button"onClick={() => toggleXiaoyiFieldVisible(field)}className="channels-panel__visibility-toggle"- aria-label={xiaoyiVisibleFields[field] ? '隐藏明文' : '显示明文'}- title={xiaoyiVisibleFields[field] ? '隐藏明文' : '显示明文'}+ aria-label={xiaoyiVisibleFields[field] ? t('channels.hideValue') : t('channels.showValue')}+ title={xiaoyiVisibleFields[field] ? t('channels.hideValue') : t('channels.showValue')}><VisibilityIcon visible={Boolean(xiaoyiVisibleFields[field])} /></button>@@ -863,10 +869,10 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {<div className="px-4 py-3 bg-secondary/30 border-b border-border"><div className="flex items-center justify-between gap-4"><div className="flex items-center gap-3">- <ChannelHeaderLogo channelId="dingtalk" label="钉钉" />+ <ChannelHeaderLogo channelId="dingtalk" label={getChannelLabel(t, 'dingtalk')} /><div>- <h4 className="text-sm font-medium text-text">钉钉频道参数配置</h4>- <p className="text-xs text-text-muted mt-1">配置钉钉频道服务相关参数</p>+ <h4 className="text-sm font-medium text-text">{t('channels.config.dingtalkTitle')}</h4>+ <p className="text-xs text-text-muted mt-1">{t('channels.config.dingtalkSubtitle')}</p></div></div><div className="flex items-center gap-2">@@ -876,7 +882,7 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {disabled={dingtalkSaving || isConfigRefreshing}className="btn !px-3 !py-1.5 disabled:opacity-50 disabled:cursor-not-allowed">- {dingtalkLoading ? '刷新中...' : '刷新'}+ {dingtalkLoading ? t('common.refreshing') : t('common.refresh')}</button><buttontype="button"@@ -884,7 +890,7 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {disabled={!hasDingtalkConfigChanges || dingtalkSaving}className="btn !px-3 !py-1.5 disabled:opacity-50 disabled:cursor-not-allowed">- 取消+ {t('common.cancel')}</button><buttontype="button"@@ -898,7 +904,7 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {}className="btn primary !px-3 !py-1.5 disabled:opacity-50 disabled:cursor-not-allowed">- {dingtalkSaving ? '保存中...' : '保存'}+ {dingtalkSaving ? t('common.saving') : t('common.save')}</button></div></div>@@ -912,7 +918,7 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {<div className="p-4 pt-3 flex-1 overflow-auto">{dingtalkLoading ? (- <div className="text-sm text-text-muted">正在加载钉钉配置...</div>+ <div className="text-sm text-text-muted">{t('channels.loading.dingtalk')}</div>) : (<table className="w-full text-sm"><tbody>@@ -945,7 +951,7 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {type={isSensitiveDingtalkField(field) && !dingtalkVisibleFields[field] ? 'password' : 'text'}value={dingtalkDraft[field]}onChange={(e) => handleDingtalkFieldChange(field, e.target.value)}- placeholder={field === 'client_id' ? '请输入应用 ID' : '请输入应用密钥'}+ placeholder={field === 'client_id' ? t('channels.placeholders.appId') : t('channels.placeholders.appSecret')}className={`w-full rounded-md border border-border bg-bg px-3 py-2 text-[13px] outline-none focus:border-accent ${isSensitiveDingtalkField(field) ? 'pr-10' : ''}`}@@ -955,8 +961,8 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {type="button"onClick={() => toggleDingtalkFieldVisible(field)}className="channels-panel__visibility-toggle"- aria-label={dingtalkVisibleFields[field] ? '隐藏明文' : '显示明文'}- title={dingtalkVisibleFields[field] ? '隐藏明文' : '显示明文'}+ aria-label={dingtalkVisibleFields[field] ? t('channels.hideValue') : t('channels.showValue')}+ title={dingtalkVisibleFields[field] ? t('channels.hideValue') : t('channels.showValue')}><VisibilityIcon visible={Boolean(dingtalkVisibleFields[field])} /></button>@@ -971,7 +977,7 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {<textareavalue={dingtalkDraft.allow_from}onChange={(e) => handleDingtalkFieldChange('allow_from', e.target.value)}- placeholder="每行一个员工 ID(也支持逗号分隔)"+ placeholder={t('channels.placeholders.employeeIds')}rows={4}className="w-full rounded-md border border-border bg-bg px-3 py-2 text-[13px] outline-none focus:border-accent resize-y"/>@@ -989,10 +995,10 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {<div className="px-4 py-3 bg-secondary/30 border-b border-border"><div className="flex items-center justify-between gap-4"><div className="flex items-center gap-3">- <ChannelHeaderLogo channelId="feishu" label="飞书" />+ <ChannelHeaderLogo channelId="feishu" label={getChannelLabel(t, 'feishu')} /><div>- <h4 className="text-sm font-medium text-text">飞书频道参数配置</h4>- <p className="text-xs text-text-muted mt-1">配置飞书频道服务相关参数</p>+ <h4 className="text-sm font-medium text-text">{t('channels.config.feishuTitle')}</h4>+ <p className="text-xs text-text-muted mt-1">{t('channels.config.feishuSubtitle')}</p></div></div><div className="flex items-center gap-2">@@ -1002,7 +1008,7 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {disabled={saving || isConfigRefreshing}className="btn !px-3 !py-1.5 disabled:opacity-50 disabled:cursor-not-allowed">- {feishuLoading ? '刷新中...' : '刷新'}+ {feishuLoading ? t('common.refreshing') : t('common.refresh')}</button><buttontype="button"@@ -1010,7 +1016,7 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {disabled={!hasConfigChanges || saving}className="btn !px-3 !py-1.5 disabled:opacity-50 disabled:cursor-not-allowed">- 取消+ {t('common.cancel')}</button><buttontype="button"@@ -1018,7 +1024,7 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {disabled={!hasConfigChanges || saving || !isConnected || !draft.app_id.trim() || !draft.app_secret.trim()}className="btn primary !px-3 !py-1.5 disabled:opacity-50 disabled:cursor-not-allowed">- {saving ? '保存中...' : '保存'}+ {saving ? t('common.saving') : t('common.save')}</button></div></div>@@ -1032,7 +1038,7 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {<div className="p-4 pt-3 flex-1 overflow-auto">{feishuLoading ? (- <div className="text-sm text-text-muted">正在加载飞书配置...</div>+ <div className="text-sm text-text-muted">{t('channels.loading.feishu')}</div>) : (<table className="w-full text-sm"><tbody>@@ -1065,7 +1071,7 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {type={isSensitiveField(field) && !visibleFields[field] ? 'password' : 'text'}value={draft[field]}onChange={(e) => handleFieldChange(field, e.target.value)}- placeholder={field === 'chat_id' ? '请输入聊天 ID' : '请输入配置值'}+ placeholder={field === 'chat_id' ? t('channels.placeholders.chatId') : t('channels.placeholders.configValue')}className={`w-full rounded-md border border-border bg-bg px-3 py-2 text-[13px] outline-none focus:border-accent ${isSensitiveField(field) ? 'pr-10' : ''}`}@@ -1075,8 +1081,8 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {type="button"onClick={() => toggleFieldVisible(field)}className="channels-panel__visibility-toggle"- aria-label={visibleFields[field] ? '隐藏明文' : '显示明文'}- title={visibleFields[field] ? '隐藏明文' : '显示明文'}+ aria-label={visibleFields[field] ? t('channels.hideValue') : t('channels.showValue')}+ title={visibleFields[field] ? t('channels.hideValue') : t('channels.showValue')}><VisibilityIcon visible={Boolean(visibleFields[field])} /></button>@@ -1091,7 +1097,7 @@ export function ChannelsPanel({ isConnected }: ChannelsPanelProps) {<textareavalue={draft.allow_from}onChange={(e) => handleFieldChange('allow_from', e.target.value)}- placeholder="每行一个 ID(也支持逗号分隔)"+ placeholder={t('channels.placeholders.ids')}rows={4}className="w-full rounded-md border border-border bg-bg px-3 py-2 text-[13px] outline-none focus:border-accent resize-y"/>diff --git a/jiuwenclaw/web/src/components/ChatPanel/InlineQuestionCard.tsx b/jiuwenclaw/web/src/components/ChatPanel/InlineQuestionCard.tsxindex 3f93ac018d..3ee4314191 100644--- a/jiuwenclaw/web/src/components/ChatPanel/InlineQuestionCard.tsx+++ b/jiuwenclaw/web/src/components/ChatPanel/InlineQuestionCard.tsx@@ -7,6 +7,7 @@*/import { useState, useCallback } from 'react';+import { useTranslation } from 'react-i18next';import { useChatStore } from '../../stores';import { UserAnswer } from '../../types';import ReactMarkdown from 'react-markdown';@@ -17,6 +18,7 @@ interface InlineQuestionCardProps {}export function InlineQuestionCard({ onSubmit }: InlineQuestionCardProps) {+ const { t } = useTranslation();const { pendingQuestion, setPendingQuestion } = useChatStore();const [submittedAnswers, setSubmittedAnswers] = useState<Map<string, string>>(new Map());@@ -85,7 +87,7 @@ export function InlineQuestionCard({ onSubmit }: InlineQuestionCardProps) {className="text-xs font-semibold"style={{ color: 'var(--accent)' }}>- {pendingQuestion.questions[0]?.header ?? '演进审批'}+ {pendingQuestion.questions[0]?.header ?? t('chatUi.inlineQuestion.header')}</span></div>@@ -122,13 +124,13 @@ export function InlineQuestionCard({ onSubmit }: InlineQuestionCardProps) {><path strokeLinecap="round" strokeLinejoin="round" d="M4.5 12.75l6 6 9-13.5" /></svg>- 已选择:<span style={{ color: 'var(--text-strong)' }}>{submittedLabel}</span>+ {t('chatUi.inlineQuestion.selected')}: <span style={{ color: 'var(--text-strong)' }}>{submittedLabel}</span></div>) : (<div className="px-4 pb-3 flex flex-col gap-2">{question.options.map((option) => {- const isAccept = option.label === '接收';- const isReject = option.label === '拒绝';+ const isAccept = option.label === t('chatUi.inlineQuestion.accept');+ const isReject = option.label === t('chatUi.inlineQuestion.reject');return (<buttonkey={option.label}diff --git a/jiuwenclaw/web/src/components/ChatPanel/InputArea.tsx b/jiuwenclaw/web/src/components/ChatPanel/InputArea.tsxindex 4cb5e84e5c..2c5784e8a4 100644--- a/jiuwenclaw/web/src/components/ChatPanel/InputArea.tsx+++ b/jiuwenclaw/web/src/components/ChatPanel/InputArea.tsx@@ -1,4 +1,5 @@import { useState, useRef, useCallback, KeyboardEvent, PointerEvent as ReactPointerEvent, useEffect, CSSProperties } from 'react';+import { useTranslation } from 'react-i18next';import { useSpeechRecognition } from '../../hooks';import { stopAllTts } from '../../utils';import { useChatStore, useSessionStore } from '../../stores';@@ -27,17 +28,18 @@ export function InputArea({const isComposingRef = useRef(false);const activePointerIdRef = useRef<number | null>(null);const isVoicePressingRef = useRef(false);+ const { t } = useTranslation();const { isPaused, taskQueue, addToTaskQueue, removeFromTaskQueue } = useChatStore();const { mode } = useSessionStore();const isInterruptible = isProcessing || isPaused;const isAgentMode = mode === 'agent';const modes: Array<{ value: AgentMode; label: string; icon: JSX.Element }> = [- { value: 'plan', label: '任务规划', icon: (+ { value: 'plan', label: t('chat.modePlan'), icon: (<svg className="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2}><path strokeLinecap="round" strokeLinejoin="round" d="M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 002.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 00-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75 2.25 2.25 0 00-.1-.664m-5.8 0A2.251 2.251 0 0113.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25zM6.75 12h.008v.008H6.75V12zm0 3h.008v.008H6.75V15zm0 3h.008v.008H6.75V18z" /></svg>)},- { value: 'agent', label: '智能执行', icon: (+ { value: 'agent', label: t('chat.modeAgent'), icon: (<svg className="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2}><path strokeLinecap="round" strokeLinejoin="round" d="M11.42 15.17L17.25 21A2.652 2.652 0 0021 17.25l-5.877-5.877M11.42 15.17l2.496-3.03c.317-.384.74-.626 1.208-.766M11.42 15.17l-4.655 5.653a2.548 2.548 0 11-3.586-3.586l6.837-5.63m5.108-.233c.55-.164 1.163-.188 1.743-.14a4.5 4.5 0 004.486-6.336l-3.276 3.277a3.004 3.004 0 01-2.25-2.25l3.276-3.276a4.5 4.5 0 00-6.336 4.486c.091 1.076-.071 2.264-.904 2.95l-.102.085m-1.745 1.437L5.909 7.5H4.5L2.25 3.75l1.5-1.5L7.5 4.5v1.409l4.26 4.26m-1.745 1.437l1.745-1.437m6.615 8.206L15.75 15.75M4.867 19.125h.008v.008h-.008v-.008z" /></svg>@@ -222,7 +224,7 @@ export function InputArea({{isListening && (<div className="chat-input-recording-bar"><span className="chat-input-recording-dot" />- <span>正在录音...(松开按钮自动发送)</span>+ <span>{t('chat.recording')}</span></div>)}@@ -233,7 +235,7 @@ export function InputArea({<svg className="w-4 h-4 mr-2" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2}><path strokeLinecap="round" strokeLinejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" /></svg>- 等待任务 ({taskQueue.length})+ {t('chat.waitingTasksCount', { count: taskQueue.length })}</div><div className="chat-input-task-queue-list">{taskQueue.map((task) => (@@ -243,7 +245,7 @@ export function InputArea({type="button"onClick={() => removeFromTaskQueue(task.id)}className="chat-input-task-remove"- title="移除任务"+ title={t('chat.removeTask')}><svg className="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={2}><path strokeLinecap="round" strokeLinejoin="round" d="M6 18L18 6M6 6l12 12" />@@ -265,12 +267,12 @@ export function InputArea({onInput={handleInput}placeholder={isListening- ? '正在听取语音...'+ ? t('chat.placeholderVoice'): isAgentMode && isInterruptible- ? '处理中,输入新指令将加入等待队列...'+ ? t('chat.placeholderProcessingQueue'): isInterruptible- ? '处理中,输入新指令可中断...'- : 'Enter 发送,Shift+Enter 换行,按住语音键开始录音'+ ? t('chat.placeholderProcessing')+ : t('chat.placeholder')}className="chat-input-textarea"rows={1}@@ -314,7 +316,7 @@ export function InputArea({'chat-input-btn',(isListening || isInterruptible) && 'chat-input-btn--disabled',)}- title={isListening || isInterruptible ? '处理中或录音中不可新建' : '新建会话'}+ title={isListening || isInterruptible ? t('chat.newSessionDisabled') : t('chat.newSession')}><svg className="chat-input-btn-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={1.8}><path strokeLinecap="round" strokeLinejoin="round" d="M12 4.5v15m7.5-7.5h-15" />@@ -331,7 +333,7 @@ export function InputArea({'chat-input-btn',isListening && 'chat-input-btn--recording',)}- title="按住说话"+ title={t('chat.holdToSpeak')}>{isListening ? (<svg className="chat-input-btn-icon" fill="currentColor" viewBox="0 0 24 24">@@ -353,7 +355,7 @@ export function InputArea({'chat-input-btn chat-input-btn--send',canSend ? 'chat-input-btn--send-active' : 'chat-input-btn--disabled',)}- title="发送 (Enter)"+ title={t('chat.send')}><svg className="chat-input-btn-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={2}><path strokeLinecap="round" strokeLinejoin="round" d="M4.5 10.5L12 3m0 0l7.5 7.5M12 3v18" />diff --git a/jiuwenclaw/web/src/components/ChatPanel/MessageItem.tsx b/jiuwenclaw/web/src/components/ChatPanel/MessageItem.tsxindex afa699b60e..98fe24b3db 100644--- a/jiuwenclaw/web/src/components/ChatPanel/MessageItem.tsx+++ b/jiuwenclaw/web/src/components/ChatPanel/MessageItem.tsx@@ -5,6 +5,7 @@*/import { useState, useCallback, useEffect, useRef } from 'react';+import { useTranslation } from 'react-i18next';import { Message } from '../../types';import { StreamingContent } from './StreamingContent';import { ToolCallDisplay } from './ToolCallDisplay';@@ -21,6 +22,7 @@ interface MessageItemProps {}export function MessageItem({ message, autoSpeak = false }: MessageItemProps) {+ const { t } = useTranslation();const {role,content,@@ -221,7 +223,7 @@ export function MessageItem({ message, autoSpeak = false }: MessageItemProps) {<buttononClick={handleCopy}className="p-1.5 rounded-md transition-colors hover:text-accent hover:bg-secondary"- title="复制消息"+ title={t('chatUi.copyMessage')}><svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={1.5}><path strokeLinecap="round" strokeLinejoin="round" d="M8.25 6.75h7.5m-7.5 3h7.5m-7.5 3h4.5M6.75 3h7.5A2.25 2.25 0 0116.5 5.25v13.5A2.25 2.25 0 0114.25 21h-7.5A2.25 2.25 0 014.5 18.75V5.25A2.25 2.25 0 016.75 3z" />@@ -238,7 +240,7 @@ export function MessageItem({ message, autoSpeak = false }: MessageItemProps) {? 'text-accent bg-accent/10': 'hover:text-accent hover:bg-secondary')}- title={isPlaying ? '停止朗读' : '朗读消息'}+ title={isPlaying ? t('chatUi.stopReading') : t('chatUi.readMessage')}>{isPlaying ? (<svg className="w-4 h-4" fill="currentColor" viewBox="0 0 24 24">diff --git a/jiuwenclaw/web/src/components/ChatPanel/SubtaskProgress.tsx b/jiuwenclaw/web/src/components/ChatPanel/SubtaskProgress.tsxindex c5f3d04471..fe057e2b74 100644--- a/jiuwenclaw/web/src/components/ChatPanel/SubtaskProgress.tsx+++ b/jiuwenclaw/web/src/components/ChatPanel/SubtaskProgress.tsx@@ -5,9 +5,11 @@*/import { useChatStore } from '../../stores';+import { useTranslation } from 'react-i18next';import clsx from 'clsx';export function SubtaskProgress() {+ const { t } = useTranslation();const { activeSubtasks } = useChatStore();// 将 Map 转换为数组并按 index 排序@@ -30,7 +32,7 @@ export function SubtaskProgress() {<div className="flex items-center gap-2 mb-2"><span className="w-2 h-2 rounded-full bg-info animate-pulse" /><span className="text-sm font-medium text-text-strong">- 并行任务执行中 ({completedCount}/{total} 完成)+ {t('chatUi.parallelProgress', { completedCount, total })}</span></div><div className="space-y-2">@@ -57,6 +59,7 @@ interface SubtaskItemProps {}function SubtaskItem({ subtask }: SubtaskItemProps) {+ const { t } = useTranslation();const getStatusIcon = () => {switch (subtask.status) {case 'starting':@@ -81,11 +84,11 @@ function SubtaskItem({ subtask }: SubtaskItemProps) {const getStatusText = () => {switch (subtask.status) {case 'starting':- return '启动中...';+ return t('chatUi.subtask.starting');case 'tool_call':- return `调用 ${subtask.tool_name || '工具'} (#${subtask.tool_count})`;+ return t('chatUi.subtask.toolCall', { tool: subtask.tool_name || t('chatUi.subtask.toolFallback'), count: subtask.tool_count });case 'tool_result':- return subtask.message ? `${subtask.message.slice(0, 50)}...` : '处理结果...';+ return subtask.message ? `${subtask.message.slice(0, 50)}...` : t('chatUi.subtask.toolResult');default:return subtask.status;}@@ -102,13 +105,13 @@ function SubtaskItem({ subtask }: SubtaskItemProps) {{getStatusIcon()}<div className="flex-1 min-w-0"><div className="font-medium text-text-strong truncate">- 任务 {subtask.index + 1}: {subtask.description}+ {t('chatUi.subtask.taskLabel', { index: subtask.index + 1, description: subtask.description })}</div><div className="text-text-muted truncate">{getStatusText()}</div></div>{subtask.tool_count > 0 && (<span className="text-text-muted text-xs px-1.5 py-0.5 bg-secondary rounded">- {subtask.tool_count} 次调用+ {t('chatUi.subtask.callCount', { count: subtask.tool_count })}</span>)}</div>diff --git a/jiuwenclaw/web/src/components/ChatPanel/ToolCallDisplay.tsx b/jiuwenclaw/web/src/components/ChatPanel/ToolCallDisplay.tsxindex 937ee13b4e..e53f89a04a 100644--- a/jiuwenclaw/web/src/components/ChatPanel/ToolCallDisplay.tsx+++ b/jiuwenclaw/web/src/components/ChatPanel/ToolCallDisplay.tsx@@ -5,6 +5,7 @@*/import { useState } from 'react';+import { useTranslation } from 'react-i18next';import { ToolCall, ToolResult } from '../../types';import { formatToolArguments, formatToolResult } from '../../utils';import clsx from 'clsx';@@ -15,6 +16,7 @@ interface ToolCallDisplayProps {}export function ToolCallDisplay({ toolCall, toolResult }: ToolCallDisplayProps) {+ const { t } = useTranslation();const [isExpanded, setIsExpanded] = useState(false);if (toolCall) {@@ -64,7 +66,7 @@ export function ToolCallDisplay({ toolCall, toolResult }: ToolCallDisplayProps)// 使用格式化的摘要或默认显示const displaySummary = toolResult.summary? toolResult.summary- : `${toolResult.toolName} ${toolResult.success ? '完成' : '失败'}`;+ : `${toolResult.toolName} ${toolResult.success ? t('chatUi.toolResult.success') : t('chatUi.toolResult.failed')}`;return (<div className="chat-tool-card animate-rise">diff --git a/jiuwenclaw/web/src/components/ChatPanel/ToolGroupDisplay.tsx b/jiuwenclaw/web/src/components/ChatPanel/ToolGroupDisplay.tsxindex cd416bbc5c..1575c566b3 100644--- a/jiuwenclaw/web/src/components/ChatPanel/ToolGroupDisplay.tsx+++ b/jiuwenclaw/web/src/components/ChatPanel/ToolGroupDisplay.tsx@@ -10,6 +10,7 @@ import {useRef,useCallback,} from 'react';+import { useTranslation } from 'react-i18next';import { ToolExecution } from '../../types';import { formatToolArguments, formatToolResult } from '../../utils';import clsx from 'clsx';@@ -19,6 +20,7 @@ interface ToolGroupDisplayProps {}export function ToolExecutionItem({ execution }: { execution: ToolExecution }) {+ const { t } = useTranslation();const [isExpanded, setIsExpanded] = useState(false);const { toolCall, result, status } = execution;const subtitle = toolCall.formatted_args || '';@@ -27,7 +29,7 @@ export function ToolExecutionItem({ execution }: { execution: ToolExecution }) {const isError = status === 'error';const isSuccess = status === 'completed';const resultSummary = result- ? (result.summary || `${result.success ? '完成' : '失败'}`)+ ? (result.summary || `${result.success ? t('chatUi.toolResult.success') : t('chatUi.toolResult.failed')}`): '';return (@@ -69,7 +71,7 @@ export function ToolExecutionItem({ execution }: { execution: ToolExecution }) {)}{!hasResult && isTimeout && (<span className="tool-pair-result-badge warning">- 执行超时+ {t('chatUi.toolResult.timeout')}</span>)}<span className="tool-pair-toggle">{isExpanded ? '▼' : '▶'}</span>@@ -79,13 +81,13 @@ export function ToolExecutionItem({ execution }: { execution: ToolExecution }) {<div className="tool-pair-detail">{Object.keys(toolCall.arguments).length > 0 && (<div className="tool-pair-section">- <div className="tool-pair-section-label">参数</div>+ <div className="tool-pair-section-label">{t('chatUi.toolResult.arguments')}</div><pre className="tool-pair-pre">{formatToolArguments(toolCall.arguments)}</pre></div>)}{result && (<div className="tool-pair-section">- <div className="tool-pair-section-label">结果</div>+ <div className="tool-pair-section-label">{t('chatUi.toolResult.result')}</div><pre className={clsx('tool-pair-pre', !result.success && 'error')}>{formatToolResult(result.result, 1000)}</pre>@@ -98,6 +100,7 @@ export function ToolExecutionItem({ execution }: { execution: ToolExecution }) {}export function ToolGroupDisplay({ executions }: ToolGroupDisplayProps) {+ const { t } = useTranslation();const scrollRef = useRef<HTMLDivElement>(null);const [userScrolled, setUserScrolled] = useState(false);const totalPairs = executions.length;@@ -153,9 +156,9 @@ export function ToolGroupDisplay({ executions }: ToolGroupDisplayProps) {<path strokeLinecap="round" strokeLinejoin="round" d="M11.42 15.17L17.25 21A2.652 2.652 0 0021 17.25l-5.877-5.877M11.42 15.17l2.496-3.03c.317-.384.74-.626 1.208-.766M11.42 15.17l-4.655 5.653a2.548 2.548 0 11-3.586-3.586l6.837-5.63m5.108-.233c.55-.164 1.163-.188 1.743-.14a4.5 4.5 0 004.486-6.336l-3.276 3.277a3.004 3.004 0 01-2.25-2.25l3.276-3.276a4.5 4.5 0 00-6.336 4.486c.091 1.076-.071 2.264-.904 2.95l-.102.085m-1.745 1.437L5.909 7.5H4.5L2.25 3.75l1.5-1.5L7.5 4.5v1.409l4.26 4.26m-1.745 1.437l1.745-1.437m6.615 8.206L15.75 15.75M4.867 19.125h.008v.008h-.008v-.008z" /></svg><span>- 已执行 {totalPairs} 次工具调用- {pendingCount > 0 && <span className="tool-group-pending"> ({pendingCount} 个执行中)</span>}- {timeoutCount > 0 && <span className="tool-group-pending warning"> ({timeoutCount} 个超时)</span>}+ {t('chatUi.toolGroup.executed', { totalPairs })}+ {pendingCount > 0 && <span className="tool-group-pending"> ({t('chatUi.toolGroup.pending', { pendingCount })})</span>}+ {timeoutCount > 0 && <span className="tool-group-pending warning"> ({t('chatUi.toolGroup.timeout', { timeoutCount })})</span>}</span></div></div>@@ -168,7 +171,7 @@ export function ToolGroupDisplay({ executions }: ToolGroupDisplayProps) {{userScrolled && (<button className="tool-group-scroll-btn" onClick={scrollToBottom}>- ↓ 最新+ {t('chatUi.toolGroup.latest')}</button>)}</div>diff --git a/jiuwenclaw/web/src/components/ChatPanel/index.tsx b/jiuwenclaw/web/src/components/ChatPanel/index.tsxindex b3f31052a9..9d1078d846 100644--- a/jiuwenclaw/web/src/components/ChatPanel/index.tsx+++ b/jiuwenclaw/web/src/components/ChatPanel/index.tsx@@ -5,6 +5,7 @@*/import { useRef, useEffect, useCallback } from 'react';+import { useTranslation } from 'react-i18next';import { useChatStore } from '../../stores';import { AgentMode, UserAnswer } from '../../types';import { MessageList } from './MessageList';@@ -22,11 +23,6 @@ interface ChatPanelProps {onUserAnswer: (requestId: string, answers: UserAnswer[]) => void;}-const SUGGESTIONS = [- { text: '让我们开启一段新的旅程吧!' },- { text: '能告诉我你有哪些技能吗?' },-];-function ThinkingIndicator() {return (<div className="flex justify-start animate-rise">@@ -65,9 +61,13 @@ export function ChatPanel({onNewSession,onUserAnswer,}: ChatPanelProps) {-+ const { t } = useTranslation();const { messages, isThinking } = useChatStore();const messagesEndRef = useRef<HTMLDivElement>(null);+ const suggestions = [+ t('chat.welcomeSuggestions.journey'),+ t('chat.welcomeSuggestions.skills'),+ ];useEffect(() => {messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });@@ -83,14 +83,14 @@ export function ChatPanel({<div className="flex-1 overflow-y-auto px-3 py-4">{messages.length === 0 ? (<div className="chat-welcome">- <img src="/logo.png" alt="JiuwenClaw" className="chat-welcome__logo" />- <h2 className="chat-welcome__heading">你好,我是JiuwenClaw,很高兴认识你!</h2>+ <img src="/logo.png" alt={t('chat.welcomeLogoAlt')} className="chat-welcome__logo" />+ <h2 className="chat-welcome__heading">{t('chat.welcomeHeading')}</h2><p className="chat-welcome__subtext">- 我可以帮你回答问题,解决疑惑,还可以帮你完成一些任务。+ {t('chat.welcomeSubtext')}</p><div className="chat-suggestions">- {SUGGESTIONS.map((s) => (- <SuggestionCard key={s.text} text={s.text} onClick={() => handleSuggestion(s.text)} />+ {suggestions.map((text) => (+ <SuggestionCard key={text} text={text} onClick={() => handleSuggestion(text)} />))}</div></div>diff --git a/jiuwenclaw/web/src/components/ConfigPanel/index.tsx b/jiuwenclaw/web/src/components/ConfigPanel/index.tsxindex 1ca9263e31..91bb566940 100644--- a/jiuwenclaw/web/src/components/ConfigPanel/index.tsx+++ b/jiuwenclaw/web/src/components/ConfigPanel/index.tsx@@ -1,4 +1,5 @@import { useEffect, useMemo, useState } from "react";+import { useTranslation } from 'react-i18next';interface ConfigPanelProps {config: Record<string, unknown> | null;@@ -31,15 +32,6 @@ function classifyKey(key: string): string {return "other";}-const GROUP_META: Record<string, { label: string; order: number; hint: string }> = {- model: { label: "模型配置", order: 0, hint: "模型服务与鉴权参数" },- embed: { label: "Embed配置", order: 1, hint: "Embed 服务与鉴权参数" },- third_party_api: { label: "第三方服务配置", order: 2, hint: "API Key 配置" },- evolution: { label: "自演进配置", order: 3, hint: "Skills 在线自演进参数" },- email: { label: "邮箱配置", order: 4, hint: "邮件账号与令牌参数" },- other: { label: "其他配置", order: 5, hint: "未归类的扩展参数" },-};-function getGroupIcon(tag: string) {if (tag === "model") {return (@@ -130,6 +122,17 @@ function normalizeConfigValue(value: unknown): string {}}+function getGroupMeta(t: (key: string) => string): Record<string, { label: string; order: number; hint: string }> {+ return {+ model: { label: t('config.groups.model.label'), order: 0, hint: t('config.groups.model.hint') },+ embed: { label: t('config.groups.embed.label'), order: 1, hint: t('config.groups.embed.hint') },+ third_party_api: { label: t('config.groups.thirdParty.label'), order: 2, hint: t('config.groups.thirdParty.hint') },+ evolution: { label: t('config.groups.evolution.label'), order: 3, hint: t('config.groups.evolution.hint') },+ email: { label: t('config.groups.email.label'), order: 4, hint: t('config.groups.email.hint') },+ other: { label: t('config.groups.other.label'), order: 5, hint: t('config.groups.other.hint') },+ };+}+function isRequiredModelField(key: string): boolean {return REQUIRED_MODEL_FIELD_SET.has(key);}@@ -139,16 +142,19 @@ function GroupSection({draftValues,onChange,defaultOpen,+ t,}: {group: ConfigGroup;draftValues: Record<string, string>;onChange: (key: string, value: string) => void;defaultOpen: boolean;+ t: (key: string, options?: Record<string, unknown>) => string;}) {const [open, setOpen] = useState(defaultOpen);const [visibleFields, setVisibleFields] = useState<Record<string, boolean>>({});const toneClass = getGroupToneClass(group.tag);- const hint = GROUP_META[group.tag]?.hint ?? "参数分组";+ const groupMeta = getGroupMeta(t);+ const hint = groupMeta[group.tag]?.hint ?? t('config.groupFallback');const toggleFieldVisible = (key: string) => {setVisibleFields((prev) => ({ ...prev, [key]: !prev[key] }));@@ -171,7 +177,7 @@ function GroupSection({</span><span className="flex items-center gap-2 text-text-muted ml-3"><span className="text-[11px] px-2 py-0.5 rounded-full border border-border bg-secondary/60">- {group.keys.length} 项+ {t('config.itemsCount', { count: group.keys.length })}</span><svgclassName={`w-4 h-4 transition-transform ${open ? "rotate-180" : ""}`}@@ -233,7 +239,7 @@ function GroupSection({onChange={(e) => onChange(key, e.target.value)}className="w-full rounded-md border border-border bg-bg px-3 py-2 text-[13px] outline-none focus:border-accent">- <option value="" disabled>请选择模型提供商</option>+ <option value="" disabled>{t('config.selectModelProvider')}</option><option value="OpenAI">OpenAI</option><option value="DashScope">DashScope</option><option value="SiliconFlow">SiliconFlow</option>@@ -255,7 +261,7 @@ function GroupSection({type={isSensitiveKey(key) && !visibleFields[key] ? "password" : "text"}value={draftValues[key] ?? value}onChange={(e) => onChange(key, e.target.value)}- placeholder="请输入配置值"+ placeholder={t('config.enterValue')}className={`w-full rounded-md border border-border bg-bg px-3 py-2 text-[13px] outline-none focus:border-accent ${isSensitiveKey(key) ? "pr-10" : ""}`}/>{isSensitiveKey(key) ? (@@ -263,8 +269,8 @@ function GroupSection({type="button"onClick={() => toggleFieldVisible(key)}className="absolute inset-y-0 right-0 flex items-center justify-center w-9 text-text-muted hover:text-text transition-colors"- aria-label={visibleFields[key] ? "隐藏明文" : "显示明文"}- title={visibleFields[key] ? "隐藏明文" : "显示明文"}+ aria-label={visibleFields[key] ? t('config.hideValue') : t('config.showValue')}+ title={visibleFields[key] ? t('config.hideValue') : t('config.showValue')}>{visibleFields[key] ? (<svg className="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={1.8}>@@ -296,6 +302,7 @@ function GroupSection({}export function ConfigPanel({ config, isConnected, onSaveConfig }: ConfigPanelProps) {+ const { t } = useTranslation();const [draftValues, setDraftValues] = useState<Record<string, string>>({});const [saving, setSaving] = useState(false);const [error, setError] = useState<string | null>(null);@@ -328,10 +335,11 @@ export function ConfigPanel({ config, isConnected, onSaveConfig }: ConfigPanelPrfor (const entries of Object.values(buckets)) {entries.sort(([a], [b]) => a.localeCompare(b));}+ const groupMeta = getGroupMeta(t);return Object.entries(buckets)- .map(([tag, keys]) => ({ tag, label: GROUP_META[tag]?.label ?? tag, keys, order: GROUP_META[tag]?.order ?? 99 }))+ .map(([tag, keys]) => ({ tag, label: groupMeta[tag]?.label ?? tag, keys, order: groupMeta[tag]?.order ?? 99 })).sort((a, b) => a.order - b.order);- }, [normalizedConfig]);+ }, [normalizedConfig, t]);const totalItems = useMemo(() => groups.reduce((sum, group) => sum + group.keys.length, 0), [groups]);const hasChanges = useMemo(() => {const keys = Object.keys(normalizedConfig);@@ -359,7 +367,7 @@ export function ConfigPanel({ config, isConnected, onSaveConfig }: ConfigPanelPrconst handleSaveAndRestart = async () => {if (!hasChanges || saving) return;if (hasMissingRequiredModelFields) {- setError(`模型配置为必填:${missingRequiredModelFields.join("、")}。请完整填写后再保存并重启。`);+ setError(t('config.errors.requiredModelFields', { fields: missingRequiredModelFields.join('、') }));return;}setSaving(true);@@ -367,7 +375,7 @@ export function ConfigPanel({ config, isConnected, onSaveConfig }: ConfigPanelPrtry {await onSaveConfig(draftValues);} catch (saveError) {- const message = saveError instanceof Error ? saveError.message : "保存失败,请稍后重试";+ const message = saveError instanceof Error ? saveError.message : t('config.errors.saveFailed');setError(message);} finally {setSaving(false);@@ -379,9 +387,9 @@ export function ConfigPanel({ config, isConnected, onSaveConfig }: ConfigPanelPr<div className="card w-full h-full flex flex-col"><div className="flex items-center justify-between gap-4 mb-4"><div>- <h2 className="text-lg font-semibold">配置信息</h2>+ <h2 className="text-lg font-semibold">{t('config.title')}</h2><p className="text-sm text-text-muted mt-1">- 修改后端服务配置,保存后后端将自动重启以加载最新配置。+ {t('config.subtitle')}</p></div><div className="flex items-center gap-2">@@ -391,7 +399,7 @@ export function ConfigPanel({ config, isConnected, onSaveConfig }: ConfigPanelPrdisabled={!hasChanges || saving}className="btn !px-3 !py-1.5 disabled:opacity-50 disabled:cursor-not-allowed">- 取消+ {t('common.cancel')}</button><buttontype="button"@@ -399,7 +407,7 @@ export function ConfigPanel({ config, isConnected, onSaveConfig }: ConfigPanelPrdisabled={!hasChanges || saving || !isConnected || hasMissingRequiredModelFields}className="btn primary !px-3 !py-1.5 disabled:opacity-50 disabled:cursor-not-allowed">- {saving ? "保存中..." : "保存"}+ {saving ? t('common.saving') : t('common.save')}</button></div></div>@@ -410,19 +418,19 @@ export function ConfigPanel({ config, isConnected, onSaveConfig }: ConfigPanelPr) : null}{!error && hasMissingRequiredModelFields ? (<div className="mb-4 rounded-md border border-[var(--border-danger)] bg-danger-subtle px-3 py-2 text-sm text-danger">- 模型配置必填项未完成:{missingRequiredModelFields.join("、")}+ {t('config.requiredIncomplete')}: {missingRequiredModelFields.join('、')}</div>) : null}{!groups.length ? (<div className="text-sm text-text-muted flex-1 min-h-0">- 暂未获取到配置,请确认后端服务状态。+ {t('config.empty')}</div>) : (<div className="space-y-3 flex-1 min-h-0 overflow-auto pr-1"><div className="flex items-center justify-between text-xs text-text-muted px-1">- <span>共 {groups.length} 个配置组</span>- <span className="mono">{totalItems} 项参数</span>+ <span>{t('config.groupsCount', { count: groups.length })}</span>+ <span className="mono">{t('config.paramsCount', { count: totalItems })}</span></div>{groups.map((group) => (<GroupSection@@ -431,6 +439,7 @@ export function ConfigPanel({ config, isConnected, onSaveConfig }: ConfigPanelPrdraftValues={draftValues}onChange={handleFieldChange}defaultOpen={group.tag === "model"}+ t={t}/>))}</div>diff --git a/jiuwenclaw/web/src/components/CronPanel/index.tsx b/jiuwenclaw/web/src/components/CronPanel/index.tsxindex 154fa78632..b5788c1e12 100644--- a/jiuwenclaw/web/src/components/CronPanel/index.tsx+++ b/jiuwenclaw/web/src/components/CronPanel/index.tsx@@ -5,6 +5,7 @@*/import { useState, useEffect, useCallback } from 'react';+import { useTranslation } from 'react-i18next';import { webRequest } from '../../services/webClient';@@ -36,6 +37,7 @@ interface UpdateCronJob {}export default function CronPanel() {+ const { t } = useTranslation();const [cronJobs, setCronJobs] = useState<CronJob[]>([]);const [loading, setLoading] = useState(true);const [error, setError] = useState<string | null>(null);@@ -69,10 +71,10 @@ export default function CronPanel() {// 目标选项const targetOptions = [- { value: 'web', label: '网页 (web)' },- { value: 'feishu', label: '飞书 (feishu)' },- { value: 'xiaoyi', label: '小艺 (xiaoyi)', disabled: true, style: { color: '#8c8c96ff' } },- { value: 'dingtalk', label: '钉钉 (dingtalk)', disabled: true, style: { color: '#8c8c96ff' } }+ { value: 'web', label: t('cron.targets.web') },+ { value: 'feishu', label: t('cron.targets.feishu') },+ { value: 'xiaoyi', label: t('cron.targets.xiaoyi'), disabled: true, style: { color: '#8c8c96ff' } },+ { value: 'dingtalk', label: t('cron.targets.dingtalk'), disabled: true, style: { color: '#8c8c96ff' } }];// 加载任务列表@@ -83,14 +85,14 @@ export default function CronPanel() {const payload = await webRequest<{ jobs: CronJob[] }>('cron.job.list');setCronJobs(payload.jobs || []);} catch (loadError) {- const message = loadError instanceof Error ? loadError.message : '加载定时任务失败';+ const message = loadError instanceof Error ? loadError.message : t('cron.errors.loadJobs');setError(message);// 加载失败时使用空数组setCronJobs([]);} finally {setLoading(false);}- }, []);+ }, [t]);// 初始化加载useEffect(() => {@@ -110,29 +112,29 @@ export default function CronPanel() {const handleCreateJob = async () => {// 检查必填字段if (!newJob.name) {- setError('任务名称不能为空');+ setError(t('cron.errors.nameRequired'));return;}if (!newJob.cron_expr) {- setError('Cron 表达式不能为空');+ setError(t('cron.errors.cronRequired'));return;}if (!newJob.timezone) {- setError('时区不能为空');+ setError(t('cron.errors.timezoneRequired'));return;}if (!newJob.targets) {- setError('推送频道不能为空');+ setError(t('cron.errors.targetRequired'));return;}if (!newJob.description) {- setError('描述不能为空');+ setError(t('cron.errors.descriptionRequired'));return;}try {await webRequest<{ job: CronJob }>('cron.job.create', newJob);- setSuccess('任务创建成功');+ setSuccess(t('cron.success.created'));setIsCreating(false);setNewJob({name: '',@@ -145,7 +147,7 @@ export default function CronPanel() {});await loadJobs();} catch (createError) {- const message = createError instanceof Error ? createError.message : '创建任务失败';+ const message = createError instanceof Error ? createError.message : t('cron.errors.createFailed');setError(message);}};@@ -157,24 +159,24 @@ export default function CronPanel() {id,enabled: !enabled});- setSuccess('任务状态更新成功');+ setSuccess(t('cron.success.statusUpdated'));await loadJobs();} catch (toggleError) {- const message = toggleError instanceof Error ? toggleError.message : '更新任务状态失败';+ const message = toggleError instanceof Error ? toggleError.message : t('cron.errors.toggleFailed');setError(message);}};// 删除任务const handleDeleteJob = async (id: string) => {- if (!window.confirm('确定要删除这个任务吗?')) return;+ if (!window.confirm(t('cron.deleteConfirm'))) return;try {await webRequest<{ deleted: boolean }>('cron.job.delete', { id });- setSuccess('任务删除成功');+ setSuccess(t('cron.success.deleted'));await loadJobs();} catch (deleteError) {- const message = deleteError instanceof Error ? deleteError.message : '删除任务失败';+ const message = deleteError instanceof Error ? deleteError.message : t('cron.errors.deleteFailed');setError(message);}};@@ -188,7 +190,7 @@ export default function CronPanel() {setEditJob(payload.job as UpdateCronJob);setEditingJobId(id);} catch (viewError) {- const message = viewError instanceof Error ? viewError.message : '获取任务详情失败';+ const message = viewError instanceof Error ? viewError.message : t('cron.errors.loadDetailFailed');setError(message);}};@@ -199,23 +201,23 @@ export default function CronPanel() {// 检查必填字段if (!editJob.name) {- setError('任务名称不能为空');+ setError(t('cron.errors.nameRequired'));return;}if (!editJob.cron_expr) {- setError('Cron 表达式不能为空');+ setError(t('cron.errors.cronRequired'));return;}if (!editJob.timezone) {- setError('时区不能为空');+ setError(t('cron.errors.timezoneRequired'));return;}if (!editJob.targets) {- setError('推送频道不能为空');+ setError(t('cron.errors.targetRequired'));return;}if (!editJob.description) {- setError('描述不能为空');+ setError(t('cron.errors.descriptionRequired'));return;}@@ -235,12 +237,12 @@ export default function CronPanel() {};await webRequest<{ job: CronJob }>('cron.job.update', updateData);- setSuccess('任务更新成功');+ setSuccess(t('cron.success.updated'));setEditingJobId(null);setEditJob(null);await loadJobs();} catch (updateError) {- const message = updateError instanceof Error ? updateError.message : '更新任务失败';+ const message = updateError instanceof Error ? updateError.message : t('cron.errors.updateFailed');setError(message);}};@@ -258,14 +260,14 @@ export default function CronPanel() {<div className="card w-full h-full flex flex-col"><div className="flex items-center justify-between gap-4 mb-4"><div>- <h2 className="text-lg font-semibold">定时任务管理</h2>- <p className="text-sm text-text-muted mt-1">使用 cron 表达式管理定时任务,支持添加、启用和删除操作</p>+ <h2 className="text-lg font-semibold">{t('cron.title')}</h2>+ <p className="text-sm text-text-muted mt-1">{t('cron.subtitle')}</p></div><buttononClick={() => setIsCreating(!isCreating)}className="btn primary !px-4 !py-2">- {isCreating ? '取消创建' : '创建任务'}+ {isCreating ? t('cron.cancelCreate') : t('cron.create')}</button></div>@@ -278,21 +280,21 @@ export default function CronPanel() {{loading ? (<div className="rounded-lg border border-border bg-secondary/30 px-3 py-4 flex items-center justify-center">- 正在加载任务列表...+ {t('cron.loading')}</div>) : (<div className="overflow-auto rounded-lg border border-border max-h-[750px]"><table className="w-full border-collapse"><thead><tr className="border-b border-border sticky top-0 bg-bg">- <th className="px-4 py-3 text-left text-sm font-medium text-text-muted w-[120px]">任务名称</th>- <th className="px-4 py-3 text-left text-sm font-medium text-text-muted w-[400px]">Cron 表达式</th>- <th className="px-4 py-3 text-left text-sm font-medium text-text-muted">状态</th>- <th className="px-4 py-3 text-left text-sm font-medium text-text-muted w-[300px]">描述</th>- <th className="px-4 py-3 text-left text-sm font-medium text-text-muted w-[120px]">唤醒偏移秒数</th>- <th className="px-4 py-3 text-left text-sm font-medium text-text-muted">时区</th>- <th className="px-4 py-3 text-left text-sm font-medium text-text-muted">推送频道</th>- <th className="px-4 py-3 text-right text-sm font-medium text-text-muted">操作</th>+ <th className="px-4 py-3 text-left text-sm font-medium text-text-muted w-[120px]">{t('cron.columns.name')}</th>+ <th className="px-4 py-3 text-left text-sm font-medium text-text-muted w-[400px]">{t('cron.columns.cron')}</th>+ <th className="px-4 py-3 text-left text-sm font-medium text-text-muted">{t('cron.columns.status')}</th>+ <th className="px-4 py-3 text-left text-sm font-medium text-text-muted w-[300px]">{t('cron.columns.description')}</th>+ <th className="px-4 py-3 text-left text-sm font-medium text-text-muted w-[120px]">{t('cron.columns.wakeOffset')}</th>+ <th className="px-4 py-3 text-left text-sm font-medium text-text-muted">{t('cron.columns.timezone')}</th>+ <th className="px-4 py-3 text-left text-sm font-medium text-text-muted">{t('cron.columns.target')}</th>+ <th className="px-4 py-3 text-right text-sm font-medium text-text-muted">{t('cron.columns.actions')}</th></tr></thead><tbody>@@ -305,7 +307,7 @@ export default function CronPanel() {value={newJob.name}onChange={(e) => setNewJob({ ...newJob, name: e.target.value })}className="w-full rounded-md border border-border bg-bg px-3 py-2 text-[13px] text-text outline-none focus:border-accent"- placeholder="输入任务名称"+ placeholder={t('cron.placeholders.name')}/></td><td className="px-4 py-3">@@ -314,12 +316,12 @@ export default function CronPanel() {value={newJob.cron_expr}onChange={(e) => setNewJob({ ...newJob, cron_expr: e.target.value })}className="w-full rounded-md border border-border bg-bg px-3 py-2 text-[13px] text-text outline-none focus:border-accent"- placeholder="5段式:分 时 日 月 周。例:每周一11时58分='58 11 * * 1'"+ placeholder={t('cron.placeholders.cron')}/></td><td className="px-4 py-3"><div className="flex items-center justify-between">- <span className="text-sm">{newJob.enabled ? '启用' : '禁用'}</span>+ <span className="text-sm">{newJob.enabled ? t('cron.status.enabled') : t('cron.status.disabled')}</span><divclassName="relative inline-block w-10 h-6 align-middle select-none rounded-full cursor-pointer"onClick={() => setNewJob({ ...newJob, enabled: !newJob.enabled })}@@ -338,7 +340,7 @@ export default function CronPanel() {value={newJob.description}onChange={(e) => setNewJob({ ...newJob, description: e.target.value })}className="w-full rounded-md border border-border bg-bg px-3 py-2 text-[13px] text-text outline-none focus:border-accent"- placeholder="输入描述"+ placeholder={t('cron.placeholders.description')}/></td><td className="px-4 py-3">@@ -347,7 +349,7 @@ export default function CronPanel() {value={newJob.wake_offset_seconds}onChange={(e) => setNewJob({ ...newJob, wake_offset_seconds: parseInt(e.target.value) || 0 })}className="w-full rounded-md border border-border bg-bg px-3 py-2 text-[13px] text-text outline-none focus:border-accent"- placeholder="唤醒偏移秒数"+ placeholder={t('cron.placeholders.wakeOffset')}/></td><td className="px-4 py-3">@@ -393,13 +395,13 @@ export default function CronPanel() {}}className="px-2 py-1 text-sm border border-gray-300 bg-white text-gray-600 rounded hover:bg-gray-50">- 取消+ {t('common.cancel')}</button><buttononClick={handleCreateJob}className="px-2 py-1 text-sm bg-blue-500 text-white rounded hover:bg-blue-600">- 创建+ {t('cron.create')}</button></div></td>@@ -415,7 +417,7 @@ export default function CronPanel() {value={editJob.name}onChange={(e) => setEditJob({ ...editJob, name: e.target.value })}className="w-full rounded-md border border-border bg-bg px-3 py-2 text-[13px] text-text outline-none focus:border-accent"- placeholder="输入任务名称"+ placeholder={t('cron.placeholders.name')}/></td><td className="px-4 py-3">@@ -424,12 +426,12 @@ export default function CronPanel() {value={editJob.cron_expr}onChange={(e) => setEditJob({ ...editJob, cron_expr: e.target.value })}className="w-full rounded-md border border-border bg-bg px-3 py-2 text-[13px] text-text outline-none focus:border-accent"- placeholder="例:58 11 * * 1"+ placeholder={t('cron.placeholders.cronShort')}/></td><td className="px-4 py-3"><div className="flex items-center justify-between">- <span className="text-sm">{editJob.enabled ? '启用' : '禁用'}</span>+ <span className="text-sm">{editJob.enabled ? t('cron.status.enabled') : t('cron.status.disabled')}</span><divclassName="relative inline-block w-10 h-6 align-middle select-none rounded-full cursor-pointer"onClick={() => setEditJob({ ...editJob, enabled: !editJob.enabled })}@@ -448,7 +450,7 @@ export default function CronPanel() {value={editJob.description || ''}onChange={(e) => setEditJob({ ...editJob, description: e.target.value })}className="w-full rounded-md border border-border bg-bg px-3 py-2 text-[13px] text-text outline-none focus:border-accent"- placeholder="输入描述"+ placeholder={t('cron.placeholders.description')}/></td><td className="px-4 py-3">@@ -457,7 +459,7 @@ export default function CronPanel() {value={editJob.wake_offset_seconds}onChange={(e) => setEditJob({ ...editJob, wake_offset_seconds: parseInt(e.target.value) || 0 })}className="w-full rounded-md border border-border bg-bg px-3 py-2 text-[13px] text-text outline-none focus:border-accent"- placeholder="唤醒偏移秒数"+ placeholder={t('cron.placeholders.wakeOffset')}/></td><td className="px-4 py-3">@@ -495,13 +497,13 @@ export default function CronPanel() {}}className="px-2 py-1 text-sm border border-gray-300 bg-white text-gray-600 rounded hover:bg-gray-50">- 取消+ {t('common.cancel')}</button><buttononClick={handleSubmitUpdate}className="px-2 py-1 text-sm bg-blue-500 text-white rounded hover:bg-blue-600">- 更新+ {t('cron.update')}</button></div></td>@@ -512,7 +514,7 @@ export default function CronPanel() {{cronJobs.length === 0 ? (<tr><td colSpan={8} className="px-4 py-8 text-center text-text-muted">- 暂无定时任务+ {t('cron.empty')}</td></tr>) : (@@ -526,7 +528,7 @@ export default function CronPanel() {<td className="px-4 py-3 text-sm mono">{job.cron_expr}</td><td className="px-4 py-3"><span className={`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${job.enabled ? 'bg-green-100 text-green-700' : 'bg-gray-100 text-gray-700'}`}>- {job.enabled ? '启用' : '禁用'}+ {job.enabled ? t('cron.status.enabled') : t('cron.status.disabled')}</span></td><td className="px-4 py-3 text-sm text-text-muted">@@ -549,19 +551,19 @@ export default function CronPanel() {onClick={() => handleToggleJob(job.id, job.enabled)}className={`px-2 py-1 text-sm rounded hover:bg-opacity-90 ${job.enabled ? 'bg-red-500 text-white hover:bg-red-600' : 'bg-blue-500 text-white'}`}>- {job.enabled ? '停用' : '启动'}+ {job.enabled ? t('cron.disable') : t('cron.enable')}</button><buttononClick={() => handleUpdateJob(job.id)}className="px-2 py-1 text-sm bg-blue-500 text-white rounded hover:bg-blue-600">- 更新+ {t('cron.update')}</button><buttononClick={() => handleDeleteJob(job.id)}className="px-2 py-1 text-sm bg-blue-500 text-white rounded hover:bg-blue-600">- 删除+ {t('cron.delete')}</button></div></td>@@ -578,4 +580,4 @@ export default function CronPanel() {</div>);-}\ No newline at end of file+}diff --git a/jiuwenclaw/web/src/components/HeartbeatPanel/index.tsx b/jiuwenclaw/web/src/components/HeartbeatPanel/index.tsxindex 2aabc4b268..04465ada74 100644--- a/jiuwenclaw/web/src/components/HeartbeatPanel/index.tsx+++ b/jiuwenclaw/web/src/components/HeartbeatPanel/index.tsx@@ -1,4 +1,5 @@import { useCallback, useEffect, useMemo, useState } from 'react';+import { useTranslation } from 'react-i18next';import { FileViewer } from '../AgentPanel/FileViewer';import { HeartbeatMessageModal } from '../../features/HeartbeatMessageModal';import { webRequest } from '../../services/webClient';@@ -58,6 +59,7 @@ function isValidTime(text: string): boolean {}export function HeartbeatPanel() {+ const { t, i18n } = useTranslation();const { isConnected, heartbeatState, heartbeatMessage, heartbeatUpdatedAt, heartbeatHistory } = useSessionStore();const [modalOpen, setModalOpen] = useState(false);const [modalMessage, setModalMessage] = useState('');@@ -91,12 +93,12 @@ export function HeartbeatPanel() {setActiveHoursEnabled(false);}} catch (loadError) {- const message = loadError instanceof Error ? loadError.message : '加载心跳配置失败';+ const message = loadError instanceof Error ? loadError.message : t('heartbeat.errors.loadConfig');setError(message);} finally {setLoading(false);}- }, []);+ }, [t]);useEffect(() => {void loadConf();@@ -117,21 +119,21 @@ export function HeartbeatPanel() {const heartbeatBadge = useMemo(() => {if (heartbeatState === 'ok') {return {- text: '最近心跳正常',+ text: t('heartbeat.badges.ok'),className: 'text-ok border-[var(--border-ok)] bg-ok-subtle',};}if (heartbeatState === 'alert') {return {- text: '最近心跳告警',+ text: t('heartbeat.badges.alert'),className: 'text-danger border-[var(--border-danger)] bg-danger-subtle',};}return {- text: '尚无心跳结果',+ text: t('heartbeat.badges.unknown'),className: 'text-text-muted border-border bg-secondary/50',};- }, [heartbeatState]);+ }, [heartbeatState, t]);const hasChanges = useMemo(() => {if (Number(everyInput) !== conf.every) {@@ -175,17 +177,17 @@ export function HeartbeatPanel() {}const every = Number(everyInput);if (!Number.isFinite(every) || every <= 0) {- setError('心跳间隔 every 必须是大于 0 的数字');+ setError(t('heartbeat.errors.invalidEvery'));return;}if (activeHoursEnabled) {if (!isValidTime(startInput) || !isValidTime(endInput)) {- setError('active_hours 需使用 HH:MM 格式(例如 08:00)');+ setError(t('heartbeat.errors.invalidActiveHours'));return;}// 验证结束时间大于开始时间if (endInput <= startInput) {- setError('结束时间必须大于开始时间');+ setError(t('heartbeat.errors.invalidRange'));return;}}@@ -218,14 +220,14 @@ export function HeartbeatPanel() {} else {setActiveHoursEnabled(false);}- setSuccess('心跳参数已保存');+ setSuccess(t('heartbeat.saved'));} catch (saveError) {- const message = saveError instanceof Error ? saveError.message : '保存心跳配置失败';+ const message = saveError instanceof Error ? saveError.message : t('heartbeat.errors.saveConfig');setError(message);} finally {setSaving(false);}- }, [activeHoursEnabled, endInput, everyInput, saving, startInput, targetInput]);+ }, [activeHoursEnabled, endInput, everyInput, saving, startInput, t, targetInput]);const openMessageModal = useCallback((message: string) => {setModalMessage(message);@@ -256,8 +258,8 @@ export function HeartbeatPanel() {) : null}<div className="flex items-center justify-between gap-4 mb-4"><div>- <h2 className="text-lg font-semibold">心跳管理</h2>- <p className="text-sm text-text-muted mt-1">维护心跳参数与指令文件</p>+ <h2 className="text-lg font-semibold">{t('heartbeat.title')}</h2>+ <p className="text-sm text-text-muted mt-1">{t('heartbeat.subtitle')}</p></div><div className="flex items-center gap-2"><span className={`mono px-2.5 py-1 rounded-full border text-xs ${heartbeatBadge.className}`}>@@ -271,8 +273,8 @@ export function HeartbeatPanel() {<div className="px-4 py-3 bg-secondary/30 border-b border-border"><div className="flex items-start justify-between gap-4"><div>- <h3 className="text-sm font-medium text-text">心跳参数配置</h3>- <p className="text-xs text-text-muted mt-1">配置心跳间隔、目标频道与生效时间</p>+ <h3 className="text-sm font-medium text-text">{t('heartbeat.configTitle')}</h3>+ <p className="text-xs text-text-muted mt-1">{t('heartbeat.configSubtitle')}</p></div><div className="flex items-center gap-2"><button@@ -281,7 +283,7 @@ export function HeartbeatPanel() {onClick={() => void loadConf()}disabled={saving}>- 刷新+ {t('common.refresh')}</button><buttontype="button"@@ -289,7 +291,7 @@ export function HeartbeatPanel() {onClick={resetDraft}disabled={loading || saving || !hasChanges}>- 取消+ {t('common.cancel')}</button><buttontype="button"@@ -297,7 +299,7 @@ export function HeartbeatPanel() {onClick={() => void saveConf()}disabled={loading || saving || !hasChanges || !isConnected}>- {saving ? '保存中...' : '保存'}+ {saving ? t('common.saving') : t('common.save')}</button></div></div>@@ -305,7 +307,7 @@ export function HeartbeatPanel() {<div className="flex-1 min-h-0 p-4 flex flex-col gap-3 text-sm text-text-muted">{loading ? (<div className="rounded-lg border border-border bg-secondary/30 px-3 py-2">- 正在加载心跳配置...+ {t('heartbeat.loadingConfig')}</div>) : null}@@ -318,7 +320,7 @@ export function HeartbeatPanel() {{!loading ? (<><label className="block space-y-1.5">- <span className="text-xs uppercase tracking-wide text-text-muted">间隔时间 (秒)</span>+ <span className="text-xs uppercase tracking-wide text-text-muted">{t('heartbeat.everyLabel')}</span><inputtype="number"min={1}@@ -330,16 +332,16 @@ export function HeartbeatPanel() {</label><label className="block space-y-1.5">- <span className="text-xs uppercase tracking-wide text-text-muted">目标频道 (channel_id)</span>+ <span className="text-xs uppercase tracking-wide text-text-muted">{t('heartbeat.targetLabel')}</span><selectvalue={targetInput}onChange={(event) => setTargetInput(event.target.value)}className="w-full rounded-md border border-border bg-bg px-3 py-2 text-[13px] text-text outline-none focus:border-accent">- <option value="web">网页 (web)</option>- <option value="feishu">飞书 (feishu)</option>- <option value="xiaoyi" disabled style={{ color: '#8c8c96ff'}} >小艺 (xiaoyi)</option>- <option value="dingtalk" disabled style={{ color: '#8c8c96ff' }}>钉钉 (dingtalk)</option>+ <option value="web">{t('heartbeat.channels.web')}</option>+ <option value="feishu">{t('heartbeat.channels.feishu')}</option>+ <option value="xiaoyi" disabled style={{ color: '#8c8c96ff'}}>{t('heartbeat.channels.xiaoyi')}</option>+ <option value="dingtalk" disabled style={{ color: '#8c8c96ff' }}>{t('heartbeat.channels.dingtalk')}</option></select></label>@@ -351,11 +353,11 @@ export function HeartbeatPanel() {onChange={(event) => setActiveHoursEnabled(event.target.checked)}className="rounded border-border"/>- <span className="text-sm text-text">启用生效时间</span>+ <span className="text-sm text-text">{t('heartbeat.enableActiveHours')}</span></label><div className="grid grid-cols-2 gap-2"><label className="space-y-1">- <span className="text-xs text-text-muted">开始时间</span>+ <span className="text-xs text-text-muted">{t('heartbeat.startTime')}</span><inputtype="time"value={startInput}@@ -369,7 +371,7 @@ export function HeartbeatPanel() {/></label><label className="space-y-1">- <span className="text-xs text-text-muted">结束时间</span>+ <span className="text-xs text-text-muted">{t('heartbeat.endTime')}</span><inputtype="time"value={endInput}@@ -387,12 +389,12 @@ export function HeartbeatPanel() {<div className="rounded-lg border border-border bg-secondary/20 p-3 flex-1 min-h-0 flex flex-col"><div className="flex items-center justify-between mb-2">- <p className="text-xs uppercase tracking-wide text-text-muted">最近 20 条心跳消息</p>+ <p className="text-xs uppercase tracking-wide text-text-muted">{t('heartbeat.recentMessages')}</p><span className="mono text-[11px] text-text-muted">{heartbeatHistory.length}/20</span></div>{heartbeatHistory.length === 0 ? (<div className="flex-1 min-h-0 rounded-md border border-border bg-card/40 flex items-center justify-center">- <p className="text-xs text-text-muted">暂无历史心跳消息</p>+ <p className="text-xs text-text-muted">{t('heartbeat.noHistory')}</p></div>) : (<div className="flex-1 min-h-0 overflow-auto pr-1">@@ -412,13 +414,13 @@ export function HeartbeatPanel() {: 'text-text-muted border-border bg-secondary/60'}`}>- {item.status === 'unknown' ? 'UNKNOWN' : 'OK'}+ {item.status === 'unknown' ? t('heartbeat.statusUnknown') : t('heartbeat.statusOk')}</span><div className="min-w-0 flex-1"><p className="text-[13px] text-text leading-snug overflow-hidden text-ellipsis whitespace-nowrap">{getMessagePreview(item.message)}</p>- <p className="text-[11px] text-text-muted mt-0.5">{new Date(item.updatedAt).toLocaleString()}</p>+ <p className="text-[11px] text-text-muted mt-0.5">{new Date(item.updatedAt).toLocaleString(i18n.language)}</p></div></button>))}@@ -430,12 +432,12 @@ export function HeartbeatPanel() {) : null}<div className="text-xs text-text-muted space-y-1">- <p>最近心跳时间:{heartbeatUpdatedAt ? new Date(heartbeatUpdatedAt).toLocaleString() : '暂无'}</p>+ <p>{t('heartbeat.latestTime')}:{heartbeatUpdatedAt ? new Date(heartbeatUpdatedAt).toLocaleString(i18n.language) : t('heartbeat.none')}</p><pclassName="block w-full max-w-full overflow-hidden text-ellipsis whitespace-nowrap"title={heartbeatMessage ?? 'HEARTBEAT_UNKNOWN'}>- 最近心跳内容:{heartbeatMessage ? getMessagePreview(heartbeatMessage) : 'HEARTBEAT_UNKNOWN'}+ {t('heartbeat.latestContent')}:{heartbeatMessage ? getMessagePreview(heartbeatMessage) : 'HEARTBEAT_UNKNOWN'}</p></div>diff --git a/jiuwenclaw/web/src/components/LogsPanel/index.tsx b/jiuwenclaw/web/src/components/LogsPanel/index.tsxindex 377b8d0361..4d42bcaaff 100644--- a/jiuwenclaw/web/src/components/LogsPanel/index.tsx+++ b/jiuwenclaw/web/src/components/LogsPanel/index.tsx@@ -1,4 +1,5 @@import { useCallback, useEffect, useMemo, useRef, useState } from 'react';+import { useTranslation } from 'react-i18next';interface LogsPanelProps {isConnected: boolean;@@ -52,6 +53,7 @@ function isDebugLogEntry(entry: unknown): boolean {}export function LogsPanel({ isConnected: _isConnected }: LogsPanelProps) {+ const { t } = useTranslation();const [entries, setEntries] = useState<unknown[]>([]);const [loading, setLoading] = useState(false);const [error, setError] = useState<string | null>(null);@@ -67,34 +69,34 @@ export function LogsPanel({ isConnected: _isConnected }: LogsPanelProps) {const response = await fetch(`/file-api/file-content?path=${filePath}`);if (!response.ok) {const detail = await response.text();- throw new Error(`读取日志失败(HTTP ${response.status})${detail ? `: ${detail.slice(0, 120)}` : ''}`);+ throw new Error(`${t('logsPanel.errors.readLogs')} (HTTP ${response.status})${detail ? `: ${detail.slice(0, 120)}` : ''}`);}const raw = await response.text();setEntries(parseJsonlTail(raw, 300));setError(null);} catch (err) {- setError(err instanceof Error ? err.message : '读取日志失败');+ setError(err instanceof Error ? err.message : t('logsPanel.errors.readLogs'));} finally {setLoading(false);}- }, []);+ }, [t]);const fetchWsDebugConfig = useCallback(async () => {setWsConfigLoading(true);try {const response = await fetch('/file-api/ws-debug-config');if (!response.ok) {- throw new Error(`读取 WS 调试配置失败(HTTP ${response.status})`);+ throw new Error(`${t('logsPanel.errors.readDebugConfig')} (HTTP ${response.status})`);}const payload = (await response.json()) as { wsDisableCompress?: boolean };setWsDisableCompress(Boolean(payload.wsDisableCompress));} catch (err) {- setError(err instanceof Error ? err.message : '读取 WS 调试配置失败');+ setError(err instanceof Error ? err.message : t('logsPanel.errors.readDebugConfig'));} finally {setWsConfigLoading(false);}- }, []);+ }, [t]);const toggleWsDisableCompress = useCallback(async () => {const nextValue = !wsDisableCompress;@@ -111,18 +113,18 @@ export function LogsPanel({ isConnected: _isConnected }: LogsPanelProps) {});if (!response.ok) {const detail = await response.text();- throw new Error(`更新 WS 调试配置失败(HTTP ${response.status})${detail ? `: ${detail.slice(0, 120)}` : ''}`);+ throw new Error(`${t('logsPanel.errors.updateDebugConfig')} (HTTP ${response.status})${detail ? `: ${detail.slice(0, 120)}` : ''}`);}const payload = (await response.json()) as { wsDisableCompress?: boolean };setWsDisableCompress(Boolean(payload.wsDisableCompress));setError(null);window.dispatchEvent(new CustomEvent(WS_RECONNECT_EVENT));} catch (err) {- setError(err instanceof Error ? err.message : '更新 WS 调试配置失败');+ setError(err instanceof Error ? err.message : t('logsPanel.errors.updateDebugConfig'));} finally {setWsConfigLoading(false);}- }, [wsDisableCompress]);+ }, [t, wsDisableCompress]);useEffect(() => {void fetchLogs();@@ -161,9 +163,9 @@ export function LogsPanel({ isConnected: _isConnected }: LogsPanelProps) {<div className="card w-full h-full flex flex-col"><div className="flex items-center justify-between gap-4 mb-4"><div>- <h2 className="text-lg font-semibold">日志</h2>+ <h2 className="text-lg font-semibold">{t('logsPanel.title')}</h2><p className="text-sm text-text-muted mt-1">- 数据源:<span className="mono text-xs">logs/ws-dev.log</span>+ {t('logsPanel.dataSource')}: <span className="mono text-xs">logs/ws-dev.log</span></p></div><div className="flex items-center gap-2">@@ -173,19 +175,19 @@ export function LogsPanel({ isConnected: _isConnected }: LogsPanelProps) {disabled={wsConfigLoading}>{wsConfigLoading- ? '调试模式设置中...'+ ? t('logsPanel.debugSetting'): wsDisableCompress- ? '调试模式开'- : '调试模式关'}+ ? t('logsPanel.debugOn')+ : t('logsPanel.debugOff')}</button><buttononClick={() => setAutoRefresh((prev) => !prev)}className={`btn ${autoRefresh ? 'primary' : ''} !px-3 !py-1.5`}>- {autoRefresh ? '自动刷新开' : '自动刷新关'}+ {autoRefresh ? t('logsPanel.autoRefreshOn') : t('logsPanel.autoRefreshOff')}</button><button onClick={() => void fetchLogs()} className="btn !px-3 !py-1.5">- 刷新+ {t('common.refresh')}</button></div></div>@@ -195,17 +197,17 @@ export function LogsPanel({ isConnected: _isConnected }: LogsPanelProps) {) : (<div className="border border-border rounded-lg bg-secondary/30 flex-1 min-h-0 flex flex-col"><div className="px-3 py-2 text-xs text-text-muted border-b border-border flex items-center justify-between">- <span>最近日志(最多 300 条)</span>+ <span>{t('logsPanel.recentLogs')}</span><span>{loading- ? '加载中...'+ ? t('common.loading'): wsDisableCompress- ? `${visibleEntries.length} 条`- : `${visibleEntries.length} 条(总 ${entries.length} 条)`}+ ? t('logsPanel.countVisible', { count: visibleEntries.length })+ : t('logsPanel.countVisibleTotal', { visible: visibleEntries.length, total: entries.length })}</span></div><pre ref={preRef} className="m-0 p-3 text-xs mono overflow-auto flex-1 min-h-0 whitespace-pre-wrap break-all">- {content || '暂无日志'}+ {content || t('logsPanel.empty')}</pre></div>)}@@ -213,4 +215,3 @@ export function LogsPanel({ isConnected: _isConnected }: LogsPanelProps) {</div>);}-diff --git a/jiuwenclaw/web/src/components/SessionSidebar/OffloadFilesWidget.tsx b/jiuwenclaw/web/src/components/SessionSidebar/OffloadFilesWidget.tsxindex a678aa4dce..f59884438b 100644--- a/jiuwenclaw/web/src/components/SessionSidebar/OffloadFilesWidget.tsx+++ b/jiuwenclaw/web/src/components/SessionSidebar/OffloadFilesWidget.tsx@@ -1,4 +1,5 @@import { useCallback, useEffect, useMemo, useState } from 'react';+import { useTranslation } from 'react-i18next';import {OffloadFileListResponse,OffloadFileContentResponse,@@ -15,6 +16,7 @@ interface SelectedFile {}export function OffloadFilesWidget({ sessionId }: OffloadFilesWidgetProps) {+ const { t } = useTranslation();const [isExpanded, setIsExpanded] = useState(true);const [files, setFiles] = useState<string[]>([]);const [isLoading, setIsLoading] = useState(false);@@ -42,12 +44,12 @@ export function OffloadFilesWidget({ sessionId }: OffloadFilesWidgetProps) {setFiles(data.files || []);} catch (error) {console.error('Failed to fetch offload files:', error);- setLoadError('获取离线文件失败');+ setLoadError(t('offloadFiles.errors.loadFiles'));setFiles([]);} finally {setIsLoading(false);}- }, [isSessionReady, sessionId]);+ }, [isSessionReady, sessionId, t]);useEffect(() => {if (isExpanded) {@@ -81,12 +83,12 @@ export function OffloadFilesWidget({ sessionId }: OffloadFilesWidgetProps) {setSelectedFile({ filename, content: data.content || '' });} catch (error) {console.error('Failed to load offload file:', error);- setContentError('加载失败');+ setContentError(t('offloadFiles.errors.loadContent'));} finally {setIsContentLoading(false);}},- [isSessionReady, sessionId]+ [isSessionReady, sessionId, t]);const handleCloseModal = useCallback(() => {@@ -127,10 +129,10 @@ export function OffloadFilesWidget({ sessionId }: OffloadFilesWidgetProps) {</div><div><div className="text-xs font-semibold text-text-strong">- Offload Files+ {t('offloadFiles.title')}</div><div className="text-[11px] text-text-muted">- {isSessionReady ? `${files.length} 个文件` : '未连接会话'}+ {isSessionReady ? t('offloadFiles.count', { count: files.length }) : t('offloadFiles.notConnected')}</div></div></div>@@ -166,7 +168,7 @@ export function OffloadFilesWidget({ sessionId }: OffloadFilesWidgetProps) {<div className="max-h-40 overflow-y-auto">{isLoading && (<div className="px-3 py-2 text-xs text-text-muted">- 加载中...+ {t('common.loading')}</div>)}{!isLoading && loadError && (@@ -174,7 +176,7 @@ export function OffloadFilesWidget({ sessionId }: OffloadFilesWidgetProps) {)}{!isLoading && !loadError && files.length === 0 && (<div className="px-3 py-2 text-xs text-text-muted">- 暂无离线文件+ {t('offloadFiles.empty')}</div>)}{!isLoading &&@@ -246,6 +248,8 @@ function OffloadFileModal({errorMessage,onClose,}: OffloadFileModalProps) {+ const { t } = useTranslation();+if (!isOpen) {return null;}@@ -292,10 +296,10 @@ function OffloadFileModal({className="text-lg font-semibold truncate"style={{ color: 'var(--text-strong)' }}>- {filename || '离线文件内容'}+ {filename || t('offloadFiles.previewFallback')}</h2><p className="text-sm" style={{ color: 'var(--muted)' }}>- 离线消息文件预览+ {t('offloadFiles.previewTitle')}</p></div></div>@@ -308,7 +312,7 @@ function OffloadFileModal({}}>{isLoading && (- <div className="text-sm text-text-muted">加载中...</div>+ <div className="text-sm text-text-muted">{t('common.loading')}</div>)}{!isLoading && errorMessage && (<div className="text-sm text-danger">{errorMessage}</div>@@ -318,7 +322,7 @@ function OffloadFileModal({className="text-sm whitespace-pre-wrap break-words"style={{ color: 'var(--text)' }}>- {content || '文件内容为空'}+ {content || t('offloadFiles.emptyContent')}</pre>)}</div>@@ -346,7 +350,7 @@ function OffloadFileModal({event.currentTarget.style.color = 'var(--muted)';}}>- 关闭+ {t('common.close')}</button></div></div>diff --git a/jiuwenclaw/web/src/components/SessionSidebar/SessionItem.tsx b/jiuwenclaw/web/src/components/SessionSidebar/SessionItem.tsxindex 1cf422eb77..7a02711ec4 100644--- a/jiuwenclaw/web/src/components/SessionSidebar/SessionItem.tsx+++ b/jiuwenclaw/web/src/components/SessionSidebar/SessionItem.tsx@@ -5,6 +5,7 @@*/import { useState } from 'react';+import { useTranslation } from 'react-i18next';import { Session } from '../../types';import clsx from 'clsx';@@ -18,39 +19,39 @@ interface SessionItemProps {/*** 格式化时间显示*/-function formatTime(timestamp: string): string {+function formatTime(+ timestamp: string,+ language: string,+ t: (key: string, options?: Record<string, unknown>) => string+): string {const date = new Date(timestamp);const now = new Date();const diff = now.getTime() - date.getTime();- // 小于1分钟if (diff < 60000) {- return '刚刚';+ return t('time.relative.justNow');}- // 小于1小时if (diff < 3600000) {const minutes = Math.floor(diff / 60000);- return `${minutes}分钟前`;+ return t('time.relative.minutesAgo', { count: minutes });}- // 小于24小时if (diff < 86400000) {const hours = Math.floor(diff / 3600000);- return `${hours}小时前`;+ return t('time.relative.hoursAgo', { count: hours });}- // 小于7天if (diff < 604800000) {const days = Math.floor(diff / 86400000);- return `${days}天前`;+ return t('time.relative.daysAgo', { count: days });}- // 超过7天显示日期- return date.toLocaleDateString('zh-CN', { month: 'short', day: 'numeric' });+ return date.toLocaleDateString(language, { month: 'short', day: 'numeric' });}export function SessionItem({ session, isActive, onClick, onDelete }: SessionItemProps) {+ const { t, i18n } = useTranslation();const [showDelete, setShowDelete] = useState(false);// 优先展示会话标题,缺失时回退到会话 ID 片段@@ -93,7 +94,9 @@ export function SessionItem({ session, isActive, onClick, onDelete }: SessionIte{preview}</div><div className="text-xs text-text-muted truncate">- {session.updated_at ? formatTime(session.updated_at) : '新会话'}+ {session.updated_at+ ? formatTime(session.updated_at, i18n.language, t)+ : t('sessionSidebar.newSession')}</div></div>@@ -113,7 +116,7 @@ export function SessionItem({ session, isActive, onClick, onDelete }: SessionIte<buttononClick={handleDelete}className="absolute right-2 top-1/2 -translate-y-1/2 p-1.5 rounded-md text-text-muted hover:text-danger hover:bg-danger-subtle transition-colors"- title="删除会话"+ title={t('sessions.delete')}><svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={1.5}><path strokeLinecap="round" strokeLinejoin="round" d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" />diff --git a/jiuwenclaw/web/src/components/SessionSidebar/index.tsx b/jiuwenclaw/web/src/components/SessionSidebar/index.tsxindex a0ae28d8cd..5e565e4bdf 100644--- a/jiuwenclaw/web/src/components/SessionSidebar/index.tsx+++ b/jiuwenclaw/web/src/components/SessionSidebar/index.tsx@@ -4,6 +4,7 @@* 会话侧边栏,显示会话列表*/+import { useTranslation } from 'react-i18next';import { OffloadFilesWidget } from './OffloadFilesWidget';import './SessionSidebar.css';@@ -20,11 +21,11 @@ export function SessionSidebar({onNavigate,sessionId,}: SessionSidebarProps) {-+ const { t } = useTranslation();return (<aside className="nav flex flex-col"><div className="session-sidebar-group-title session-sidebar-group-title--uppercase">- 对话+ {t('nav.chat')}</div><div className="space-y-1 mb-4"><button@@ -34,12 +35,12 @@ export function SessionSidebar({<svg className="w-4 h-4 nav-item__icon" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={1.5}><path strokeLinecap="round" strokeLinejoin="round" d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" /></svg>- 对话+ {t('nav.chat')}</button></div><div className="session-sidebar-group-title">- 智能体+ {t('nav.agent')}</div><div className="space-y-1"><button@@ -49,7 +50,7 @@ export function SessionSidebar({<svg className="w-4 h-4 nav-item__icon" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={1.5}><path strokeLinecap="round" strokeLinejoin="round" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" /></svg>- 智能体+ {t('nav.agent')}</button><buttononClick={() => onNavigate('sessions')}@@ -58,7 +59,7 @@ export function SessionSidebar({<svg className="w-4 h-4 nav-item__icon" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={1.5}><path strokeLinecap="round" strokeLinejoin="round" d="M12 6v12m6-6H6m9-9h3a2.25 2.25 0 012.25 2.25v3M9 3H6a2.25 2.25 0 00-2.25 2.25v3m0 6v3A2.25 2.25 0 006 19.75h3m6 0h3a2.25 2.25 0 002.25-2.25v-3" /></svg>- 会话+ {t('nav.sessions')}</button><buttononClick={() => onNavigate('heartbeat')}@@ -67,7 +68,7 @@ export function SessionSidebar({<svg className="w-4 h-4 nav-item__icon" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={1.5}><path strokeLinecap="round" strokeLinejoin="round" d="M3.75 12h3.75l1.5-4.5 3 9 2.25-6h6" /></svg>- 心跳+ {t('nav.heartbeat')}</button><buttononClick={() => onNavigate('cron')}@@ -76,7 +77,7 @@ export function SessionSidebar({<svg className="w-4 h-4 nav-item__icon" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={1.5}><path strokeLinecap="round" strokeLinejoin="round" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>- 定时任务+ {t('nav.cron')}</button><buttononClick={() => onNavigate('skills')}@@ -85,7 +86,7 @@ export function SessionSidebar({<svg className="w-4 h-4 nav-item__icon" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={1.5}><path strokeLinecap="round" strokeLinejoin="round" d="M3.75 13.5l10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75z" /></svg>- 技能+ {t('nav.skills')}</button><buttononClick={() => onNavigate('channels')}@@ -94,12 +95,12 @@ export function SessionSidebar({<svg className="w-4 h-4 nav-item__icon" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={1.5}><path strokeLinecap="round" strokeLinejoin="round" d="M4.5 6.75h15m-15 5.25h15m-15 5.25h15" /></svg>- 频道+ {t('nav.channels')}</button></div><div className="session-sidebar-group-title session-sidebar-group-title--with-top-gap">- 设置+ {t('nav.settings')}</div><div className="space-y-1"><button@@ -110,7 +111,7 @@ export function SessionSidebar({<path strokeLinecap="round" strokeLinejoin="round" d="M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 011.37.49l1.296 2.247a1.125 1.125 0 01-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 010 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 01-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 01-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 01-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 01-1.369-.49l-1.297-2.247a1.125 1.125 0 01.26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 010-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 01-.26-1.43l1.297-2.247a1.125 1.125 0 011.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28z" /><path strokeLinecap="round" strokeLinejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" /></svg>- 配置信息+ {t('nav.config')}</button><buttononClick={() => onNavigate('browserpanel')}@@ -120,7 +121,7 @@ export function SessionSidebar({<circle cx="12" cy="12" r="10" /><path strokeLinecap="round" strokeLinejoin="round" d="M2 12h20M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10A15.3 15.3 0 0112 2z" /></svg>- 浏览器服务+ {t('nav.browser')}</button><buttononClick={() => onNavigate('logspanel')}@@ -130,7 +131,7 @@ export function SessionSidebar({<path strokeLinecap="round" strokeLinejoin="round" d="M7.5 3.75h9a2.25 2.25 0 012.25 2.25v12a2.25 2.25 0 01-2.25 2.25h-9A2.25 2.25 0 015.25 18V6A2.25 2.25 0 017.5 3.75z" /><path strokeLinecap="round" strokeLinejoin="round" d="M8.25 8.25h7.5M8.25 12h7.5M8.25 15.75h4.5" /></svg>- 日志+ {t('nav.logs')}</button></div>@@ -140,7 +141,7 @@ export function SessionSidebar({<div className="pt-4 mt-4 border-t border-border text-xs text-text-muted"><div className="px-2.5">- <span>版本 0.1.5</span>+ <span>{t('version', { version: '0.1.5' })}</span></div></div></aside>diff --git a/jiuwenclaw/web/src/components/SessionsPanel/index.tsx b/jiuwenclaw/web/src/components/SessionsPanel/index.tsxindex 5475899d7c..0da2692f0b 100644--- a/jiuwenclaw/web/src/components/SessionsPanel/index.tsx+++ b/jiuwenclaw/web/src/components/SessionsPanel/index.tsx@@ -1,4 +1,5 @@import { useEffect, useMemo, useState } from 'react';+import { useTranslation } from 'react-i18next';import { FileViewer } from '../AgentPanel/FileViewer';import { containsIgnoredDirectory } from '../../features/fileTreeFilters';import { webRequest } from '../../services/webClient';@@ -38,17 +39,17 @@ function isPlausibleDate(date: Date): boolean {return year >= 2020 && year <= 2100;}-function parseSessionDisplayLabel(sessionId: string): string {- if (!sessionId) return '未知会话-未知时间';+function parseSessionDisplayLabel(sessionId: string, t: (key: string, options?: Record<string, unknown>) => string): string {+ if (!sessionId) return t('sessions.unknownSession');// 处理以 sess_、cron_、feishu_、xiaoyi_、dingtalk_ 开头的会话IDconst prefixes = ['sess_', 'cron_', 'feishu_', 'xiaoyi_', 'dingtalk_'];const prefixMap: Record<string, string> = {- 'sess_': '会话',- 'cron_': '定时',- 'feishu_': '飞书',- 'xiaoyi_': '小艺',- 'dingtalk_': '钉钉'+ 'sess_': t('sessions.prefixes.session'),+ 'cron_': t('sessions.prefixes.cron'),+ 'feishu_': t('sessions.prefixes.feishu'),+ 'xiaoyi_': t('sessions.prefixes.xiaoyi'),+ 'dingtalk_': t('sessions.prefixes.dingtalk')};for (const prefix of prefixes) {@@ -64,13 +65,13 @@ function parseSessionDisplayLabel(sessionId: string): string {}}}- return `${prefixMap[prefix]}-未知时间`;+ return `${prefixMap[prefix]}-${t('sessions.unknownTime')}`;}}if (sessionId.startsWith('heartbeat_')) {const rawBody = sessionId.slice('heartbeat_'.length);- return rawBody ? `心跳-${rawBody}` : '心跳';+ return rawBody ? `${t('sessions.prefixes.heartbeat')}-${rawBody}` : t('sessions.prefixes.heartbeat');}// 解析会话ID中可能包含的时间戳格式,如 YYYYMMDD_HHMMSS_xxxx@@ -80,13 +81,13 @@ function parseSessionDisplayLabel(sessionId: string): string {const [, year, month, day, hours, minutes, seconds] = match;const date = new Date(`${year}-${month}-${day} ${hours}:${minutes}:${seconds}`);if (!Number.isNaN(date.getTime()) && isPlausibleDate(date)) {- const prefix = sessionId.includes('_') ? sessionId.split('_')[0] : '未知';+ const prefix = sessionId.includes('_') ? sessionId.split('_')[0] : t('sessions.prefixes.unknown');return `${prefix}-${formatDateTime(date)}`;}}- const prefix = sessionId.includes('_') ? sessionId.split('_')[0] : '未知';- return `${prefix}-未知时间`;+ const prefix = sessionId.includes('_') ? sessionId.split('_')[0] : t('sessions.prefixes.unknown');+ return `${prefix}-${t('sessions.unknownTime')}`;}function toSessionIds(raw: unknown[]): string[] {@@ -116,6 +117,7 @@ function toSessionFiles(raw: unknown[]): SessionFileItem[] {}export function SessionsPanel({ currentSessionId }: SessionsPanelProps) {+ const { t } = useTranslation();const [sessions, setSessions] = useState<string[]>([]);const [loadingSessions, setLoadingSessions] = useState(true);const [sessionsError, setSessionsError] = useState<string | null>(null);@@ -141,7 +143,7 @@ export function SessionsPanel({ currentSessionId }: SessionsPanelProps) {} catch (error) {console.error('Failed to load sessions:', error);setSessions([]);- setSessionsError('会话列表加载失败');+ setSessionsError(t('sessions.errors.loadSessions'));setSelectedSessionId(null);} finally {setLoadingSessions(false);@@ -151,7 +153,7 @@ export function SessionsPanel({ currentSessionId }: SessionsPanelProps) {useEffect(() => {void loadSessions();// eslint-disable-next-line react-hooks/exhaustive-deps- }, []);+ }, [t]);useEffect(() => {if (!selectedSessionId) {@@ -194,17 +196,17 @@ export function SessionsPanel({ currentSessionId }: SessionsPanelProps) {} catch (error) {console.error('Failed to load session files:', error);setFiles([]);- setFilesError('会话文件列表加载失败');+ setFilesError(t('sessions.errors.loadFiles'));} finally {setLoadingFiles(false);}};void loadFiles();- }, [selectedSessionId]);+ }, [selectedSessionId, t]);const handleDeleteSession = async (sessionId: string) => {- const displayLabel = parseSessionDisplayLabel(sessionId);- const confirmed = window.confirm(`确认删除会话 ${displayLabel} ?\n将删除该会话目录下所有文件。`);+ const displayLabel = parseSessionDisplayLabel(sessionId, t);+ const confirmed = window.confirm(t('sessions.deleteConfirm', { session: displayLabel }));if (!confirmed) return;setDeletingSessionId(sessionId);@@ -216,15 +218,15 @@ export function SessionsPanel({ currentSessionId }: SessionsPanelProps) {}} catch (error) {console.error('Failed to delete session:', error);- setSessionsError(`删除会话失败:${sessionId}`);+ setSessionsError(t('sessions.errors.deleteSession', { sessionId }));} finally {setDeletingSessionId(null);}};const selectedSessionLabel = useMemo(- () => (selectedSessionId ? parseSessionDisplayLabel(selectedSessionId) : '未选择会话'),- [selectedSessionId]+ () => (selectedSessionId ? parseSessionDisplayLabel(selectedSessionId, t) : t('sessions.noneSelected')),+ [selectedSessionId, t]);return (@@ -232,8 +234,8 @@ export function SessionsPanel({ currentSessionId }: SessionsPanelProps) {<div className="card w-full h-full flex flex-col"><div className="flex items-center justify-between gap-4 mb-4"><div>- <h2 className="text-lg font-semibold">会话管理</h2>- <p className="text-sm text-text-muted mt-1">浏览并管理会话与文件</p>+ <h2 className="text-lg font-semibold">{t('sessions.title')}</h2>+ <p className="text-sm text-text-muted mt-1">{t('sessions.subtitle')}</p></div><buttontype="button"@@ -241,7 +243,7 @@ export function SessionsPanel({ currentSessionId }: SessionsPanelProps) {disabled={loadingSessions}className="btn !px-3 !py-1.5 disabled:opacity-50 disabled:cursor-not-allowed">- {loadingSessions ? '刷新中...' : '刷新'}+ {loadingSessions ? t('common.refreshing') : t('common.refresh')}</button></div>@@ -255,15 +257,15 @@ export function SessionsPanel({ currentSessionId }: SessionsPanelProps) {<div className="rounded-xl border border-border bg-card/70 backdrop-blur-sm overflow-hidden shadow-sm flex flex-col min-h-0"><div className="px-4 py-3 bg-secondary/30 border-b border-border"><div>- <h3 className="text-sm font-medium text-text">历史会话</h3>+ <h3 className="text-sm font-medium text-text">{t('sessions.history')}</h3><p className="text-xs text-text-muted mt-1 mono">- 最多 20 条,当前 {sessions.length} 条+ {t('sessions.count', { count: sessions.length })}</p></div></div><div className="flex-1 overflow-auto p-2 space-y-1">{!loadingSessions && sessions.length === 0 ? (- <div className="h-full flex items-center justify-center text-sm text-text-muted">暂无会话</div>+ <div className="h-full flex items-center justify-center text-sm text-text-muted">{t('sessions.empty')}</div>) : (sessions.map((sessionId) => (<div key={sessionId} className="group grid grid-cols-[minmax(0,1fr)_auto] items-center gap-2">@@ -275,13 +277,13 @@ export function SessionsPanel({ currentSessionId }: SessionsPanelProps) {: 'border-transparent hover:bg-secondary/40 text-text-muted hover:text-text'}`}onClick={() => setSelectedSessionId(sessionId)}- title={`${parseSessionDisplayLabel(sessionId)} (${sessionId})`}+ title={`${parseSessionDisplayLabel(sessionId, t)} (${sessionId})`}>- <span className="truncate block">{parseSessionDisplayLabel(sessionId)}</span>+ <span className="truncate block">{parseSessionDisplayLabel(sessionId, t)}</span></button><buttontype="button"- title="删除会话"+ title={t('sessions.delete')}className="shrink-0 p-1.5 rounded-md text-text-muted hover:text-danger hover:bg-danger-subtle transition-colors disabled:opacity-50"disabled={deletingSessionId === sessionId}onClick={() => void handleDeleteSession(sessionId)}@@ -300,7 +302,7 @@ export function SessionsPanel({ currentSessionId }: SessionsPanelProps) {<div className="border-r border-border flex flex-col min-h-0"><div className="px-4 py-3 bg-secondary/30 border-b border-border"><div>- <h3 className="text-sm font-medium text-text">会话文件</h3>+ <h3 className="text-sm font-medium text-text">{t('sessions.files')}</h3><p className="text-xs text-text-muted mt-1 truncate" title={selectedSessionLabel}>{selectedSessionLabel}</p>@@ -308,13 +310,13 @@ export function SessionsPanel({ currentSessionId }: SessionsPanelProps) {</div><div className="flex-1 overflow-auto p-2">{!selectedSessionId ? (- <div className="h-full flex items-center justify-center text-sm text-text-muted">请先选择会话</div>+ <div className="h-full flex items-center justify-center text-sm text-text-muted">{t('sessions.selectFirst')}</div>) : loadingFiles ? (- <div className="h-full flex items-center justify-center text-sm text-text-muted">加载文件中...</div>+ <div className="h-full flex items-center justify-center text-sm text-text-muted">{t('sessions.loadingFiles')}</div>) : filesError ? (<div className="rounded-md border border-danger/30 bg-danger/10 px-3 py-2 text-xs text-danger">{filesError}</div>) : files.length === 0 ? (- <div className="h-full flex items-center justify-center text-sm text-text-muted">暂无文件</div>+ <div className="h-full flex items-center justify-center text-sm text-text-muted">{t('sessions.emptyFiles')}</div>) : (<div className="space-y-1">{files.map((file) => {@@ -342,11 +344,11 @@ export function SessionsPanel({ currentSessionId }: SessionsPanelProps) {</span>{file.isDirectory ? (<span className="text-[10px] px-1.5 py-0.5 rounded border border-border bg-secondary/50 text-text-muted">- 文件夹+ {t('sessions.folder')}</span>) : !file.isMarkdown ? (<span className="text-[10px] px-1.5 py-0.5 rounded border border-border bg-secondary/50 text-text-muted">- 不可预览+ {t('sessions.notPreviewable')}</span>) : null}</span>@@ -362,7 +364,7 @@ export function SessionsPanel({ currentSessionId }: SessionsPanelProps) {<FileViewer filePath={selectedFile.path} fileName={selectedFile.name} />) : (<div className="h-full flex items-center justify-center text-text-muted">- 请选择一个文件查看+ {t('sessions.selectFile')}</div>)}</div>diff --git a/jiuwenclaw/web/src/components/SkillPanel/index.tsx b/jiuwenclaw/web/src/components/SkillPanel/index.tsxindex f3015025de..84ed6d625c 100644--- a/jiuwenclaw/web/src/components/SkillPanel/index.tsx+++ b/jiuwenclaw/web/src/components/SkillPanel/index.tsx@@ -4,6 +4,7 @@* Skills 管理面板*/import { useCallback, useEffect, useMemo, useState } from "react";+import { useTranslation } from 'react-i18next';import { webRequest } from "../../services/webClient";import { SourceManagerModal } from "../../features/SourceManagerModal";@@ -46,13 +47,14 @@ interface SkillPanelProps {sessionId: string;}-function getSourceLabel(source: string): string {- if (source === "local") return "本地";- if (source === "project") return "项目";- return source || "未知";+function getSourceLabel(source: string, t: (key: string) => string): string {+ if (source === "local") return t('skills.source.local');+ if (source === "project") return t('skills.source.project');+ return source || t('skills.source.unknown');}export function SkillPanel({ sessionId }: SkillPanelProps) {+ const { t } = useTranslation();const [skills, setSkills] = useState<SkillItem[]>([]);const [plugins, setPlugins] = useState<InstalledPluginItem[]>([]);const [marketplaces, setMarketplaces] = useState<MarketplaceItem[]>([]);@@ -108,7 +110,7 @@ export function SkillPanel({ sessionId }: SkillPanelProps) {);setMarketplaces(data.marketplaces || []);} catch (error) {- console.error("获取 marketplaces 失败:", error);+ console.error('Failed to load marketplaces:', error);}}, []);@@ -188,10 +190,10 @@ export function SkillPanel({ sessionId }: SkillPanelProps) {? `${skillName}@${preferredMarketplace}`: "plugin-name@anthropics";const hint = marketplaceNames- ? `可用 marketplace: ${marketplaceNames}`- : "默认 marketplace: anthropics";+ ? t('skills.marketplacesAvailable', { names: marketplaceNames })+ : t('skills.marketplacesDefault');const spec = window.prompt(- `请输入插件规格 (plugin@marketplace)\n${hint}`,+ `${t('skills.installPrompt')}\n${hint}`,defaultSpec);if (!spec) return;@@ -206,9 +208,9 @@ export function SkillPanel({ sessionId }: SkillPanelProps) {message?: string;}>("skills.install", withSession({ spec, force: false }));if (!data.success) {- throw new Error(data.detail || data.message || "安装失败");+ throw new Error(data.detail || data.message || t('skills.errors.installFailed'));}- setMessage(`已安装:${spec}`);+ setMessage(t('skills.messages.installed', { spec }));setMessageType("success");await fetchSkills();if (selectedSkill) {@@ -216,7 +218,7 @@ export function SkillPanel({ sessionId }: SkillPanelProps) {}} catch (error) {console.error(error);- setMessage("安装失败,请检查插件规格或网络");+ setMessage(t('skills.errors.installFailedHint'));setMessageType("error");} finally {setActionTarget(null);@@ -227,7 +229,7 @@ export function SkillPanel({ sessionId }: SkillPanelProps) {const handleImportLocal = useCallback(async () => {const path = window.prompt(- "请输入服务端本地 skill 路径(SKILL.md 或目录)"+ t('skills.importPrompt'));if (!path) return;@@ -245,9 +247,9 @@ export function SkillPanel({ sessionId }: SkillPanelProps) {force: false,}));if (!data.success) {- throw new Error(data.detail || data.message || "导入失败");+ throw new Error(data.detail || data.message || t('skills.errors.importFailed'));}- setMessage(`已导入:${data.skill?.name || path}`);+ setMessage(t('skills.messages.imported', { name: data.skill?.name || path }));setMessageType("success");await fetchSkills();if (data.skill?.name) {@@ -255,17 +257,17 @@ export function SkillPanel({ sessionId }: SkillPanelProps) {}} catch (error) {console.error(error);- setMessage("导入失败,请检查路径或权限");+ setMessage(t('skills.errors.importFailedHint'));setMessageType("error");} finally {setActionTarget(null);}- }, [fetchSkills, fetchSkillDetail, withSession]);+ }, [fetchSkills, fetchSkillDetail, t, withSession]);const handleUninstall = useCallback(async (pluginName: string) => {if (!pluginName) return;- const confirmed = window.confirm(`确认卸载 ${pluginName} ?`);+ const confirmed = window.confirm(t('skills.uninstallConfirm', { pluginName }));if (!confirmed) return;setActionTarget(pluginName);@@ -280,9 +282,9 @@ export function SkillPanel({ sessionId }: SkillPanelProps) {name: pluginName,}));if (!data.success) {- throw new Error(data.detail || data.message || "卸载失败");+ throw new Error(data.detail || data.message || t('skills.errors.uninstallFailed'));}- setMessage(`已卸载:${pluginName}`);+ setMessage(t('skills.messages.uninstalled', { pluginName }));setMessageType("success");await fetchSkills();if (selectedSkill) {@@ -290,13 +292,13 @@ export function SkillPanel({ sessionId }: SkillPanelProps) {}} catch (error) {console.error(error);- setMessage("卸载失败,请稍后重试");+ setMessage(t('skills.errors.uninstallFailedHint'));setMessageType("error");} finally {setActionTarget(null);}},- [fetchSkills, fetchSkillDetail, selectedSkill, withSession]+ [fetchSkills, fetchSkillDetail, selectedSkill, t, withSession]);const renderActionButton = (skill: SkillItem) => {@@ -317,7 +319,7 @@ export function SkillPanel({ sessionId }: SkillPanelProps) {}`}disabled={isLoading}>- 卸载+ {t('skills.actions.uninstall')}</button>);}@@ -337,7 +339,7 @@ export function SkillPanel({ sessionId }: SkillPanelProps) {}`}disabled={isLoading}>- 安装+ {t('skills.actions.install')}</button>);}@@ -347,16 +349,16 @@ export function SkillPanel({ sessionId }: SkillPanelProps) {className="px-3 py-1.5 rounded-md text-sm bg-secondary text-text-muted cursor-not-allowed whitespace-nowrap"disabled>- 内置+ {t('skills.builtIn')}</button>);};const renderStatus = (skill: SkillItem) => {const plugin = installedSkillMap.get(skill.name);- if (plugin) return "已安装";- if (skill.source !== "local" && skill.source !== "project") return "未安装";- return "内置";+ if (plugin) return t('skills.status.installed');+ if (skill.source !== "local" && skill.source !== "project") return t('skills.status.notInstalled');+ return t('skills.status.builtIn');};return (@@ -365,10 +367,10 @@ export function SkillPanel({ sessionId }: SkillPanelProps) {<div className="flex items-center justify-between gap-4"><div><h2 className="text-lg font-semibold">- 技能管理+ {t('skills.title')}</h2><p className="text-sm text-text-muted mt-1">- 管理并安装智能体可用的技能。+ {t('skills.subtitle')}</p></div><div className="flex items-center gap-2">@@ -376,7 +378,7 @@ export function SkillPanel({ sessionId }: SkillPanelProps) {onClick={() => fetchSkills(true)}className="px-3 py-1.5 rounded-md text-sm bg-secondary text-text-muted hover:text-text hover:bg-card border border-border">- 刷新+ {t('common.refresh')}</button><buttononClick={handleImportLocal}@@ -387,13 +389,13 @@ export function SkillPanel({ sessionId }: SkillPanelProps) {}`}disabled={actionTarget === "import_local"}>- 导入本地技能+ {t('skills.actions.importLocal')}</button><buttononClick={() => setSourceModalOpen(true)}className="px-3 py-1.5 rounded-md text-sm bg-accent text-white hover:bg-accent-hover">- 源管理+ {t('skills.actions.sourceManager')}</button></div></div>@@ -413,11 +415,11 @@ export function SkillPanel({ sessionId }: SkillPanelProps) {onClick={handleBackToList}className="px-3 py-1.5 rounded-md text-sm bg-secondary text-text-muted hover:text-text hover:bg-card border border-border">- 返回列表+ {t('skills.actions.backToList')}</button><div className="text-sm text-text-muted">- {detailState === "loading" && "加载详情中..."}- {detailState === "error" && "加载详情失败"}+ {detailState === "loading" && t('skills.detailLoading')}+ {detailState === "error" && t('skills.detailError')}</div></div>@@ -428,17 +430,17 @@ export function SkillPanel({ sessionId }: SkillPanelProps) {{selectedSkill.name}</div><div className="text-sm text-text-muted mt-1">- {selectedSkill.description || "暂无描述"}+ {selectedSkill.description || t('skills.noDescription')}</div><div className="flex flex-wrap gap-2 mt-3 text-xs text-text-muted"><span className="px-2 py-1 rounded-full bg-secondary border border-border">- 来源:{getSourceLabel(selectedSkill.source)}+ {t('skills.sourceLabel')}: {getSourceLabel(selectedSkill.source, t)}</span><span className="px-2 py-1 rounded-full bg-secondary border border-border">- 版本:{selectedSkill.version || "unknown"}+ {t('skills.versionLabel')}: {selectedSkill.version || 'unknown'}</span><span className="px-2 py-1 rounded-full bg-secondary border border-border">- 作者:{selectedSkill.author || "unknown"}+ {t('skills.authorLabel')}: {selectedSkill.author || 'unknown'}</span></div></div>@@ -450,7 +452,7 @@ export function SkillPanel({ sessionId }: SkillPanelProps) {<div className="mt-4"><div className="text-sm font-medium text-text mb-2">- 允许工具+ {t('skills.allowedTools')}</div><div className="flex flex-wrap gap-2 text-xs text-text-muted">{selectedSkill.allowed_tools?.length ? (@@ -463,17 +465,17 @@ export function SkillPanel({ sessionId }: SkillPanelProps) {</span>))) : (- <span className="text-text-muted">无限制</span>+ <span className="text-text-muted">{t('skills.unlimited')}</span>)}</div></div><div className="mt-4"><div className="text-sm font-medium text-text mb-2">- 内容预览+ {t('skills.contentPreview')}</div><div className="text-sm text-text whitespace-pre-wrap bg-secondary border border-border rounded-md p-3">- {selectedSkill.content || "暂无内容"}+ {selectedSkill.content || t('skills.noContent')}</div></div></div>@@ -485,26 +487,26 @@ export function SkillPanel({ sessionId }: SkillPanelProps) {<inputvalue={search}onChange={(event) => setSearch(event.target.value)}- placeholder="搜索技能名称、描述或标签"+ placeholder={t('skills.searchPlaceholder')}className="w-full px-3 py-2 rounded-md bg-panel border border-border text-sm text-text placeholder:text-text-muted"/></div><div className="text-xs text-text-muted flex-shrink-0">- 共 {filteredSkills.length} 个+ {t('skills.totalCount', { count: filteredSkills.length })}</div></div><div className="mt-4 flex-1 min-h-0 overflow-y-auto space-y-3">{listState === "loading" && (- <div className="text-sm text-text-muted">加载中...</div>+ <div className="text-sm text-text-muted">{t('common.loading')}</div>)}{listState === "error" && (<div className="text-sm text-text-muted">- 获取技能失败,请检查后端服务+ {t('skills.listError')}</div>)}{listState === "success" && filteredSkills.length === 0 && (- <div className="text-sm text-text-muted">暂无匹配的技能</div>+ <div className="text-sm text-text-muted">{t('skills.noMatches')}</div>)}{listState === "success" &&filteredSkills.map((skill) => (@@ -519,14 +521,14 @@ export function SkillPanel({ sessionId }: SkillPanelProps) {{skill.name}</div><div className="text-sm text-text-muted mt-1 line-clamp-3">- {skill.description || "暂无描述"}+ {skill.description || t('skills.noDescription')}</div><div className="flex flex-wrap gap-2 mt-3 text-xs text-text-muted"><span className="px-2 py-1 rounded-full bg-secondary border border-border">- 来源:{getSourceLabel(skill.source)}+ {t('skills.sourceLabel')}: {getSourceLabel(skill.source, t)}</span><span className="px-2 py-1 rounded-full bg-secondary border border-border">- 状态:{renderStatus(skill)}+ {t('skills.statusLabel')}: {renderStatus(skill)}</span></div></div>diff --git a/jiuwenclaw/web/src/components/StatusBar/index.tsx b/jiuwenclaw/web/src/components/StatusBar/index.tsxindex dda7ee759c..f9ad95e8d1 100644--- a/jiuwenclaw/web/src/components/StatusBar/index.tsx+++ b/jiuwenclaw/web/src/components/StatusBar/index.tsx@@ -5,6 +5,7 @@* 采用 JiuwenClaw 风格*/+import { useTranslation } from 'react-i18next';import { useChatStore } from '../../stores';import './StatusBar.css';@@ -15,6 +16,7 @@ interface StatusBarProps {}export function StatusBar({ onPause, onCancel, onResume }: StatusBarProps) {+ const { t } = useTranslation();const { isProcessing, isPaused, pausedTask, interruptResult } = useChatStore();const showExec = isProcessing || isPaused;/** 有中断结果文案时,统一只显示居中的横条(任务已暂停/恢复/取消/切换/已中断) */@@ -43,7 +45,7 @@ export function StatusBar({ onPause, onCancel, onResume }: StatusBarProps) {onClick={onCancel}className="statusbar-action-btn statusbar-action-btn--cancel">- 取消+ {t('statusBar.cancel')}</button>)}@@ -51,8 +53,10 @@ export function StatusBar({ onPause, onCancel, onResume }: StatusBarProps) {<span className={`statusbar-dot ${isPaused ? '' : 'statusbar-dot--pulse'}`.trim()} /><span>{isPaused- ? `已暂停${pausedTask ? `: ${pausedTask.slice(0, 20)}...` : ''}`- : '处理中...'}+ ? pausedTask+ ? t('statusBar.pausedWithTask', { task: pausedTask.slice(0, 20) })+ : t('statusBar.paused')+ : t('statusBar.processing')}</span></div>@@ -62,7 +66,7 @@ export function StatusBar({ onPause, onCancel, onResume }: StatusBarProps) {onClick={onResume}className="statusbar-action-btn statusbar-action-btn--resume">- 恢复+ {t('statusBar.resume')}</button>)) : (@@ -71,7 +75,7 @@ export function StatusBar({ onPause, onCancel, onResume }: StatusBarProps) {onClick={onPause}className="statusbar-action-btn statusbar-action-btn--pause">- 暂停+ {t('statusBar.pause')}</button>))}diff --git a/jiuwenclaw/web/src/components/TodoList/index.tsx b/jiuwenclaw/web/src/components/TodoList/index.tsxindex 7523a1a74e..9ad08ceab2 100644--- a/jiuwenclaw/web/src/components/TodoList/index.tsx+++ b/jiuwenclaw/web/src/components/TodoList/index.tsx@@ -4,10 +4,12 @@* 显示任务列表,支持状态图标和实时更新*/+import { useTranslation } from 'react-i18next';import { useTodoStore } from '../../stores';import { TodoItem } from './TodoItem';export function TodoList() {+ const { t } = useTranslation();const { todos } = useTodoStore();if (todos.length === 0) {@@ -16,7 +18,7 @@ export function TodoList() {<svg className="w-10 h-10 text-text-muted opacity-30 mb-3" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={1}><path strokeLinecap="round" strokeLinejoin="round" d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>- <p className="text-text-muted text-sm">暂无任务</p>+ <p className="text-text-muted text-sm">{t('todoList.empty')}</p></div>);}@@ -29,7 +31,7 @@ export function TodoList() {return (<div className="p-4 space-y-4"><h3 className="text-[11px] font-medium text-text-muted uppercase tracking-wider flex items-center justify-between">- <span>任务列表</span>+ <span>{t('todoList.title')}</span><span className="px-1.5 py-0.5 bg-secondary rounded text-[10px]">{todos.length}</span></h3>@@ -38,7 +40,7 @@ export function TodoList() {<div className="space-y-2"><div className="flex items-center gap-2 text-xs font-medium text-info"><span className="w-1.5 h-1.5 rounded-full bg-info animate-pulse" />- 进行中+ {t('todoList.inProgress')}</div><div className="space-y-1">{inProgress.map((todo) => (@@ -53,7 +55,7 @@ export function TodoList() {<div className="space-y-2"><div className="flex items-center gap-2 text-xs font-medium text-text-muted"><span className="w-1.5 h-1.5 rounded-full bg-text-muted" />- 待处理+ {t('todoList.pending')}</div><div className="space-y-1">{pending.map((todo) => (@@ -68,7 +70,7 @@ export function TodoList() {<div className="space-y-2"><div className="flex items-center gap-2 text-xs font-medium text-ok"><span className="w-1.5 h-1.5 rounded-full bg-ok" />- 已完成+ {t('todoList.completed')}</div><div className="space-y-1">{completed.map((todo) => (diff --git a/jiuwenclaw/web/src/components/ToolPanel/index.tsx b/jiuwenclaw/web/src/components/ToolPanel/index.tsxindex 0b7ce97f3a..1741d19b41 100644--- a/jiuwenclaw/web/src/components/ToolPanel/index.tsx+++ b/jiuwenclaw/web/src/components/ToolPanel/index.tsx@@ -4,6 +4,7 @@* 工具面板,显示 Todo 列表和状态信息*/+import { useTranslation } from 'react-i18next';import { useSessionStore } from '../../stores';import { useEffect, useState } from 'react';import { webRequest } from '../../services/webClient';@@ -12,6 +13,7 @@ import { TodoList } from '../TodoList';import './ToolPanel.css';export function ToolPanel() {+ const { t } = useTranslation();const {contextCompressionRate,contextCompressionBefore,@@ -78,14 +80,14 @@ export function ToolPanel() {: 'text-text-muted border-border bg-secondary/40';const heartbeatDetail = heartbeatUpdatedAt- ? new Date(heartbeatUpdatedAt).toLocaleTimeString('zh-CN', { hour12: false })+ ? new Date(heartbeatUpdatedAt).toLocaleTimeString(undefined, { hour12: false }): '--:--:--';const isHeartbeatOk = heartbeatMessage?.toUpperCase().includes('HEARTBEAT_OK') ?? false;const heartbeatDisplayMessage = !heartbeatMessage? 'HEARTBEAT_UNKNOWN': isHeartbeatOk? heartbeatMessage- : '心跳消息,点击查看';+ : t('toolPanel.heartbeatClick');const canOpenHeartbeatModal = Boolean(heartbeatMessage) && !isHeartbeatOk;const memoryDisplay =memoryUsage.rssMb == null@@ -117,21 +119,21 @@ export function ToolPanel() {<rect x="6" y="4" width="3" height="11" rx="0.5" fill="currentColor" opacity="0.7" /><rect x="11" y="1" width="3" height="14" rx="0.5" fill="currentColor" /></svg>- 状态+ {t('toolPanel.status')}</h3><div className="space-y-2"><div className="toolpanel-status-card__row">- <span className="text-text-muted">上下文压缩</span>+ <span className="text-text-muted">{t('toolPanel.contextCompression')}</span><span className="mono text-text">{compressionDisplay}</span></div><div className="toolpanel-status-card__row">- <span className="text-text-muted">内存占用</span>+ <span className="text-text-muted">{t('toolPanel.memoryUsage')}</span><span className="mono text-text">{memoryDisplay}</span></div><div className={`toolpanel-status-card__heartbeat ${heartbeatClassName}`}><div className="toolpanel-status-card__heartbeat-row">- <span>消息</span>+ <span>{t('toolPanel.message')}</span>{canOpenHeartbeatModal ? (<buttontype="button"@@ -147,7 +149,7 @@ export function ToolPanel() {)}</div><div className="toolpanel-status-card__heartbeat-row">- <span>时间</span>+ <span>{t('toolPanel.time')}</span><span className="toolpanel-status-card__heartbeat-value mono">{heartbeatDetail}</span>@@ -162,7 +164,7 @@ export function ToolPanel() {style={{ fontSize: 'var(--font-size-xs)' }}><div className="px-2.5">- <span>Powered by openJiuwen</span>+ <span>{t('toolPanel.poweredBy')}</span></div></div></div>diff --git a/jiuwenclaw/web/src/features/HeartbeatMessageModal/index.tsx b/jiuwenclaw/web/src/features/HeartbeatMessageModal/index.tsxindex 866fb8f871..d347e31320 100644--- a/jiuwenclaw/web/src/features/HeartbeatMessageModal/index.tsx+++ b/jiuwenclaw/web/src/features/HeartbeatMessageModal/index.tsx@@ -1,6 +1,7 @@import { useEffect } from 'react';import ReactMarkdown from 'react-markdown';import remarkGfm from 'remark-gfm';+import { useTranslation } from 'react-i18next';interface HeartbeatMessageModalProps {open: boolean;@@ -9,6 +10,8 @@ interface HeartbeatMessageModalProps {}export function HeartbeatMessageModal({ open, message, onClose }: HeartbeatMessageModalProps) {+ const { t } = useTranslation();+useEffect(() => {if (!open) {return;@@ -36,26 +39,26 @@ export function HeartbeatMessageModal({ open, message, onClose }: HeartbeatMessatype="button"className="absolute inset-0 bg-black/60"onClick={onClose}- aria-label="关闭心跳详情弹窗"+ aria-label={t('heartbeatModal.closeAria')}/><div className="relative w-full max-w-3xl max-h-[85vh] overflow-hidden rounded-xl border border-border bg-card shadow-2xl animate-rise"><div className="flex items-center justify-between gap-3 px-5 py-3 border-b border-border bg-panel"><div>- <h3 className="text-base font-semibold text-text">心跳消息</h3>- <p className="text-xs text-text-muted">消息内容详情</p>+ <h3 className="text-base font-semibold text-text">{t('heartbeatModal.title')}</h3>+ <p className="text-xs text-text-muted">{t('heartbeatModal.subtitle')}</p></div><buttontype="button"onClick={onClose}className="px-2.5 py-1.5 rounded-md border border-border bg-secondary/50 text-text-muted hover:text-text hover:bg-secondary transition-colors">- 关闭+ {t('common.close')}</button></div><div className="p-5 overflow-auto max-h-[calc(85vh-64px)]"><article className="chat-text max-w-none"><ReactMarkdown remarkPlugins={[remarkGfm]}>- {message || '无详细内容'}+ {message || t('heartbeatModal.empty')}</ReactMarkdown></article></div>diff --git a/jiuwenclaw/web/src/features/SourceManagerModal/index.tsx b/jiuwenclaw/web/src/features/SourceManagerModal/index.tsxindex a8fac51f41..0712263f13 100644--- a/jiuwenclaw/web/src/features/SourceManagerModal/index.tsx+++ b/jiuwenclaw/web/src/features/SourceManagerModal/index.tsx@@ -1,4 +1,5 @@import { useCallback, useEffect, useMemo, useState } from "react";+import { useTranslation } from "react-i18next";import { webRequest } from "../../services/webClient";type MarketplaceItem = {@@ -24,6 +25,7 @@ export function SourceManagerModal({onClose,onUpdated,}: SourceManagerModalProps) {+ const { t, i18n } = useTranslation();const [marketplaces, setMarketplaces] = useState<MarketplaceItem[]>([]);const [listState, setListState] = useState<LoadState>("idle");const [message, setMessage] = useState<string | null>(null);@@ -54,7 +56,7 @@ export function SourceManagerModal({setMarketplaces(data.marketplaces || []);setListState("success");} catch (error) {- console.error("获取源列表失败:", error);+ console.error("Failed to load sources:", error);setListState("error");}}, [withSession]);@@ -89,7 +91,7 @@ export function SourceManagerModal({const name = nameInput.trim();const url = urlInput.trim();if (!name || !url) {- setMessage("请先填写源名称和仓库 URL");+ setMessage(t("sourceManager.messages.fillRequired"));return;}@@ -101,23 +103,23 @@ export function SourceManagerModal({withSession({ name, url }));if (!data.success) {- throw new Error(data.detail || data.message || "添加源失败");+ throw new Error(data.detail || data.message || t("sourceManager.messages.addFailed"));}setNameInput("");setUrlInput("");- setMessage(`已添加源:${name}(默认禁用)`);+ setMessage(t("sourceManager.messages.added", { name }));await runAfterUpdate();} catch (error) {console.error(error);- setMessage("添加源失败,请检查名称或 URL");+ setMessage(t("sourceManager.messages.addFailedCheck"));} finally {setActionTarget(null);}- }, [nameInput, runAfterUpdate, urlInput, withSession]);+ }, [nameInput, runAfterUpdate, t, urlInput, withSession]);const handleRemoveSource = useCallback(async (name: string) => {- const confirmed = window.confirm(`确认删除源 ${name} ?`);+ const confirmed = window.confirm(t("sourceManager.messages.confirmDelete", { name }));if (!confirmed) return;setActionTarget(`remove:${name}`);@@ -128,18 +130,18 @@ export function SourceManagerModal({withSession({ name, remove_cache: true }));if (!data.success) {- throw new Error(data.detail || data.message || "删除源失败");+ throw new Error(data.detail || data.message || t("sourceManager.messages.removeFailed"));}- setMessage(`已删除源:${name}`);+ setMessage(t("sourceManager.messages.removed", { name }));await runAfterUpdate();} catch (error) {console.error(error);- setMessage("删除源失败,请稍后重试");+ setMessage(t("sourceManager.messages.removeFailedRetry"));} finally {setActionTarget(null);}},- [runAfterUpdate, withSession]+ [runAfterUpdate, t, withSession]);const handleToggleSource = useCallback(@@ -153,18 +155,26 @@ export function SourceManagerModal({withSession({ name: source.name, enabled: targetEnabled }));if (!data.success) {- throw new Error(data.detail || data.message || "切换源状态失败");+ throw new Error(data.detail || data.message || t("sourceManager.messages.toggleFailed"));}- setMessage(targetEnabled ? `已启用源:${source.name}` : `已禁用源:${source.name}`);+ setMessage(+ targetEnabled+ ? t("sourceManager.messages.enabled", { name: source.name })+ : t("sourceManager.messages.disabled", { name: source.name })+ );await runAfterUpdate();} catch (error) {console.error(error);- setMessage(targetEnabled ? "启用源失败,请检查网络或仓库地址" : "禁用源失败,请稍后重试");+ setMessage(+ targetEnabled+ ? t("sourceManager.messages.enableFailed")+ : t("sourceManager.messages.disableFailed")+ );} finally {setActionTarget(null);}},- [runAfterUpdate, withSession]+ [runAfterUpdate, t, withSession]);if (!open) {@@ -177,13 +187,13 @@ export function SourceManagerModal({type="button"className="absolute inset-0 bg-black/60"onClick={onClose}- aria-label="关闭源管理弹窗"+ aria-label={t("sourceManager.closeAria")}/><div className="relative w-full max-w-4xl max-h-[88vh] overflow-hidden rounded-xl border border-border bg-card shadow-2xl animate-rise"><div className="flex items-center justify-between gap-3 px-5 py-3 border-b border-border bg-panel"><div>- <h3 className="text-base font-semibold text-text">源管理</h3>- <p className="text-xs text-text-muted">添加、删除或启用/禁用技能源</p>+ <h3 className="text-base font-semibold text-text">{t("sourceManager.title")}</h3>+ <p className="text-xs text-text-muted">{t("sourceManager.subtitle")}</p></div><div className="flex items-center gap-2"><button@@ -191,32 +201,32 @@ export function SourceManagerModal({onClick={() => void fetchMarketplaces()}className="px-3 py-1.5 rounded-md text-sm bg-secondary text-text-muted hover:text-text hover:bg-card border border-border">- 刷新+ {t("common.refresh")}</button><buttontype="button"onClick={onClose}className="px-3 py-1.5 rounded-md text-sm bg-secondary text-text-muted hover:text-text hover:bg-card border border-border">- 关闭+ {t("common.close")}</button></div></div><div className="p-5 overflow-auto max-h-[calc(88vh-64px)]"><div className="rounded-lg border border-border bg-panel p-4">- <div className="text-sm font-medium text-text mb-3">添加源</div>+ <div className="text-sm font-medium text-text mb-3">{t("sourceManager.addTitle")}</div><div className="grid grid-cols-1 md:grid-cols-[180px_1fr_auto] gap-2"><inputvalue={nameInput}onChange={(event) => setNameInput(event.target.value)}- placeholder="源名称"+ placeholder={t("sourceManager.placeholders.name")}className="px-3 py-2 rounded-md bg-card border border-border text-sm text-text placeholder:text-text-muted"/><inputvalue={urlInput}onChange={(event) => setUrlInput(event.target.value)}- placeholder="Git 仓库地址(https://...)"+ placeholder={t("sourceManager.placeholders.url")}className="px-3 py-2 rounded-md bg-card border border-border text-sm text-text placeholder:text-text-muted"/><button@@ -229,7 +239,7 @@ export function SourceManagerModal({}`}disabled={actionTarget === "add"}>- 添加+ {t("sourceManager.add")}</button></div></div>@@ -242,16 +252,16 @@ export function SourceManagerModal({<div className="mt-4 rounded-lg border border-border bg-panel p-4"><div className="text-sm font-medium text-text mb-2">- 已配置源({sortedMarketplaces.length} 个)+ {t("sourceManager.configuredCount", { count: sortedMarketplaces.length })}</div>{listState === "loading" && (- <div className="text-sm text-text-muted">加载中...</div>+ <div className="text-sm text-text-muted">{t("common.loading")}</div>)}{listState === "error" && (- <div className="text-sm text-text-muted">源列表加载失败,请重试</div>+ <div className="text-sm text-text-muted">{t("sourceManager.messages.loadFailed")}</div>)}{listState === "success" && sortedMarketplaces.length === 0 && (- <div className="text-sm text-text-muted">暂无已配置源</div>+ <div className="text-sm text-text-muted">{t("sourceManager.empty")}</div>)}{listState === "success" && sortedMarketplaces.length > 0 && (<div className="space-y-2">@@ -269,7 +279,9 @@ export function SourceManagerModal({<div className="text-xs text-text-muted break-all">{source.url}</div>{source.last_updated && (<div className="text-xs text-text-muted mt-1">- 更新于 {new Date(source.last_updated).toLocaleString()}+ {t("sourceManager.updatedAt", {+ time: new Date(source.last_updated).toLocaleString(i18n.language),+ })}</div>)}</div>@@ -281,7 +293,7 @@ export function SourceManagerModal({: "bg-secondary text-text-muted border-border"}`}>- {enabled ? "已启用" : "已禁用"}+ {enabled ? t("sourceManager.status.enabled") : t("sourceManager.status.disabled")}</span><buttontype="button"@@ -295,7 +307,7 @@ export function SourceManagerModal({}`}disabled={toggleLoading || removeLoading}>- {enabled ? "禁用" : "启用"}+ {enabled ? t("sourceManager.actions.disable") : t("sourceManager.actions.enable")}</button><buttontype="button"@@ -307,7 +319,7 @@ export function SourceManagerModal({}`}disabled={toggleLoading || removeLoading}>- 删除+ {t("sourceManager.actions.delete")}</button></div></div>diff --git a/jiuwenclaw/web/src/features/UserQuestionModal/index.tsx b/jiuwenclaw/web/src/features/UserQuestionModal/index.tsxindex eb9b811df8..a66d12fe43 100644--- a/jiuwenclaw/web/src/features/UserQuestionModal/index.tsx+++ b/jiuwenclaw/web/src/features/UserQuestionModal/index.tsx@@ -5,6 +5,7 @@*/import { useState, useCallback } from 'react';+import { useTranslation } from 'react-i18next';import { useChatStore } from '../../stores';import { Question, UserAnswer } from '../../types';@@ -13,6 +14,7 @@ interface UserQuestionModalProps {}export function UserQuestionModal({ onSubmit }: UserQuestionModalProps) {+ const { t } = useTranslation();const { pendingQuestion, setPendingQuestion } = useChatStore();const [answers, setAnswers] = useState<Map<number, UserAnswer>>(new Map());@@ -147,13 +149,13 @@ export function UserQuestionModal({ onSubmit }: UserQuestionModalProps) {className="text-lg font-semibold"style={{ color: 'var(--text-strong)' }}>- 需要您的确认+ {t('userQuestion.title')}</h2><pclassName="text-sm"style={{ color: 'var(--muted)' }}>- 请回答以下问题以继续任务+ {t('userQuestion.subtitle')}</p></div></div>@@ -202,7 +204,7 @@ export function UserQuestionModal({ onSubmit }: UserQuestionModalProps) {e.currentTarget.style.color = 'var(--muted)';}}>- 取消+ {t('common.cancel')}</button><buttononClick={handleSubmit}@@ -211,7 +213,7 @@ export function UserQuestionModal({ onSubmit }: UserQuestionModalProps) {background: 'linear-gradient(135deg, var(--accent), var(--accent-2))',}}>- 确认提交+ {t('userQuestion.submit')}</button></div></div>@@ -238,6 +240,7 @@ function QuestionItem({onOptionSelect,onCustomInput,}: QuestionItemProps) {+ const { t } = useTranslation();const [showCustomInput, setShowCustomInput] = useState(false);const selectedOptions = answer?.selected_options || [];@@ -266,7 +269,7 @@ function QuestionItem({className="text-xs mt-1"style={{ color: 'var(--muted)' }}>- (可多选)+ {t('userQuestion.multiSelect')}</p>)}</div>@@ -374,7 +377,7 @@ function QuestionItem({</svg>)}</div>- <div className="font-medium">其他(自定义输入)</div>+ <div className="font-medium">{t('userQuestion.customOption')}</div></div></button>@@ -384,7 +387,7 @@ function QuestionItem({<textareavalue={answer?.custom_input || ''}onChange={(e) => onCustomInput(questionIndex, e.target.value)}- placeholder="请输入您的回答..."+ placeholder={t('userQuestion.customPlaceholder')}className="w-full px-3 py-2 text-sm rounded-lg resize-none focus:outline-none"style={{backgroundColor: 'var(--bg-elevated)',diff --git a/jiuwenclaw/web/src/hooks/useSpeech.ts b/jiuwenclaw/web/src/hooks/useSpeech.tsindex f31b614691..3fc7a0e087 100644--- a/jiuwenclaw/web/src/hooks/useSpeech.ts+++ b/jiuwenclaw/web/src/hooks/useSpeech.ts@@ -5,6 +5,7 @@*/import { useState, useCallback, useRef, useEffect } from 'react';+import i18n from '../i18n';// ============================================================================// 语音识别 (STT)@@ -111,7 +112,7 @@ export function useSpeechRecognition(const startListening = useCallback(() => {if (!isSupported) {- onError?.('浏览器不支持语音识别');+ onError?.(i18n.t('speech.recognitionUnsupported'));return;}@@ -123,7 +124,7 @@ export function useSpeechRecognition(const SpeechRecognitionCtor =window.SpeechRecognition || window.webkitSpeechRecognition;if (!SpeechRecognitionCtor) {- onError?.('浏览器不支持语音识别');+ onError?.(i18n.t('speech.recognitionUnsupported'));return;}const recognition = new SpeechRecognitionCtor();@@ -174,13 +175,13 @@ export function useSpeechRecognition(setIsListening(false);const errorMessages: Record<string, string> = {- 'no-speech': '未检测到语音',- 'audio-capture': '未检测到麦克风',- 'not-allowed': '麦克风权限被拒绝',- 'network': '网络错误',+ 'no-speech': i18n.t('speech.errors.noSpeech'),+ 'audio-capture': i18n.t('speech.errors.noMic'),+ 'not-allowed': i18n.t('speech.errors.notAllowed'),+ 'network': i18n.t('speech.errors.network'),};- onError?.(errorMessages[event.error] || `语音识别错误: ${event.error}`);+ onError?.(errorMessages[event.error] || i18n.t('speech.errors.recognitionGeneric', { error: event.error }));};recognition.onend = () => {@@ -308,7 +309,7 @@ export function useSpeechSynthesis(const speak = useCallback((text: string) => {if (!isSupported) {- onError?.('浏览器不支持语音合成');+ onError?.(i18n.t('speech.synthesisUnsupported'));return;}@@ -342,7 +343,7 @@ export function useSpeechSynthesis(utterance.onerror = (event) => {console.error('Speech synthesis error:', event);setIsSpeaking(false);- onError?.(`语音合成错误: ${event.error}`);+ onError?.(i18n.t('speech.errors.synthesisGeneric', { error: event.error }));};utteranceRef.current = utterance;diff --git a/jiuwenclaw/web/src/hooks/useWebSocket.ts b/jiuwenclaw/web/src/hooks/useWebSocket.tsindex d7f7865ba4..7300404bf0 100644--- a/jiuwenclaw/web/src/hooks/useWebSocket.ts+++ b/jiuwenclaw/web/src/hooks/useWebSocket.ts@@ -22,6 +22,7 @@ import {} from '../types';import { useChatStore, useTodoStore, useSessionStore } from '../stores';import { webClient } from '../services/webClient';+import i18n from '../i18n';import {fetchTtsAudio,playAudioBase64,@@ -335,12 +336,12 @@ export function useWebSocket(options: UseWebSocketOptions): UseWebSocketReturn {setConnectionStats({ lastError: webError.message });setProcessing(false);setThinking(false);- const errorMsg = webError.message || '发送消息失败';+ const errorMsg = webError.message || i18n.t('network.sendMessageFailed');onErrorRef.current?.(errorMsg);addMessage({id: `error-${Date.now()}`,role: 'system',- content: `错误: ${errorMsg}`,+ content: i18n.t('network.errorPrefix', { message: errorMsg }),timestamp: new Date().toISOString(),});}@@ -383,7 +384,7 @@ export function useWebSocket(options: UseWebSocketOptions): UseWebSocketReturn {} catch (error) {const webError = error as WebError;setConnectionStats({ lastError: webError.message });- onErrorRef.current?.(webError.message || '中断失败');+ onErrorRef.current?.(webError.message || i18n.t('network.interruptFailed'));}},[addMessage, request, setConnectionStats]@@ -397,7 +398,7 @@ export function useWebSocket(options: UseWebSocketOptions): UseWebSocketReturn {} catch (error) {const webError = error as WebError;setConnectionStats({ lastError: webError.message });- onErrorRef.current?.(webError.message || '暂停失败');+ onErrorRef.current?.(webError.message || i18n.t('network.pauseFailed'));}},[interrupt, setConnectionStats]@@ -410,7 +411,7 @@ export function useWebSocket(options: UseWebSocketOptions): UseWebSocketReturn {} catch (error) {const webError = error as WebError;setConnectionStats({ lastError: webError.message });- onErrorRef.current?.(webError.message || '取消失败');+ onErrorRef.current?.(webError.message || i18n.t('network.cancelFailed'));}},[interrupt, setConnectionStats]@@ -423,7 +424,7 @@ export function useWebSocket(options: UseWebSocketOptions): UseWebSocketReturn {} catch (error) {const webError = error as WebError;setConnectionStats({ lastError: webError.message });- onErrorRef.current?.(webError.message || '补充失败');+ onErrorRef.current?.(webError.message || i18n.t('network.supplementFailed'));}},[interrupt, setConnectionStats]@@ -438,7 +439,7 @@ export function useWebSocket(options: UseWebSocketOptions): UseWebSocketReturn {} catch (error) {const webError = error as WebError;setConnectionStats({ lastError: webError.message });- onErrorRef.current?.(webError.message || '恢复失败');+ onErrorRef.current?.(webError.message || i18n.t('network.resumeFailed'));}},[interrupt, setConnectionStats, setPaused]@@ -468,7 +469,7 @@ export function useWebSocket(options: UseWebSocketOptions): UseWebSocketReturn {} catch (error) {const webError = error as WebError;setConnectionStats({ lastError: webError.message });- onErrorRef.current?.(webError.message || '提交回答失败');+ onErrorRef.current?.(webError.message || i18n.t('network.submitAnswerFailed'));}},[request, setConnectionStats, setPendingQuestion]@@ -699,12 +700,12 @@ export function useWebSocket(options: UseWebSocketOptions): UseWebSocketReturn {if (shouldDropDuplicatedEvent('chat.error', payload)) return;setThinking(false);const errorMsg =- typeof payload.error === 'string' ? payload.error : 'Unknown error';+ typeof payload.error === 'string' ? payload.error : i18n.t('network.unknownError');onErrorRef.current?.(errorMsg);addMessage({id: `error-${Date.now()}`,role: 'system',- content: `错误: ${errorMsg}`,+ content: i18n.t('network.errorPrefix', { message: errorMsg }),timestamp: new Date().toISOString(),});}),diff --git a/jiuwenclaw/web/src/i18n/index.ts b/jiuwenclaw/web/src/i18n/index.tsnew file mode 100644index 0000000000..b95d815705--- /dev/null+++ b/jiuwenclaw/web/src/i18n/index.ts@@ -0,0 +1,28 @@+import i18n from 'i18next';+import { initReactI18next } from 'react-i18next';+import LanguageDetector from 'i18next-browser-languagedetector';+import zh from './locales/zh.json';+import en from './locales/en.json';++const resources = {+ zh: { translation: zh },+ en: { translation: en },+};++i18n+ .use(LanguageDetector)+ .use(initReactI18next)+ .init({+ resources,+ fallbackLng: 'zh',+ supportedLngs: ['zh', 'en'],+ interpolation: {+ escapeValue: false,+ },+ detection: {+ order: ['localStorage', 'navigator'],+ caches: ['localStorage'],+ },+ });++export default i18n;diff --git a/jiuwenclaw/web/src/i18n/locales/en.json b/jiuwenclaw/web/src/i18n/locales/en.jsonnew file mode 100644index 0000000000..f39055f390--- /dev/null+++ b/jiuwenclaw/web/src/i18n/locales/en.json@@ -0,0 +1,589 @@+{+ "common": {+ "confirm": "Confirm",+ "cancel": "Cancel",+ "close": "Close",+ "refresh": "Refresh",+ "refreshing": "Refreshing...",+ "loading": "Loading...",+ "save": "Save",+ "saving": "Saving...",+ "error": "Error",+ "ok": "OK",+ "and": "and"+ },+ "nav": {+ "chat": "Chat",+ "agent": "Agent",+ "sessions": "Sessions",+ "heartbeat": "Heartbeat",+ "cron": "Scheduled Tasks",+ "skills": "Skills",+ "channels": "Channels",+ "settings": "Settings",+ "config": "Configuration",+ "browser": "Browser Service",+ "logs": "Logs"+ },+ "statusBar": {+ "cancel": "Cancel",+ "pause": "Pause",+ "resume": "Resume",+ "processing": "Processing...",+ "paused": "Paused",+ "pausedWithTask": "Paused: {{task}}..."+ },+ "chat": {+ "placeholder": "Enter to send, Shift+Enter for new line, hold mic to record",+ "placeholderProcessing": "Processing, enter to interrupt...",+ "placeholderProcessingQueue": "Processing, new input will join the queue...",+ "placeholderVoice": "Listening...",+ "welcomeLogoAlt": "JiuwenClaw logo",+ "welcomeHeading": "Hi, I'm JiuwenClaw. Nice to meet you!",+ "welcomeSubtext": "I can answer questions, clear up confusion, and help you complete tasks.",+ "welcomeSuggestions": {+ "journey": "Let's begin a brand-new journey!",+ "skills": "Can you tell me what skills you have?"+ },+ "newSession": "New Session",+ "sessionCreated": "Session created",+ "modePlan": "Task Planning",+ "modeAgent": "Smart Execution",+ "recording": "Recording... (release to send)",+ "waitingTasks": "Waiting tasks",+ "waitingTasksCount": "Waiting tasks ({{count}})",+ "removeTask": "Remove task",+ "holdToSpeak": "Hold to speak",+ "send": "Send (Enter)",+ "newSessionDisabled": "Cannot create session while processing or recording"+ },+ "connection": {+ "connected": "Connected",+ "disconnected": "Disconnected",+ "connecting": "Connecting...",+ "loadingConfig": "Loading config..."+ },+ "toolPanel": {+ "status": "Status",+ "contextCompression": "Context compression",+ "memoryUsage": "Memory usage",+ "message": "Message",+ "time": "Time",+ "heartbeatClick": "Heartbeat message, click to view",+ "poweredBy": "Powered by openJiuwen"+ },+ "todoList": {+ "title": "Task list",+ "empty": "No tasks",+ "inProgress": "In progress",+ "pending": "Pending",+ "completed": "Completed"+ },+ "sessions": {+ "title": "Session Management",+ "subtitle": "Browse and manage sessions and files",+ "history": "Session History",+ "count": "Up to 20 items, currently {{count}}",+ "empty": "No sessions",+ "delete": "Delete session",+ "files": "Session Files",+ "selectFirst": "Select a session first",+ "loadingFiles": "Loading files...",+ "emptyFiles": "No files",+ "folder": "Folder",+ "notPreviewable": "Not previewable",+ "selectFile": "Select a file to view",+ "noneSelected": "No session selected",+ "unknownSession": "Unknown session-unknown time",+ "unknownTime": "unknown time",+ "deleteConfirm": "Delete session {{session}}?\nAll files in this session directory will be removed.",+ "prefixes": {+ "session": "Session",+ "cron": "Scheduled",+ "feishu": "Lark",+ "xiaoyi": "Xiaoyi",+ "dingtalk": "DingTalk",+ "heartbeat": "Heartbeat",+ "unknown": "Unknown"+ },+ "errors": {+ "loadSessions": "Failed to load sessions",+ "loadFiles": "Failed to load session files",+ "deleteSession": "Failed to delete session: {{sessionId}}"+ }+ },+ "sessionSidebar": {+ "newSession": "New session"+ },+ "heartbeat": {+ "title": "Heartbeat Management",+ "subtitle": "Maintain heartbeat settings and instruction files",+ "configTitle": "Heartbeat Settings",+ "configSubtitle": "Configure heartbeat interval, target channel, and active hours",+ "loadingConfig": "Loading heartbeat settings...",+ "saved": "Heartbeat settings saved",+ "badges": {+ "ok": "Recent heartbeat is healthy",+ "alert": "Recent heartbeat is alerting",+ "unknown": "No heartbeat result yet"+ },+ "everyLabel": "Interval (seconds)",+ "targetLabel": "Target channel (channel_id)",+ "enableActiveHours": "Enable active hours",+ "startTime": "Start time",+ "endTime": "End time",+ "recentMessages": "Recent 20 heartbeat messages",+ "noHistory": "No heartbeat history",+ "statusOk": "OK",+ "statusUnknown": "UNKNOWN",+ "latestTime": "Latest heartbeat time",+ "latestContent": "Latest heartbeat content",+ "none": "None",+ "channels": {+ "web": "Web (web)",+ "feishu": "Lark (feishu)",+ "xiaoyi": "Xiaoyi (xiaoyi)",+ "dingtalk": "DingTalk (dingtalk)"+ },+ "errors": {+ "loadConfig": "Failed to load heartbeat settings",+ "saveConfig": "Failed to save heartbeat settings",+ "invalidEvery": "Heartbeat interval must be a number greater than 0",+ "invalidActiveHours": "active_hours must use HH:MM format (for example 08:00)",+ "invalidRange": "End time must be later than start time"+ }+ },+ "heartbeatModal": {+ "closeAria": "Close heartbeat details dialog",+ "title": "Heartbeat message",+ "subtitle": "Message details",+ "empty": "No detailed content"+ },+ "offloadFiles": {+ "title": "Offload Files",+ "count": "{{count}} files",+ "notConnected": "Session not connected",+ "empty": "No offload files",+ "previewFallback": "Offload file content",+ "previewTitle": "Offload message file preview",+ "emptyContent": "File content is empty",+ "errors": {+ "loadFiles": "Failed to load offload files",+ "loadContent": "Failed to load content"+ }+ },+ "userQuestion": {+ "title": "Confirmation needed",+ "subtitle": "Answer the following questions to continue",+ "submit": "Submit",+ "multiSelect": "(Multiple choice)",+ "customOption": "Other (custom input)",+ "customPlaceholder": "Enter your answer..."+ },+ "sourceManager": {+ "closeAria": "Close source manager dialog",+ "title": "Source Manager",+ "subtitle": "Add, remove, enable, or disable skill sources",+ "addTitle": "Add source",+ "add": "Add",+ "configuredCount": "Configured sources ({{count}})",+ "empty": "No configured sources",+ "updatedAt": "Updated at {{time}}",+ "placeholders": {+ "name": "Source name",+ "url": "Git repository URL (https://...)"+ },+ "status": {+ "enabled": "Enabled",+ "disabled": "Disabled"+ },+ "actions": {+ "enable": "Enable",+ "disable": "Disable",+ "delete": "Delete"+ },+ "messages": {+ "fillRequired": "Please enter both the source name and repository URL",+ "addFailed": "Failed to add source",+ "addFailedCheck": "Failed to add source. Check the name or URL.",+ "added": "Added source: {{name}} (disabled by default)",+ "confirmDelete": "Delete source {{name}}?",+ "removeFailed": "Failed to remove source",+ "removeFailedRetry": "Failed to remove source. Please try again later.",+ "removed": "Removed source: {{name}}",+ "toggleFailed": "Failed to change source status",+ "enabled": "Enabled source: {{name}}",+ "disabled": "Disabled source: {{name}}",+ "enableFailed": "Failed to enable source. Check the network or repository URL.",+ "disableFailed": "Failed to disable source. Please try again later.",+ "loadFailed": "Failed to load source list. Please retry."+ }+ },+ "channels": {+ "title": "Channel Management",+ "subtitle": "View and manage channel services",+ "fetchFailed": "Fetch failed",+ "retry": "Retry",+ "listTitle": "Channel List",+ "listMeta": "Channels: {{status}}, refreshed at: {{time}}",+ "hideValue": "Hide value",+ "showValue": "Show value",+ "labels": {+ "web": "Web",+ "xiaoyi": "Xiaoyi",+ "feishu": "Lark",+ "dingtalk": "DingTalk"+ },+ "status": {+ "loadFailed": "Load failed",+ "enabledSummary": "{{enabledCount}}/{{total}} enabled",+ "adapting": "Adapting",+ "enabled": "Enabled",+ "disabled": "Disabled"+ },+ "config": {+ "webTitle": "Web Channel Configuration",+ "webSubtitle": "Configure web channel service settings",+ "webEmpty": "The web channel has no configurable settings. Click another channel to load its configuration.",+ "xiaoyiTitle": "Xiaoyi Channel Configuration",+ "xiaoyiSubtitle": "Configure Xiaoyi channel service settings",+ "dingtalkTitle": "DingTalk Channel Configuration",+ "dingtalkSubtitle": "Configure DingTalk channel service settings",+ "feishuTitle": "Lark Channel Configuration",+ "feishuSubtitle": "Configure Lark channel service settings"+ },+ "loading": {+ "xiaoyi": "Loading Xiaoyi settings...",+ "dingtalk": "Loading DingTalk settings...",+ "feishu": "Loading Lark settings..."+ },+ "placeholders": {+ "configValue": "Enter a configuration value",+ "appId": "Enter the app ID",+ "appSecret": "Enter the app secret",+ "employeeIds": "One employee ID per line (comma-separated is also supported)",+ "chatId": "Enter the chat ID",+ "ids": "One ID per line (comma-separated is also supported)"+ },+ "saved": {+ "feishu": "Lark settings saved",+ "xiaoyi": "Xiaoyi settings saved",+ "dingtalk": "DingTalk settings saved"+ },+ "errors": {+ "loadChannels": "Failed to load channels",+ "loadFeishu": "Failed to load Lark settings",+ "loadXiaoyi": "Failed to load Xiaoyi settings",+ "loadDingtalk": "Failed to load DingTalk settings",+ "saveGeneric": "Save failed, please try again later"+ }+ },+ "config": {+ "title": "Configuration",+ "subtitle": "Update backend service settings. The backend will automatically restart after saving to load the latest configuration.",+ "groupFallback": "Parameter group",+ "itemsCount": "{{count}} items",+ "groupsCount": "{{count}} configuration groups",+ "paramsCount": "{{count}} parameters",+ "requiredIncomplete": "Required model configuration is incomplete",+ "empty": "No configuration loaded yet. Please check the backend service status.",+ "selectModelProvider": "Select a model provider",+ "enterValue": "Enter a configuration value",+ "hideValue": "Hide value",+ "showValue": "Show value",+ "groups": {+ "model": { "label": "Model Configuration", "hint": "Model service and authentication settings" },+ "embed": { "label": "Embed Configuration", "hint": "Embed service and authentication settings" },+ "thirdParty": { "label": "Third-Party Services", "hint": "API key settings" },+ "evolution": { "label": "Evolution Settings", "hint": "Online skill evolution settings" },+ "email": { "label": "Email Settings", "hint": "Email account and token settings" },+ "other": { "label": "Other Settings", "hint": "Unclassified extended parameters" }+ },+ "errors": {+ "requiredModelFields": "These model fields are required: {{fields}}. Complete them before saving and restarting.",+ "saveFailed": "Save failed, please try again later"+ }+ },+ "cron": {+ "title": "Scheduled Task Management",+ "subtitle": "Manage scheduled tasks with cron expressions, including creating, enabling, and deleting tasks",+ "create": "Create",+ "cancelCreate": "Cancel Create",+ "update": "Update",+ "delete": "Delete",+ "enable": "Enable",+ "disable": "Disable",+ "loading": "Loading scheduled tasks...",+ "empty": "No scheduled tasks",+ "deleteConfirm": "Are you sure you want to delete this task?",+ "status": {+ "enabled": "Enabled",+ "disabled": "Disabled"+ },+ "columns": {+ "name": "Task Name",+ "cron": "Cron Expression",+ "status": "Status",+ "description": "Description",+ "wakeOffset": "Wake Offset (sec)",+ "timezone": "Time Zone",+ "target": "Target Channel",+ "actions": "Actions"+ },+ "placeholders": {+ "name": "Enter task name",+ "cron": "Five fields: min hour day month weekday. Example: every Monday 11:58 = '58 11 * * 1'",+ "cronShort": "Example: 58 11 * * 1",+ "description": "Enter description",+ "wakeOffset": "Wake offset in seconds"+ },+ "targets": {+ "web": "Web (web)",+ "feishu": "Lark (feishu)",+ "xiaoyi": "Xiaoyi (xiaoyi)",+ "dingtalk": "DingTalk (dingtalk)"+ },+ "success": {+ "created": "Task created successfully",+ "updated": "Task updated successfully",+ "deleted": "Task deleted successfully",+ "statusUpdated": "Task status updated successfully"+ },+ "errors": {+ "loadJobs": "Failed to load scheduled tasks",+ "createFailed": "Failed to create task",+ "updateFailed": "Failed to update task",+ "deleteFailed": "Failed to delete task",+ "toggleFailed": "Failed to update task status",+ "loadDetailFailed": "Failed to load task details",+ "nameRequired": "Task name is required",+ "cronRequired": "Cron expression is required",+ "timezoneRequired": "Time zone is required",+ "targetRequired": "Target channel is required",+ "descriptionRequired": "Description is required"+ }+ },+ "browser": {+ "title": "Browser Service",+ "subtitle": "Configure the browser path and start the browser service.",+ "refreshPath": "Refresh Path",+ "savePath": "Save Path",+ "startService": "Start Browser Service",+ "starting": "Starting...",+ "pathConfigHelp": "Chrome path configuration (open chrome://version in Chrome and copy the executable path)",+ "examplePath": "Example: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome",+ "success": {+ "pathSaved": "Chrome path saved",+ "started": "Browser service started successfully"+ },+ "tooltips": {+ "fillPath": "Enter a Chrome path first",+ "savePath": "Save the Chrome path first"+ },+ "errors": {+ "loadPath": "Failed to load Chrome path",+ "savePath": "Failed to save Chrome path",+ "pathRequired": "Chrome path cannot be empty",+ "saveBeforeStart": "Save the Chrome path before starting the browser service",+ "startFailed": "Failed to start browser service",+ "startFailedWithCode": "Browser service failed to start, return code {{code}}",+ "startFailedWithMessage": "Browser service failed to start: {{message}}"+ }+ },+ "logsPanel": {+ "title": "Logs",+ "dataSource": "Data source",+ "debugSetting": "Updating debug mode...",+ "debugOn": "Debug Mode On",+ "debugOff": "Debug Mode Off",+ "autoRefreshOn": "Auto Refresh On",+ "autoRefreshOff": "Auto Refresh Off",+ "recentLogs": "Recent logs (up to 300)",+ "countVisible": "{{count}} entries",+ "countVisibleTotal": "{{visible}} entries ({{total}} total)",+ "empty": "No logs",+ "errors": {+ "readLogs": "Failed to read logs",+ "readDebugConfig": "Failed to read WS debug config",+ "updateDebugConfig": "Failed to update WS debug config"+ }+ },+ "skills": {+ "title": "Skill Management",+ "subtitle": "Manage and install skills available to the agent.",+ "actions": {+ "install": "Install",+ "uninstall": "Uninstall",+ "importLocal": "Import Local Skill",+ "sourceManager": "Source Manager",+ "backToList": "Back to List"+ },+ "builtIn": "Built-in",+ "status": {+ "installed": "Installed",+ "notInstalled": "Not installed",+ "builtIn": "Built-in"+ },+ "source": {+ "local": "Local",+ "project": "Project",+ "unknown": "Unknown"+ },+ "sourceLabel": "Source",+ "statusLabel": "Status",+ "versionLabel": "Version",+ "authorLabel": "Author",+ "allowedTools": "Allowed Tools",+ "unlimited": "Unlimited",+ "contentPreview": "Content Preview",+ "noDescription": "No description",+ "noContent": "No content",+ "searchPlaceholder": "Search skill names, descriptions, or tags",+ "totalCount": "{{count}} total",+ "listError": "Failed to load skills. Please check the backend service.",+ "noMatches": "No matching skills",+ "detailLoading": "Loading details...",+ "detailError": "Failed to load details",+ "marketplacesAvailable": "Available marketplaces: {{names}}",+ "marketplacesDefault": "Default marketplace: anthropics",+ "installPrompt": "Enter plugin spec (plugin@marketplace)",+ "importPrompt": "Enter a local skill path on the server (SKILL.md or directory)",+ "uninstallConfirm": "Uninstall {{pluginName}}?",+ "messages": {+ "installed": "Installed: {{spec}}",+ "imported": "Imported: {{name}}",+ "uninstalled": "Uninstalled: {{pluginName}}"+ },+ "errors": {+ "installFailed": "Install failed",+ "installFailedHint": "Install failed. Check the plugin spec or network.",+ "importFailed": "Import failed",+ "importFailedHint": "Import failed. Check the path or permissions.",+ "uninstallFailed": "Uninstall failed",+ "uninstallFailedHint": "Uninstall failed. Please try again later."+ }+ },+ "agent": {+ "title": "Agent Management",+ "subtitle": "View agent workspace files and memory content",+ "root": "Root",+ "workspace": "Workspace",+ "workspaceMeta": "{{directories}} directories, {{files}} files",+ "directoryCount": "{{count}} directories",+ "fileCount": "{{count}} files",+ "previewableCount": "{{count}} previewable",+ "refresh": "Refresh List",+ "empty": "No files",+ "notPreviewable": "Not previewable",+ "contentPreview": "Content Preview",+ "selectMarkdown": "Select a Markdown file on the left to view",+ "selectMarkdownContent": "Select a Markdown file on the left to view its content",+ "markdownOnly": "Only Markdown (.md/.mdx) preview is supported",+ "errors": {+ "refreshFailed": "Refresh failed: unable to rebuild the agent file index. Check the generator script logs.",+ "loadFailed": "Unable to read the agent file list. Check whether workspace/agent-data.json has been generated."+ }+ },+ "fileViewer": {+ "edit": "Edit",+ "unknownError": "Unknown error",+ "fileMissingPrefix": "This file does not exist. Create the Markdown file at",+ "fileMissingSuffix": "before editing.",+ "notPreviewable": "This file cannot be previewed. Only Markdown (.md/.mdx) files are supported."+ },+ "chatUi": {+ "copyMessage": "Copy message",+ "stopReading": "Stop reading",+ "readMessage": "Read message",+ "parallelProgress": "Parallel tasks running ({{completedCount}}/{{total}} complete)",+ "subtask": {+ "starting": "Starting...",+ "toolCall": "Calling {{tool}} (#{{count}})",+ "toolFallback": "tool",+ "toolResult": "Processing result...",+ "taskLabel": "Task {{index}}: {{description}}",+ "callCount": "{{count}} calls"+ },+ "toolResult": {+ "success": "done",+ "failed": "failed",+ "timeout": "Execution timed out",+ "arguments": "Arguments",+ "result": "Result",+ "truncated": "result truncated"+ },+ "toolGroup": {+ "executed": "{{totalPairs}} tool calls executed",+ "pending": "{{pendingCount}} running",+ "timeout": "{{timeoutCount}} timed out",+ "latest": "↓ Latest"+ },+ "inlineQuestion": {+ "header": "Evolution approval",+ "selected": "Selected",+ "accept": "Accept",+ "reject": "Reject"+ }+ },+ "network": {+ "wsError": "WebSocket connection error",+ "connectionClosedWithCode": "Connection closed ({{code}})",+ "connectionClosed": "Connection closed",+ "connectionUnavailable": "Connection unavailable",+ "requestTimeout": "Request timed out",+ "requestAborted": "Request aborted",+ "requestFailed": "Request failed",+ "sendMessageFailed": "Failed to send message",+ "interruptFailed": "Interrupt failed",+ "pauseFailed": "Pause failed",+ "cancelFailed": "Cancel failed",+ "supplementFailed": "Supplement failed",+ "resumeFailed": "Resume failed",+ "submitAnswerFailed": "Failed to submit answer",+ "unknownError": "Unknown error",+ "errorPrefix": "Error: {{message}}"+ },+ "speech": {+ "recognitionUnsupported": "Speech recognition is not supported by this browser",+ "synthesisUnsupported": "Speech synthesis is not supported by this browser",+ "errors": {+ "noSpeech": "No speech detected",+ "noMic": "No microphone detected",+ "notAllowed": "Microphone permission denied",+ "network": "Network error",+ "recognitionGeneric": "Speech recognition error: {{error}}",+ "synthesisGeneric": "Speech synthesis error: {{error}}"+ }+ },+ "time": {+ "daysAgo": "{{count}} day(s) ago",+ "hoursAgo": "{{count}} hour(s) ago",+ "minutesAgo": "{{count}} minute(s) ago",+ "justNow": "Just now"+ },+ "version": "Version {{version}}",+ "app": {+ "title": "JiuwenClaw",+ "subtitle": "AI Assistant",+ "errorTitle": "Application Error",+ "unknownError": "Unknown error",+ "reload": "Reload page",+ "themeSystem": "Follow system",+ "themeDark": "Dark mode",+ "themeLight": "Light mode",+ "configError": "Failed to fetch config via WebSocket, using defaults",+ "configErrorHint": "Please start the backend first (e.g.",+ "configErrorDefault": ", default port 19000). If backend is remote, set",+ "configErrorEnv": "in",+ "heartbeatTitle": "Heartbeat message",+ "heartbeatClose": "Close",+ "heartbeatViewFull": "Click to view full message",+ "noContent": "No details",+ "restarting": "Restarting service",+ "restartSuccess": "Restart successful",+ "configApplied": "Config applied",+ "restartWaiting": "Waiting for backend to restart and reconnect...",+ "configAppliedDesc": "Config hot-reloaded, this dialog will close in 5 seconds.",+ "restartSuccessDesc": "Backend started successfully, this dialog will close in 5 seconds."+ }+}diff --git a/jiuwenclaw/web/src/i18n/locales/zh.json b/jiuwenclaw/web/src/i18n/locales/zh.jsonnew file mode 100644index 0000000000..75c8f7f84f--- /dev/null+++ b/jiuwenclaw/web/src/i18n/locales/zh.json@@ -0,0 +1,589 @@+{+ "common": {+ "confirm": "确认",+ "cancel": "取消",+ "close": "关闭",+ "refresh": "刷新",+ "refreshing": "刷新中...",+ "loading": "加载中...",+ "save": "保存",+ "saving": "保存中...",+ "error": "错误",+ "ok": "确定",+ "and": "和"+ },+ "nav": {+ "chat": "对话",+ "agent": "智能体",+ "sessions": "会话",+ "heartbeat": "心跳",+ "cron": "定时任务",+ "skills": "技能",+ "channels": "频道",+ "settings": "设置",+ "config": "配置信息",+ "browser": "浏览器服务",+ "logs": "日志"+ },+ "statusBar": {+ "cancel": "取消",+ "pause": "暂停",+ "resume": "恢复",+ "processing": "处理中...",+ "paused": "已暂停",+ "pausedWithTask": "已暂停: {{task}}..."+ },+ "chat": {+ "placeholder": "Enter 发送,Shift+Enter 换行,按住语音键开始录音",+ "placeholderProcessing": "处理中,输入新指令可中断...",+ "placeholderProcessingQueue": "处理中,输入新指令将加入等待队列...",+ "placeholderVoice": "正在听取语音...",+ "welcomeLogoAlt": "JiuwenClaw 标志",+ "welcomeHeading": "你好,我是JiuwenClaw,很高兴认识你!",+ "welcomeSubtext": "我可以帮你回答问题,解决疑惑,还可以帮你完成一些任务。",+ "welcomeSuggestions": {+ "journey": "让我们开启一段新的旅程吧!",+ "skills": "能告诉我你有哪些技能吗?"+ },+ "newSession": "新建会话",+ "sessionCreated": "已新建会话",+ "modePlan": "任务规划",+ "modeAgent": "智能执行",+ "recording": "正在录音...(松开按钮自动发送)",+ "waitingTasks": "等待任务",+ "waitingTasksCount": "等待任务 ({{count}})",+ "removeTask": "移除任务",+ "holdToSpeak": "按住说话",+ "send": "发送 (Enter)",+ "newSessionDisabled": "处理中或录音中不可新建"+ },+ "connection": {+ "connected": "已连接",+ "disconnected": "未连接",+ "connecting": "正在连接服务器...",+ "loadingConfig": "加载配置中..."+ },+ "toolPanel": {+ "status": "状态",+ "contextCompression": "上下文压缩",+ "memoryUsage": "内存占用",+ "message": "消息",+ "time": "时间",+ "heartbeatClick": "心跳消息,点击查看",+ "poweredBy": "Powered by openJiuwen"+ },+ "todoList": {+ "title": "任务列表",+ "empty": "暂无任务",+ "inProgress": "进行中",+ "pending": "待处理",+ "completed": "已完成"+ },+ "sessions": {+ "title": "会话管理",+ "subtitle": "浏览并管理会话与文件",+ "history": "历史会话",+ "count": "最多 20 条,当前 {{count}} 条",+ "empty": "暂无会话",+ "delete": "删除会话",+ "files": "会话文件",+ "selectFirst": "请先选择会话",+ "loadingFiles": "加载文件中...",+ "emptyFiles": "暂无文件",+ "folder": "文件夹",+ "notPreviewable": "不可预览",+ "selectFile": "请选择一个文件查看",+ "noneSelected": "未选择会话",+ "unknownSession": "未知会话-未知时间",+ "unknownTime": "未知时间",+ "deleteConfirm": "确认删除会话 {{session}} ?\n将删除该会话目录下所有文件。",+ "prefixes": {+ "session": "会话",+ "cron": "定时",+ "feishu": "飞书",+ "xiaoyi": "小艺",+ "dingtalk": "钉钉",+ "heartbeat": "心跳",+ "unknown": "未知"+ },+ "errors": {+ "loadSessions": "会话列表加载失败",+ "loadFiles": "会话文件列表加载失败",+ "deleteSession": "删除会话失败:{{sessionId}}"+ }+ },+ "sessionSidebar": {+ "newSession": "新会话"+ },+ "heartbeat": {+ "title": "心跳管理",+ "subtitle": "维护心跳参数与指令文件",+ "configTitle": "心跳参数配置",+ "configSubtitle": "配置心跳间隔、目标频道与生效时间",+ "loadingConfig": "正在加载心跳配置...",+ "saved": "心跳参数已保存",+ "badges": {+ "ok": "最近心跳正常",+ "alert": "最近心跳告警",+ "unknown": "尚无心跳结果"+ },+ "everyLabel": "间隔时间 (秒)",+ "targetLabel": "目标频道 (channel_id)",+ "enableActiveHours": "启用生效时间",+ "startTime": "开始时间",+ "endTime": "结束时间",+ "recentMessages": "最近 20 条心跳消息",+ "noHistory": "暂无历史心跳消息",+ "statusOk": "OK",+ "statusUnknown": "UNKNOWN",+ "latestTime": "最近心跳时间",+ "latestContent": "最近心跳内容",+ "none": "暂无",+ "channels": {+ "web": "网页 (web)",+ "feishu": "飞书 (feishu)",+ "xiaoyi": "小艺 (xiaoyi)",+ "dingtalk": "钉钉 (dingtalk)"+ },+ "errors": {+ "loadConfig": "加载心跳配置失败",+ "saveConfig": "保存心跳配置失败",+ "invalidEvery": "心跳间隔 every 必须是大于 0 的数字",+ "invalidActiveHours": "active_hours 需使用 HH:MM 格式(例如 08:00)",+ "invalidRange": "结束时间必须大于开始时间"+ }+ },+ "heartbeatModal": {+ "closeAria": "关闭心跳详情弹窗",+ "title": "心跳消息",+ "subtitle": "消息内容详情",+ "empty": "无详细内容"+ },+ "offloadFiles": {+ "title": "离线文件",+ "count": "{{count}} 个文件",+ "notConnected": "未连接会话",+ "empty": "暂无离线文件",+ "previewFallback": "离线文件内容",+ "previewTitle": "离线消息文件预览",+ "emptyContent": "文件内容为空",+ "errors": {+ "loadFiles": "获取离线文件失败",+ "loadContent": "加载失败"+ }+ },+ "userQuestion": {+ "title": "需要您的确认",+ "subtitle": "请回答以下问题以继续任务",+ "submit": "确认提交",+ "multiSelect": "(可多选)",+ "customOption": "其他(自定义输入)",+ "customPlaceholder": "请输入您的回答..."+ },+ "sourceManager": {+ "closeAria": "关闭源管理弹窗",+ "title": "源管理",+ "subtitle": "添加、删除或启用/禁用技能源",+ "addTitle": "添加源",+ "add": "添加",+ "configuredCount": "已配置源({{count}} 个)",+ "empty": "暂无已配置源",+ "updatedAt": "更新于 {{time}}",+ "placeholders": {+ "name": "源名称",+ "url": "Git 仓库地址(https://...)"+ },+ "status": {+ "enabled": "已启用",+ "disabled": "已禁用"+ },+ "actions": {+ "enable": "启用",+ "disable": "禁用",+ "delete": "删除"+ },+ "messages": {+ "fillRequired": "请先填写源名称和仓库 URL",+ "addFailed": "添加源失败",+ "addFailedCheck": "添加源失败,请检查名称或 URL",+ "added": "已添加源:{{name}}(默认禁用)",+ "confirmDelete": "确认删除源 {{name}} ?",+ "removeFailed": "删除源失败",+ "removeFailedRetry": "删除源失败,请稍后重试",+ "removed": "已删除源:{{name}}",+ "toggleFailed": "切换源状态失败",+ "enabled": "已启用源:{{name}}",+ "disabled": "已禁用源:{{name}}",+ "enableFailed": "启用源失败,请检查网络或仓库地址",+ "disableFailed": "禁用源失败,请稍后重试",+ "loadFailed": "源列表加载失败,请重试"+ }+ },+ "channels": {+ "title": "频道管理",+ "subtitle": "查看并管理频道服务",+ "fetchFailed": "获取失败",+ "retry": "重试",+ "listTitle": "频道列表",+ "listMeta": "频道个数:{{status}},刷新时间:{{time}}",+ "hideValue": "隐藏明文",+ "showValue": "显示明文",+ "labels": {+ "web": "网页",+ "xiaoyi": "小艺",+ "feishu": "飞书",+ "dingtalk": "钉钉"+ },+ "status": {+ "loadFailed": "加载失败",+ "enabledSummary": "{{enabledCount}}/{{total}} 已启用",+ "adapting": "适配中",+ "enabled": "已启用",+ "disabled": "未启用"+ },+ "config": {+ "webTitle": "网页频道参数配置",+ "webSubtitle": "配置网页频道服务相关参数",+ "webEmpty": "网页频道暂无配置,点击其他频道加载配置。",+ "xiaoyiTitle": "小艺频道参数配置",+ "xiaoyiSubtitle": "配置小艺频道服务相关参数",+ "dingtalkTitle": "钉钉频道参数配置",+ "dingtalkSubtitle": "配置钉钉频道服务相关参数",+ "feishuTitle": "飞书频道参数配置",+ "feishuSubtitle": "配置飞书频道服务相关参数"+ },+ "loading": {+ "xiaoyi": "正在加载小艺配置...",+ "dingtalk": "正在加载钉钉配置...",+ "feishu": "正在加载飞书配置..."+ },+ "placeholders": {+ "configValue": "请输入配置值",+ "appId": "请输入应用 ID",+ "appSecret": "请输入应用密钥",+ "employeeIds": "每行一个员工 ID(也支持逗号分隔)",+ "chatId": "请输入聊天 ID",+ "ids": "每行一个 ID(也支持逗号分隔)"+ },+ "saved": {+ "feishu": "飞书配置已保存",+ "xiaoyi": "小艺配置已保存",+ "dingtalk": "钉钉配置已保存"+ },+ "errors": {+ "loadChannels": "获取 channels 失败",+ "loadFeishu": "获取飞书配置失败",+ "loadXiaoyi": "获取小艺配置失败",+ "loadDingtalk": "获取钉钉配置失败",+ "saveGeneric": "保存失败,请稍后重试"+ }+ },+ "config": {+ "title": "配置信息",+ "subtitle": "修改后端服务配置,保存后后端将自动重启以加载最新配置。",+ "groupFallback": "参数分组",+ "itemsCount": "{{count}} 项",+ "groupsCount": "共 {{count}} 个配置组",+ "paramsCount": "{{count}} 项参数",+ "requiredIncomplete": "模型配置必填项未完成",+ "empty": "暂未获取到配置,请确认后端服务状态。",+ "selectModelProvider": "请选择模型提供商",+ "enterValue": "请输入配置值",+ "hideValue": "隐藏明文",+ "showValue": "显示明文",+ "groups": {+ "model": { "label": "模型配置", "hint": "模型服务与鉴权参数" },+ "embed": { "label": "Embed配置", "hint": "Embed 服务与鉴权参数" },+ "thirdParty": { "label": "第三方服务配置", "hint": "API Key 配置" },+ "evolution": { "label": "自演进配置", "hint": "Skills 在线自演进参数" },+ "email": { "label": "邮箱配置", "hint": "邮件账号与令牌参数" },+ "other": { "label": "其他配置", "hint": "未归类的扩展参数" }+ },+ "errors": {+ "requiredModelFields": "模型配置为必填:{{fields}}。请完整填写后再保存并重启。",+ "saveFailed": "保存失败,请稍后重试"+ }+ },+ "cron": {+ "title": "定时任务管理",+ "subtitle": "使用 cron 表达式管理定时任务,支持添加、启用和删除操作",+ "create": "创建任务",+ "cancelCreate": "取消创建",+ "update": "更新",+ "delete": "删除",+ "enable": "启动",+ "disable": "停用",+ "loading": "正在加载任务列表...",+ "empty": "暂无定时任务",+ "deleteConfirm": "确定要删除这个任务吗?",+ "status": {+ "enabled": "启用",+ "disabled": "禁用"+ },+ "columns": {+ "name": "任务名称",+ "cron": "Cron 表达式",+ "status": "状态",+ "description": "描述",+ "wakeOffset": "唤醒偏移秒数",+ "timezone": "时区",+ "target": "推送频道",+ "actions": "操作"+ },+ "placeholders": {+ "name": "输入任务名称",+ "cron": "5段式:分 时 日 月 周。例:每周一11时58分='58 11 * * 1'",+ "cronShort": "例:58 11 * * 1",+ "description": "输入描述",+ "wakeOffset": "唤醒偏移秒数"+ },+ "targets": {+ "web": "网页 (web)",+ "feishu": "飞书 (feishu)",+ "xiaoyi": "小艺 (xiaoyi)",+ "dingtalk": "钉钉 (dingtalk)"+ },+ "success": {+ "created": "任务创建成功",+ "updated": "任务更新成功",+ "deleted": "任务删除成功",+ "statusUpdated": "任务状态更新成功"+ },+ "errors": {+ "loadJobs": "加载定时任务失败",+ "createFailed": "创建任务失败",+ "updateFailed": "更新任务失败",+ "deleteFailed": "删除任务失败",+ "toggleFailed": "更新任务状态失败",+ "loadDetailFailed": "获取任务详情失败",+ "nameRequired": "任务名称不能为空",+ "cronRequired": "Cron 表达式不能为空",+ "timezoneRequired": "时区不能为空",+ "targetRequired": "推送频道不能为空",+ "descriptionRequired": "描述不能为空"+ }+ },+ "browser": {+ "title": "浏览器服务",+ "subtitle": "配置浏览器路径,启动浏览器服务。",+ "refreshPath": "刷新路径",+ "savePath": "保存路径",+ "startService": "启动浏览器服务",+ "starting": "启动中...",+ "pathConfigHelp": "CHROME 路径配置(Chrome地址栏输入:chrome://version查看,复制可执行文件路径)",+ "examplePath": "例如:/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",+ "success": {+ "pathSaved": "Chrome 路径已保存",+ "started": "浏览器服务启动成功"+ },+ "tooltips": {+ "fillPath": "请先填写 Chrome 路径",+ "savePath": "请先保存 Chrome 路径"+ },+ "errors": {+ "loadPath": "加载 Chrome 路径失败",+ "savePath": "保存 Chrome 路径失败",+ "pathRequired": "Chrome 路径不能为空",+ "saveBeforeStart": "请先保存 Chrome 路径后再启动浏览器服务",+ "startFailed": "启动浏览器服务失败",+ "startFailedWithCode": "浏览器服务启动失败,返回码 {{code}}",+ "startFailedWithMessage": "浏览器服务启动失败:{{message}}"+ }+ },+ "logsPanel": {+ "title": "日志",+ "dataSource": "数据源",+ "debugSetting": "调试模式设置中...",+ "debugOn": "调试模式开",+ "debugOff": "调试模式关",+ "autoRefreshOn": "自动刷新开",+ "autoRefreshOff": "自动刷新关",+ "recentLogs": "最近日志(最多 300 条)",+ "countVisible": "{{count}} 条",+ "countVisibleTotal": "{{visible}} 条(总 {{total}} 条)",+ "empty": "暂无日志",+ "errors": {+ "readLogs": "读取日志失败",+ "readDebugConfig": "读取 WS 调试配置失败",+ "updateDebugConfig": "更新 WS 调试配置失败"+ }+ },+ "skills": {+ "title": "技能管理",+ "subtitle": "管理并安装智能体可用的技能。",+ "actions": {+ "install": "安装",+ "uninstall": "卸载",+ "importLocal": "导入本地技能",+ "sourceManager": "源管理",+ "backToList": "返回列表"+ },+ "builtIn": "内置",+ "status": {+ "installed": "已安装",+ "notInstalled": "未安装",+ "builtIn": "内置"+ },+ "source": {+ "local": "本地",+ "project": "项目",+ "unknown": "未知"+ },+ "sourceLabel": "来源",+ "statusLabel": "状态",+ "versionLabel": "版本",+ "authorLabel": "作者",+ "allowedTools": "允许工具",+ "unlimited": "无限制",+ "contentPreview": "内容预览",+ "noDescription": "暂无描述",+ "noContent": "暂无内容",+ "searchPlaceholder": "搜索技能名称、描述或标签",+ "totalCount": "共 {{count}} 个",+ "listError": "获取技能失败,请检查后端服务",+ "noMatches": "暂无匹配的技能",+ "detailLoading": "加载详情中...",+ "detailError": "加载详情失败",+ "marketplacesAvailable": "可用 marketplace: {{names}}",+ "marketplacesDefault": "默认 marketplace: anthropics",+ "installPrompt": "请输入插件规格 (plugin@marketplace)",+ "importPrompt": "请输入服务端本地 skill 路径(SKILL.md 或目录)",+ "uninstallConfirm": "确认卸载 {{pluginName}} ?",+ "messages": {+ "installed": "已安装:{{spec}}",+ "imported": "已导入:{{name}}",+ "uninstalled": "已卸载:{{pluginName}}"+ },+ "errors": {+ "installFailed": "安装失败",+ "installFailedHint": "安装失败,请检查插件规格或网络",+ "importFailed": "导入失败",+ "importFailedHint": "导入失败,请检查路径或权限",+ "uninstallFailed": "卸载失败",+ "uninstallFailedHint": "卸载失败,请稍后重试"+ }+ },+ "agent": {+ "title": "智能体管理",+ "subtitle": "查看智能体工作区文件与记忆内容",+ "root": "根目录",+ "workspace": "工作区",+ "workspaceMeta": "{{directories}} 个目录,{{files}} 个文件",+ "directoryCount": "{{count}} 个目录",+ "fileCount": "{{count}} 个文件",+ "previewableCount": "{{count}} 个可预览",+ "refresh": "刷新列表",+ "empty": "暂无文件",+ "notPreviewable": "不可预览",+ "contentPreview": "内容预览",+ "selectMarkdown": "选择左侧 Markdown 文件查看",+ "selectMarkdownContent": "请选择左侧 Markdown 文件查看内容",+ "markdownOnly": "仅支持 Markdown(.md/.mdx)预览",+ "errors": {+ "refreshFailed": "刷新失败:无法重建 agent 文件索引,请检查生成脚本日志。",+ "loadFailed": "无法读取 agent 文件列表,请检查 workspace/agent-data.json 是否已生成。"+ }+ },+ "fileViewer": {+ "edit": "编辑",+ "unknownError": "未知错误",+ "fileMissingPrefix": "文件不存在。请先在",+ "fileMissingSuffix": "创建该 Markdown 文件后再编辑。",+ "notPreviewable": "该文件无法预览,仅支持 Markdown(.md/.mdx)文件"+ },+ "chatUi": {+ "copyMessage": "复制消息",+ "stopReading": "停止朗读",+ "readMessage": "朗读消息",+ "parallelProgress": "并行任务执行中 ({{completedCount}}/{{total}} 完成)",+ "subtask": {+ "starting": "启动中...",+ "toolCall": "调用 {{tool}} (#{{count}})",+ "toolFallback": "工具",+ "toolResult": "处理结果...",+ "taskLabel": "任务 {{index}}: {{description}}",+ "callCount": "{{count}} 次调用"+ },+ "toolResult": {+ "success": "完成",+ "failed": "失败",+ "timeout": "执行超时",+ "arguments": "参数",+ "result": "结果",+ "truncated": "结果已截断"+ },+ "toolGroup": {+ "executed": "已执行 {{totalPairs}} 次工具调用",+ "pending": "{{pendingCount}} 个执行中",+ "timeout": "{{timeoutCount}} 个超时",+ "latest": "↓ 最新"+ },+ "inlineQuestion": {+ "header": "演进审批",+ "selected": "已选择",+ "accept": "接收",+ "reject": "拒绝"+ }+ },+ "network": {+ "wsError": "WebSocket 连接异常",+ "connectionClosedWithCode": "连接已关闭 ({{code}})",+ "connectionClosed": "连接已关闭",+ "connectionUnavailable": "连接不可用",+ "requestTimeout": "请求超时",+ "requestAborted": "请求已取消",+ "requestFailed": "请求失败",+ "sendMessageFailed": "发送消息失败",+ "interruptFailed": "中断失败",+ "pauseFailed": "暂停失败",+ "cancelFailed": "取消失败",+ "supplementFailed": "补充失败",+ "resumeFailed": "恢复失败",+ "submitAnswerFailed": "提交回答失败",+ "unknownError": "未知错误",+ "errorPrefix": "错误: {{message}}"+ },+ "speech": {+ "recognitionUnsupported": "浏览器不支持语音识别",+ "synthesisUnsupported": "浏览器不支持语音合成",+ "errors": {+ "noSpeech": "未检测到语音",+ "noMic": "未检测到麦克风",+ "notAllowed": "麦克风权限被拒绝",+ "network": "网络错误",+ "recognitionGeneric": "语音识别错误: {{error}}",+ "synthesisGeneric": "语音合成错误: {{error}}"+ }+ },+ "time": {+ "daysAgo": "{{count}}天前",+ "hoursAgo": "{{count}}小时前",+ "minutesAgo": "{{count}}分钟前",+ "justNow": "刚刚"+ },+ "version": "版本 {{version}}",+ "app": {+ "title": "JiuwenClaw",+ "subtitle": "AI Assistant",+ "errorTitle": "应用加载出错",+ "unknownError": "未知错误",+ "reload": "刷新页面",+ "themeSystem": "跟随系统",+ "themeDark": "深色模式",+ "themeLight": "浅色模式",+ "configError": "无法通过 WebSocket 获取后端配置,已使用默认配置",+ "configErrorHint": "请先启动 E2E 后端(如",+ "configErrorDefault": ",默认监听 19000)。若后端不在本机或端口不同,可在",+ "configErrorEnv": "设置",+ "heartbeatTitle": "心跳消息",+ "heartbeatClose": "关闭",+ "heartbeatViewFull": "点击查看完整心跳消息",+ "noContent": "无详细内容",+ "restarting": "正在重启服务",+ "restartSuccess": "重启成功",+ "configApplied": "配置已生效",+ "restartWaiting": "正在等待后端重新启动并恢复连接,请稍候...",+ "configAppliedDesc": "配置已热更新,窗口将在 5 秒后自动关闭。",+ "restartSuccessDesc": "后端已启动成功,窗口将在 5 秒后自动关闭。"+ }+}diff --git a/jiuwenclaw/web/src/main.tsx b/jiuwenclaw/web/src/main.tsxindex 7f0c425cc5..bb903bbcc2 100644--- a/jiuwenclaw/web/src/main.tsx+++ b/jiuwenclaw/web/src/main.tsx@@ -1,4 +1,5 @@-import ReactDOM from 'react-dom/client'+import './i18n';+import ReactDOM from 'react-dom/client';import App from './App.tsx'import './index.css'diff --git a/jiuwenclaw/web/src/services/webClient.ts b/jiuwenclaw/web/src/services/webClient.tsindex a8a3384d8e..16fa9eb8c3 100644--- a/jiuwenclaw/web/src/services/webClient.ts+++ b/jiuwenclaw/web/src/services/webClient.ts@@ -9,6 +9,7 @@ import {WsResponse,} from '../types';import { getWsBase } from '../utils/env';+import i18n from '../i18n';type EventHandler = (event: WsEvent) => void;type StateHandler = (state: WebConnectionState) => void;@@ -151,7 +152,7 @@ class WebClient {data: { event: 'error' },});const error = this.createWebError(- 'WebSocket 连接异常',+ i18n.t('network.wsError'),'WS_ERROR',undefined,true@@ -176,7 +177,7 @@ class WebClient {this.connectPromise = null;this.rejectAllPending(this.createWebError(- `连接已关闭 (${closeEvent.code})`,+ i18n.t('network.connectionClosedWithCode', { code: closeEvent.code }),'WS_DISCONNECTED',undefined,true@@ -197,7 +198,7 @@ class WebClient {this.manualClose = true;this.clearReconnectTimer();this.rejectAllPending(- this.createWebError('连接已关闭', 'WS_CLOSED', undefined, false)+ this.createWebError(i18n.t('network.connectionClosed'), 'WS_CLOSED', undefined, false));const currentWs = this.ws;let closedPromise = Promise.resolve();@@ -239,7 +240,7 @@ class WebClient {await this.ensureReady();if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {- throw this.createWebError('连接不可用', 'WS_NOT_READY', undefined, true);+ throw this.createWebError(i18n.t('network.connectionUnavailable'), 'WS_NOT_READY', undefined, true);}const id = this.generateRequestId();@@ -254,7 +255,7 @@ class WebClient {return new Promise<T>((resolve, reject) => {const timeoutId = window.setTimeout(() => {this.pending.delete(id);- reject(this.createWebError('请求超时', 'REQUEST_TIMEOUT', id, true));+ reject(this.createWebError(i18n.t('network.requestTimeout'), 'REQUEST_TIMEOUT', id, true));}, timeoutMs);const pending: PendingRequest = {@@ -271,7 +272,7 @@ class WebClient {}window.clearTimeout(timeoutId);this.pending.delete(id);- reject(this.createWebError('请求已取消', 'REQUEST_ABORTED', id, false));+ reject(this.createWebError(i18n.t('network.requestAborted'), 'REQUEST_ABORTED', id, false));};if (options.signal.aborted) {onAbort();@@ -402,7 +403,7 @@ class WebClient {pending.reject(this.createWebError(- message.error ?? '请求失败',+ message.error ?? i18n.t('network.requestFailed'),message.code,message.id,this.isRetriableCode(message.code)diff --git a/jiuwenclaw/web/src/utils/formatters.ts b/jiuwenclaw/web/src/utils/formatters.tsindex be84c02367..b443122be1 100644--- a/jiuwenclaw/web/src/utils/formatters.ts+++ b/jiuwenclaw/web/src/utils/formatters.ts@@ -1,13 +1,14 @@/*** 格式化工具函数*/+import i18n from '../i18n';/*** 格式化时间戳*/export function formatTimestamp(timestamp: string): string {const date = new Date(timestamp);- return date.toLocaleTimeString('zh-CN', {+ return date.toLocaleTimeString(i18n.language, {hour: '2-digit',minute: '2-digit',second: '2-digit',@@ -19,7 +20,7 @@ export function formatTimestamp(timestamp: string): string {*/export function formatDate(timestamp: string): string {const date = new Date(timestamp);- return date.toLocaleDateString('zh-CN', {+ return date.toLocaleDateString(i18n.language, {year: 'numeric',month: '2-digit',day: '2-digit',@@ -39,10 +40,10 @@ export function formatRelativeTime(timestamp: string): string {const hours = Math.floor(minutes / 60);const days = Math.floor(hours / 24);- if (days > 0) return `${days}天前`;- if (hours > 0) return `${hours}小时前`;- if (minutes > 0) return `${minutes}分钟前`;- return '刚刚';+ if (days > 0) return i18n.t('time.daysAgo', { count: days });+ if (hours > 0) return i18n.t('time.hoursAgo', { count: hours });+ if (minutes > 0) return i18n.t('time.minutesAgo', { count: minutes });+ return i18n.t('time.justNow');}/**@@ -69,5 +70,5 @@ export function formatToolArguments(args: Record<string, unknown>): string {*/export function formatToolResult(result: string, maxLength = 500): string {if (result.length <= maxLength) return result;- return result.slice(0, maxLength) + '\n... (结果已截断)';+ return result.slice(0, maxLength) + `\n... (${i18n.t('chatUi.toolResult.truncated')})`;}