🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🌐 chore: translate non-English comments to English in src/store (#12001)
LobeHub Bot5086a126a7d4
diff --git a/src/store/chat/slices/topic/action.ts b/src/store/chat/slices/topic/action.tsindex b600e2ec2a9..8478f40451a 100644--- a/src/store/chat/slices/topic/action.ts+++ b/src/store/chat/slices/topic/action.ts@@ -616,7 +616,7 @@ export const chatTopic: StateCreator<await topicService.batchRemoveTopics(topics.map((t) => t.id));await refreshTopic();- // 切换到默认 topic+ // Switch to default topicswitchTopic(null);},diff --git a/src/store/electron/actions/settings.ts b/src/store/electron/actions/settings.tsindex eda7d37eb04..e95a1c87a7c 100644--- a/src/store/electron/actions/settings.ts+++ b/src/store/electron/actions/settings.ts@@ -9,7 +9,7 @@ import { desktopSettingsService } from '@/services/electron/settings';import type { ElectronStore } from '../store';/**- * 设置操作+ * Settings actions*/export interface ElectronSettingsAction {refreshDesktopHotkeys: () => Promise<void>;@@ -39,29 +39,29 @@ export const settingsSlice: StateCreator<setProxySettings: async (values) => {try {- // 更新设置+ // Update settingsawait desktopSettingsService.setSettings(values);- // 刷新状态+ // Refresh stateawait get().refreshProxySettings();} catch (error) {- console.error('代理设置更新失败:', error);+ console.error('Proxy settings update failed:', error);}},updateDesktopHotkey: async (id, accelerator) => {try {- // 更新热键配置+ // Update hotkey configurationconst result = await desktopSettingsService.updateDesktopHotkey(id, accelerator);- // 如果更新成功,刷新状态+ // If update successful, refresh stateif (result.success) {await get().refreshDesktopHotkeys();}return result;} catch (error) {- console.error('桌面热键更新失败:', error);+ console.error('Desktop hotkey update failed:', error);return {errorType: 'UNKNOWN' as const,success: false,diff --git a/src/store/electron/actions/sync.ts b/src/store/electron/actions/sync.tsindex 34461a25e39..cf532dc5985 100644--- a/src/store/electron/actions/sync.ts+++ b/src/store/electron/actions/sync.ts@@ -10,7 +10,7 @@ import { initialState } from '../initialState';import type { ElectronStore } from '../store';/**- * 设置操作+ * Remote server actions*/export interface ElectronRemoteServerAction {clearRemoteServerSyncError: () => void;@@ -39,28 +39,28 @@ export const remoteSyncSlice: StateCreator<set({ isConnectingServer: true });get().clearRemoteServerSyncError();try {- // 获取当前配置+ // Get current configurationconst config = await remoteServerService.getRemoteServerConfig();- // 如果已经激活,需要先清除+ // If already active, need to clear firstif (!isEqual(config, values)) {await remoteServerService.setRemoteServerConfig({ ...values, active: false });}- // 请求授权+ // Request authorizationconst result = await remoteServerService.requestAuthorization(values);if (!result.success) {- console.error('请求授权失败:', result.error);+ console.error('Authorization request failed:', result.error);set({remoteServerSyncError: { message: result.error, type: 'AUTH_ERROR' },});}- // 刷新状态+ // Refresh stateawait get().refreshServerConfig();} catch (error) {- console.error('远程服务器配置出错:', error);+ console.error('Remote server configuration error:', error);set({remoteServerSyncError: { message: (error as Error).message, type: 'CONFIG_ERROR' },});@@ -74,12 +74,12 @@ export const remoteSyncSlice: StateCreator<get().clearRemoteServerSyncError();try {await remoteServerService.setRemoteServerConfig({ active: false, storageMode: 'cloud' });- // 更新表单URL为空+ // Update form URL to emptyset({ dataSyncConfig: initialState.dataSyncConfig });- // 刷新状态+ // Refresh stateawait get().refreshServerConfig();} catch (error) {- console.error('断开连接失败:', error);+ console.error('Disconnect failed:', error);set({remoteServerSyncError: { message: (error as Error).message, type: 'DISCONNECT_ERROR' },});@@ -110,7 +110,7 @@ export const remoteSyncSlice: StateCreator<try {return await remoteServerService.getRemoteServerConfig();} catch (error) {- console.error('获取远程服务器配置失败:', error);+ console.error('Failed to get remote server configuration:', error);throw error;}},diff --git a/src/store/global/actions/general.ts b/src/store/global/actions/general.tsindex 086de7f2768..23cb984530e 100644--- a/src/store/global/actions/general.ts+++ b/src/store/global/actions/general.ts@@ -188,18 +188,18 @@ export const generalActionSlice: StateCreator<if (!clientVersion || !serverVersion) return;const DIFF_THRESHOLD = 5;- // 版本差异计算规则- // ┌─────────────────┬────────┬─────────┐- // │ 客户端 → 服务端 │ 差异值 │ 结果 │- // ├─────────────────┼────────┼─────────┤- // │ 1.0.5 → 1.0.0 │ 5 │ ⚠️ 过旧 │- // ├─────────────────┼────────┼─────────┤- // │ 1.1.0 → 1.0.5 │ 5 │ ⚠️ 过旧 │- // ├─────────────────┼────────┼─────────┤- // │ 2.0.0 → 1.9.9 │ 91 │ ⚠️ 过旧 │- // ├─────────────────┼────────┼─────────┤- // │ 1.0.4 → 1.0.0 │ 4 │ ✅ 正常 │- // └─────────────────┴────────┴─────────┘+ // Version difference calculation rules+ // ┌─────────────────┬────────┬───────────┐+ // │ Client → Server │ Diff │ Result │+ // ├─────────────────┼────────┼───────────┤+ // │ 1.0.5 → 1.0.0 │ 5 │ ⚠️ Too old│+ // ├─────────────────┼────────┼───────────┤+ // │ 1.1.0 → 1.0.5 │ 5 │ ⚠️ Too old│+ // ├─────────────────┼────────┼───────────┤+ // │ 2.0.0 → 1.9.9 │ 91 │ ⚠️ Too old│+ // ├─────────────────┼────────┼───────────┤+ // │ 1.0.4 → 1.0.0 │ 4 │ ✅ Normal │+ // └─────────────────┴────────┴───────────┘const versionDiff =(clientVersion.major - serverVersion.major) * 100 +(clientVersion.minor - serverVersion.minor) * 10 +diff --git a/src/store/global/initialState.ts b/src/store/global/initialState.tsindex deb62e49819..29422b2843c 100644--- a/src/store/global/initialState.ts+++ b/src/store/global/initialState.ts@@ -105,18 +105,18 @@ export interface SystemStatus {imagePanelWidth: number;imageTopicPanelWidth?: number;/**- * 应用初始化时不启用 PGLite,只有当用户手动开启时才启用+ * Do not enable PGLite on app initialization, only enable when user manually turns it on*/isEnablePglite?: boolean;isShowCredit?: boolean;knowledgeBaseModalViewMode?: 'list' | 'masonry';language?: LocaleMode;/**- * 记住用户最后选择的图像生成模型+ * Remember user's last selected image generation model*/lastSelectedImageModel?: string;/**- * 记住用户最后选择的图像生成提供商+ * Remember user's last selected image generation provider*/lastSelectedImageProvider?: string;latestChangelogId?: string;@@ -124,11 +124,11 @@ export interface SystemStatus {mobileShowPortal?: boolean;mobileShowTopic?: boolean;/**- * ModelSwitchPanel 的分组模式+ * ModelSwitchPanel grouping mode*/modelSwitchPanelGroupMode?: 'byModel' | 'byProvider';/**- * ModelSwitchPanel 的宽度+ * ModelSwitchPanel width*/modelSwitchPanelWidth?: number;noWideScreen?: boolean;@@ -157,7 +157,7 @@ export interface SystemStatus {showSystemRole?: boolean;systemRoleExpandedMap: Record<string, boolean>;/**- * 是否使用短格式显示 token+ * Whether to display tokens in short format*/tokenDisplayFormatShort?: boolean;/**@@ -177,21 +177,21 @@ export interface GlobalState {initClientDBProcess?: { costTime?: number; phase: 'wasm' | 'dependencies'; progress: number };/**- * 客户端数据库初始化状态- * 启动时为 Idle,完成为 Ready,报错为 Error+ * Client database initialization state+ * Idle on startup, Ready when complete, Error on failure*/initClientDBStage: DatabaseLoadingState;isMobile?: boolean;/**- * 服务端版本过旧,不支持 /api/version 接口- * 需要提示用户更新服务端+ * Server version is too old, does not support /api/version endpoint+ * Need to prompt user to update server*/isServerVersionOutdated?: boolean;isStatusInit?: boolean;latestVersion?: string;navigate?: NavigateFunction;/**- * 服务端版本号,用于检测客户端与服务端版本是否一致+ * Server version number, used to detect client-server version consistency*/serverVersion?: string;sidebarKey: SidebarTabKey;diff --git a/src/store/global/selectors/clientDB.ts b/src/store/global/selectors/clientDB.tsindex 2f20b85ba05..b95019740af 100644--- a/src/store/global/selectors/clientDB.ts+++ b/src/store/global/selectors/clientDB.ts@@ -24,7 +24,7 @@ const displayMigrationStatus = (s: GlobalState) => {status: !!recordInTable ? 'success' : 'error',};})- // 时间倒序+ // Sort by time in descending order.sort((a, b) => b.folderMillis - a.folderMillis));};diff --git a/src/store/global/selectors/systemStatus.ts b/src/store/global/selectors/systemStatus.tsindex d621be850e3..d56271d1def 100644--- a/src/store/global/selectors/systemStatus.ts+++ b/src/store/global/selectors/systemStatus.ts@@ -51,7 +51,7 @@ const getAgentSystemRoleExpanded =(agentId: string) =>(s: GlobalState): boolean => {const map = s.status.systemRoleExpandedMap || {};- return map[agentId] === true; // 角色设定默认为折叠状态+ return map[agentId] === true; // System role is collapsed by default};const disabledModelProvidersSortType = (s: GlobalState) =>diff --git a/src/store/image/slices/generationConfig/action.ts b/src/store/image/slices/generationConfig/action.tsindex 4b1565f662c..a4c63b1cef6 100644--- a/src/store/image/slices/generationConfig/action.ts+++ b/src/store/image/slices/generationConfig/action.ts@@ -40,7 +40,7 @@ export interface GenerationConfigAction {toggleAspectRatioLock(): void;setAspectRatio(aspectRatio: string): void;- // 初始化相关方法+ // Initialization related methods_initializeDefaultImageConfig(): void;initializeImageConfig(isLogin?: boolean,@@ -185,12 +185,12 @@ export const createGenerationConfigSlice: StateCreator<} = state;const newLockState = !isAspectRatioLocked;- // 如果是从解锁变为锁定,且有活动的宽高比,则立即调整尺寸+ // If transitioning from unlocked to locked and there's an active aspect ratio, adjust dimensions immediatelyif (newLockState && activeAspectRatio && parameters && parametersSchema) {const currentWidth = parameters.width;const currentHeight = parameters.height;- // 只有当width和height都存在时才进行调整+ // Only adjust when both width and height existif (typeof currentWidth === 'number' &&typeof currentHeight === 'number' &&@@ -200,9 +200,9 @@ export const createGenerationConfigSlice: StateCreator<const targetRatio = parseRatio(activeAspectRatio);const currentRatio = currentWidth / currentHeight;- // 如果当前比例与目标比例不匹配,则需要调整+ // If current ratio doesn't match target ratio, adjustment is neededif (Math.abs(currentRatio - targetRatio) > 0.01) {- // 允许小误差+ // Allow small margin of errorconst widthSchema = parametersSchema.width;const heightSchema = parametersSchema.height;@@ -214,19 +214,19 @@ export const createGenerationConfigSlice: StateCreator<typeof heightSchema.max === 'number' &&typeof heightSchema.min === 'number') {- // 优先保持宽度,调整高度+ // Prioritize keeping width, adjust heightlet newWidth = currentWidth;let newHeight = Math.round(currentWidth / targetRatio);- // 如果计算出的高度超出范围,则改为保持高度,调整宽度+ // If calculated height is out of range, switch to keeping height and adjust widthif (newHeight > heightSchema.max || newHeight < heightSchema.min) {newHeight = currentHeight;newWidth = Math.round(currentHeight * targetRatio);- // 确保宽度也在范围内+ // Ensure width is also within rangenewWidth = Math.max(Math.min(newWidth, widthSchema.max), widthSchema.min);} else {- // 确保高度在范围内+ // Ensure height is within rangenewHeight = Math.max(Math.min(newHeight, heightSchema.max), heightSchema.min);}@@ -253,7 +253,7 @@ export const createGenerationConfigSlice: StateCreator<const defaultValues = extractDefaultValues(parametersSchema);const newParams = { ...parameters };- // 如果模型支持 width/height,则计算新尺寸+ // If model supports width/height, calculate new dimensionsif (parametersSchema?.width &¶metersSchema?.height &&@@ -266,7 +266,7 @@ export const createGenerationConfigSlice: StateCreator<newParams.height = height;}- // 如果模型本身支持 aspectRatio,则更新它+ // If model itself supports aspectRatio, update itif (parametersSchema?.aspectRatio) {newParams.aspectRatio = aspectRatio;}@@ -297,7 +297,7 @@ export const createGenerationConfigSlice: StateCreator<`setModelAndProviderOnSelect/${model}/${provider}`,);- // 仅在登录用户下记忆上次选择,保持与恢复策略一致+ // Only remember last selection for logged-in users, consistent with recovery strategyconst isLogin = authSelectors.isLogin(useUserStore.getState());if (isLogin) {useGlobalStore.getState().updateSystemStatus({diff --git a/src/store/image/utils/size.ts b/src/store/image/utils/size.tsindex 42284f3bd6f..62491a66b28 100644--- a/src/store/image/utils/size.ts+++ b/src/store/image/utils/size.ts@@ -1,7 +1,7 @@/**- * 解析比例字符串,例如 "16:9" -> 1.777- * @param ratio - 格式为 "width:height" 的比例字符串- * @returns 比例数值,出现错误时返回 1:1 比例+ * Parse ratio string, e.g., "16:9" -> 1.777+ * @param ratio - Ratio string in "width:height" format+ * @returns Ratio value, returns 1:1 ratio on error*/export function parseRatio(ratio: string): number {if (!ratio || typeof ratio !== 'string') return 1;@@ -21,14 +21,14 @@ export function parseRatio(ratio: string): number {}/**- * 根据目标比例和默认尺寸,计算最合适的尺寸- * @param ratio - 目标宽高比例- * @param defaultWidth - 默认宽度- * @param defaultHeight - 默认高度- * @returns 计算出的尺寸对象+ * Calculate the most appropriate size based on target ratio and default dimensions+ * @param ratio - Target aspect ratio+ * @param defaultWidth - Default width+ * @param defaultHeight - Default height+ * @returns Calculated size object*/export function adaptSizeToRatio(ratio: number, defaultWidth: number, defaultHeight: number) {- // 验证输入参数+ // Validate input parametersif (!Number.isFinite(ratio) || ratio <= 0) {throw new Error('Invalid ratio: must be a positive finite number');}@@ -42,10 +42,10 @@ export function adaptSizeToRatio(ratio: number, defaultWidth: number, defaultHeiconst currentRatio = defaultWidth / defaultHeight;if (ratio > currentRatio) {- // 目标比例更宽,保持宽度,调整高度+ // Target ratio is wider, keep width and adjust heightreturn { width: defaultWidth, height: Math.round(defaultWidth / ratio) };} else {- // 目标比例更高,保持高度,调整宽度+ // Target ratio is taller, keep height and adjust widthreturn { width: Math.round(defaultHeight * ratio), height: defaultHeight };}}diff --git a/src/store/library/slices/ragEval/actions/dataset.ts b/src/store/library/slices/ragEval/actions/dataset.tsindex c09950950f7..e00f44c2fca 100644--- a/src/store/library/slices/ragEval/actions/dataset.ts+++ b/src/store/library/slices/ragEval/actions/dataset.ts@@ -42,7 +42,7 @@ export const createRagEvalDatasetSlice: StateCreator<const fileType = file.name.split('.').pop();if (fileType === 'jsonl') {- // jsonl 文件 需要拆分成单个条,然后逐一校验格式+ // jsonl file needs to be split into individual entries, then validated one by oneconst jsonl = await file.text();const { default: JSONL } = await import('jsonl-parse-stringify');diff --git a/src/store/session/slices/session/initialState.ts b/src/store/session/slices/session/initialState.tsindex 6b1479e5321..3e28ede8beb 100644--- a/src/store/session/slices/session/initialState.ts+++ b/src/store/session/slices/session/initialState.ts@@ -3,8 +3,8 @@ import { type LobeSessions } from '@/types/session';export interface SessionState {activeAgentId?: string;/**- * @title 当前活动的会话- * @description 当前正在编辑或查看的会话+ * @title Current active session+ * @description The session currently being edited or viewed*/activeId: string;/**@@ -22,14 +22,14 @@ export interface SessionState {pinnedSessions: LobeSessions;searchKeywords: string;/**- * @title 正在重命名的会话 ID- * @description 用于控制会话重命名弹窗的显示状态+ * @title Session ID being renamed+ * @description Used to control the display state of the session rename modal*/sessionRenamingId: string | null;sessionSearchKeywords?: string;/**- * @title 正在更新的会话 ID- * @description 用于显示会话更新时的加载状态+ * @title Session ID being updated+ * @description Used to display loading state when session is being updated*/sessionUpdatingId: string | null;/**diff --git a/src/store/session/slices/session/reducers.ts b/src/store/session/slices/session/reducers.tsindex 1f73b51ea4b..139bcf0920e 100644--- a/src/store/session/slices/session/reducers.ts+++ b/src/store/session/slices/session/reducers.ts@@ -27,7 +27,7 @@ export const sessionsReducer = (state: LobeSessions, payload: SessionDispatch):const { session } = payload;if (!session) return;- // TODO: 后续将 Date 类型做个迁移,就可以移除这里的 ignore 了+ // TODO: Migrate Date type in the future to remove this ignore// @ts-ignoredraft.unshift({ ...session, createdAt: new Date(), updatedAt: new Date() });});diff --git a/src/store/session/slices/sessionGroup/initialState.ts b/src/store/session/slices/sessionGroup/initialState.tsindex c01bc2089e3..ec2b97f541b 100644--- a/src/store/session/slices/sessionGroup/initialState.ts+++ b/src/store/session/slices/sessionGroup/initialState.ts@@ -4,8 +4,8 @@ export interface SessionGroupState {customSessionGroups: CustomSessionGroup[];sessionGroupRenamingId: string | null;/**- * @title 正在更新的分组 ID- * @description 用于显示分组更新时的加载状态+ * @title Group ID being updated+ * @description Used to display loading state when group is being updated*/sessionGroupUpdatingId: string | null;sessionGroups: LobeSessionGroups;diff --git a/src/store/tool/slices/customPlugin/action.ts b/src/store/tool/slices/customPlugin/action.tsindex 57fb3983dcb..33310481557 100644--- a/src/store/tool/slices/customPlugin/action.ts+++ b/src/store/tool/slices/customPlugin/action.ts@@ -93,10 +93,10 @@ export const createCustomPluginSlice: StateCreator<updateCustomPlugin: async (id, value) => {const { reinstallCustomPlugin } = get();- // 1. 更新 list 项信息+ // 1. Update list item informationawait pluginService.updatePlugin(id, value);- // 2. 重新安装插件+ // 2. Reinstall pluginawait reinstallCustomPlugin(id);},updateNewCustomPlugin: (newCustomPlugin) => {diff --git a/src/store/tool/slices/oldStore/action.ts b/src/store/tool/slices/oldStore/action.tsindex 2c0cb3eb79b..0408e03e92a 100644--- a/src/store/tool/slices/oldStore/action.ts+++ b/src/store/tool/slices/oldStore/action.ts@@ -148,7 +148,7 @@ export const createPluginStoreSlice: StateCreator<loadMorePlugins: () => {const { oldPluginItems, pluginTotalCount, currentPluginPage } = get();- // 检查是否还有更多数据可以加载+ // Check if there is more data to loadif (oldPluginItems.length < (pluginTotalCount || 0)) {set(produce((draft: PluginStoreState) => {@@ -234,19 +234,19 @@ export const createPluginStoreSlice: StateCreator<produce((draft: PluginStoreState) => {draft.pluginSearchLoading = false;- // 设置基础信息+ // Set basic informationif (!draft.isPluginListInit) {draft.activePluginIdentifier = data.items?.[0]?.identifier;draft.isPluginListInit = true;draft.pluginTotalCount = data.totalCount;}- // 累积数据逻辑+ // Accumulate data logicif (params.page === 1) {- // 第一页,直接设置+ // First page, set directlydraft.oldPluginItems = uniqBy(data.items, 'identifier');} else {- // 后续页面,累积数据+ // Subsequent pages, accumulate datadraft.oldPluginItems = uniqBy([...draft.oldPluginItems, ...data.items],'identifier',diff --git a/src/store/userMemory/slices/preference/action.ts b/src/store/userMemory/slices/preference/action.tsindex 93ea62f3446..18cd4d9187c 100644--- a/src/store/userMemory/slices/preference/action.ts+++ b/src/store/userMemory/slices/preference/action.ts@@ -97,28 +97,28 @@ export const createPreferenceSlice: StateCreator<produce((draft) => {draft.preferencesSearchLoading = false;- // 设置基础信息+ // Set basic informationif (!draft.preferencesInit) {draft.preferencesInit = true;draft.preferencesTotal = data.total;}- // 转换数据结构+ // Transform data structureconst transformedItems = data.items.map((item: any) => ({...item.memory,...item.preference,}));- // 累积数据逻辑+ // Accumulate data logicif (page === 1) {- // 第一页,直接设置+ // First page, set directlydraft.preferences = uniqBy(transformedItems, 'id');} else {- // 后续页面,累积数据+ // Subsequent pages, accumulate datadraft.preferences = uniqBy([...draft.preferences, ...transformedItems], 'id');}- // 更新 hasMore+ // Update hasMoredraft.preferencesHasMore = data.items.length >= (params.pageSize || 20);}),false,