🤯 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/app/[variants]/(main)/settings (#12430)
LobeHub Bot7f7eeb8fa834
diff --git a/src/app/[variants]/(main)/settings/_layout/style.ts b/src/app/[variants]/(main)/settings/_layout/style.tsindex f668cde86b8..431e17cd31e 100644--- a/src/app/[variants]/(main)/settings/_layout/style.ts+++ b/src/app/[variants]/(main)/settings/_layout/style.ts@@ -1,7 +1,7 @@import { createStaticStyles } from 'antd-style';export const styles = createStaticStyles(({ css, cssVar }) => ({- // 主容器+ // Main containermainContainer: css`position: relative;overflow: hidden;diff --git a/src/app/[variants]/(main)/settings/apikey/features/ApiKeyDatePicker/index.tsx b/src/app/[variants]/(main)/settings/apikey/features/ApiKeyDatePicker/index.tsxindex ccaca19884d..38e14f14a35 100644--- a/src/app/[variants]/(main)/settings/apikey/features/ApiKeyDatePicker/index.tsx+++ b/src/app/[variants]/(main)/settings/apikey/features/ApiKeyDatePicker/index.tsx@@ -16,7 +16,7 @@ const ApiKeyDatePicker: FC<ApiKeyDatePickerProps> = ({ value, onChange, ...propsconst handleOnChange = (date: Dayjs[] | Dayjs | null) => {// Handle both single date and array (for compatibility)const actualDate = Array.isArray(date) ? date[0] : date;- // 如果选择了日期,设置为当天的 23:59:59+ // If a date is selected, set it to 23:59:59 of that dayconst submitData = actualDate? actualDate.hour(23).minute(59).second(59).millisecond(999): null;diff --git a/src/app/[variants]/(main)/settings/apikey/features/EditableCell/index.tsx b/src/app/[variants]/(main)/settings/apikey/features/EditableCell/index.tsxindex d986e838365..5fecd41c29b 100644--- a/src/app/[variants]/(main)/settings/apikey/features/EditableCell/index.tsx+++ b/src/app/[variants]/(main)/settings/apikey/features/EditableCell/index.tsx@@ -12,24 +12,24 @@ import { useTranslation } from 'react-i18next';import ApiKeyDatePicker from '../ApiKeyDatePicker';-// 内容类型定义+// Content type definitionexport type ContentType = 'text' | 'date';-// 组件Props接口定义+// Component Props interface definitionexport interface EditableCellProps {- /** 是否禁用编辑 */+ /** Whether editing is disabled */disabled?: boolean;- /** 提交回调函数 */+ /** Submit callback function */onSubmit: (value: string | Date | null) => void;- /** 占位符文本 */+ /** Placeholder text */placeholder?: string;- /** 内容类型 */+ /** Content type */type: ContentType;- /** 从数据库中查出的值,不管是什么类型,存进去的都是字符串 */+ /** Value retrieved from the database; regardless of type, it is stored as a string */value: string | null;}-// 样式定义+// Style definitionsconst styles = createStaticStyles(({ css, cssVar }) => ({actionButtons: css`display: flex;@@ -77,19 +77,19 @@ const styles = createStaticStyles(({ css, cssVar }) => ({`,}));-// 主组件实现+// Main component implementationconst EditableCell = memo<EditableCellProps>(({ value, type, onSubmit, placeholder, disabled = false }) => {const { t } = useTranslation('auth');const { message } = App.useApp();- // 编辑状态管理+ // Edit state managementconst [isEditing, setIsEditing] = useState(false);- // 用于Input的ref+ // Ref for the Input elementconst inputRef = useRef<InputRef>(null);- // 格式化显示值+ // Format display valueconst formatDisplayValue = (val: string | null) => {if (type === 'date' && val) {const date = dayjs(val);@@ -100,14 +100,14 @@ const EditableCell = memo<EditableCellProps>(return val || placeholder || '';};- // 开始编辑+ // Start editingconst handleEdit = () => {if (disabled) return;setIsEditing(true);};- // 提交编辑+ // Submit editconst handleSubmit = () => {if (type === 'text') {const inputValue = inputRef.current?.input?.value;@@ -123,12 +123,12 @@ const EditableCell = memo<EditableCellProps>(setIsEditing(false);};- // 取消编辑+ // Cancel editconst handleCancel = () => {setIsEditing(false);};- // 输入框组件的键盘事件处理+ // Keyboard event handler for the input componentconst handleKeyDown = (e: React.KeyboardEvent) => {if (e.key === 'Enter') {e.preventDefault();@@ -139,14 +139,14 @@ const EditableCell = memo<EditableCellProps>(}};- // 日期选择器提交+ // Date picker submit handlerconst handleDatePickerSubmit = (date: Dayjs | null) => {onSubmit(date && dayjs(date).toISOString());setIsEditing(false);};- // 渲染编辑模式+ // Render edit modeconst renderEditMode = () => {switch (type) {case 'text': {@@ -186,7 +186,7 @@ const EditableCell = memo<EditableCellProps>(}};- // 文本类型的编辑模式,展示保存和取消按钮+ // Text type editing mode, showing save and cancel buttonsif (type === 'text' && isEditing) {return (<div className={styles.editingContainer}>@@ -199,12 +199,12 @@ const EditableCell = memo<EditableCellProps>();}- // 日期类型的编辑模式,展示日期选择器+ // Date type editing mode, showing date pickerif (type === 'date' && isEditing) {return renderEditMode();}- // 展示模式+ // Display modereturn (<div className={styles.container}><div className={styles.content}>{formatDisplayValue(value)}</div>diff --git a/src/app/[variants]/(main)/settings/hooks/useCategory.tsx b/src/app/[variants]/(main)/settings/hooks/useCategory.tsxindex 85e267f63e4..a24657b7611 100644--- a/src/app/[variants]/(main)/settings/hooks/useCategory.tsx+++ b/src/app/[variants]/(main)/settings/hooks/useCategory.tsx@@ -82,7 +82,7 @@ export const useCategory = () => {const categoryGroups: CategoryGroup[] = useMemo(() => {const groups: CategoryGroup[] = [];- // 个人资料组 - Profile 相关设置+ // Profile group - Profile-related settingsconst profileItems: CategoryItem[] = [{icon: avatarUrl ? <Avatar avatar={avatarUrl} shape={'square'} size={26} /> : UserCircle,@@ -143,7 +143,7 @@ export const useCategory = () => {});}- // 账号组 - 个人相关设置+ // Account group - personal settingsconst commonItems: CategoryItem[] = [{icon: PaletteIcon,@@ -168,7 +168,7 @@ export const useCategory = () => {title: t('group.common'),});- // AI 配置组 - AI 相关设置+ // AI configuration group - AI-related settingsconst aiConfigItems: CategoryItem[] = [{icon: Brain,@@ -208,7 +208,7 @@ export const useCategory = () => {title: t('group.aiConfig'),});- // 系统组 - 系统相关设置+ // System group - system-related settingsconst systemItems: CategoryItem[] = [isDesktop && {icon: EthernetPort,diff --git a/src/app/[variants]/(main)/settings/hotkey/features/Desktop.tsx b/src/app/[variants]/(main)/settings/hotkey/features/Desktop.tsxindex 90de88a8ac4..427c79570bc 100644--- a/src/app/[variants]/(main)/settings/hotkey/features/Desktop.tsx+++ b/src/app/[variants]/(main)/settings/hotkey/features/Desktop.tsx@@ -48,7 +48,7 @@ const HotkeySetting = memo(() => {if (result.success) {message.success(t('hotkey.updateSuccess', { ns: 'setting' }));} else {- // 根据错误类型显示相应的错误消息+ // Show the appropriate error message based on error typemessage.error(t(`hotkey.errors.${result.errorType}` as any, { ns: 'setting' }));}diff --git a/src/app/[variants]/(main)/settings/profile/features/KlavisAuthorizationList/index.tsx b/src/app/[variants]/(main)/settings/profile/features/KlavisAuthorizationList/index.tsxindex caf31283672..7dce214cfb8 100644--- a/src/app/[variants]/(main)/settings/profile/features/KlavisAuthorizationList/index.tsx+++ b/src/app/[variants]/(main)/settings/profile/features/KlavisAuthorizationList/index.tsx@@ -17,10 +17,10 @@ const KlavisAuthItem = memo<KlavisAuthItemProps>(({ server }) => {const removeKlavisServer = useToolStore((s) => s.removeKlavisServer);- // 获取服务器类型配置(图标等)+ // Get server type configuration (icons, etc.)const serverType = KLAVIS_SERVER_TYPES.find((item) => item.identifier === server.identifier);- // 处理取消授权+ // Handle deauthorizationconst handleRevoke = useCallback(() => {modal.confirm({content: t('profile.authorizations.revoke.description'),@@ -39,7 +39,7 @@ const KlavisAuthItem = memo<KlavisAuthItemProps>(({ server }) => {});}, [removeKlavisServer, server.identifier, server.serverName, serverType?.label, t]);- // 渲染图标+ // Render iconconst renderIcon = () => {if (!serverType) return null;diff --git a/src/app/[variants]/(main)/settings/provider/ProviderMenu/SearchResult.tsx b/src/app/[variants]/(main)/settings/provider/ProviderMenu/SearchResult.tsxindex fddc2ed058b..85458a9a1c2 100644--- a/src/app/[variants]/(main)/settings/provider/ProviderMenu/SearchResult.tsx+++ b/src/app/[variants]/(main)/settings/provider/ProviderMenu/SearchResult.tsx@@ -16,7 +16,7 @@ const SearchResult = memo((props: { onProviderSelect?: (key: string) => void })const searchKeyword = useAiInfraStore((s) => s.providerSearchKeyword);const aiProviderList = useAiInfraStore((s) => s.aiProviderList, isEqual);- // 使用 useMemo 优化过滤性能+ // Use useMemo to optimize filtering performanceconst filteredProviders = useMemo(() => {const keyword = searchKeyword.toLowerCase().trim();diff --git a/src/app/[variants]/(main)/settings/provider/_layout/Desktop/style.ts b/src/app/[variants]/(main)/settings/provider/_layout/Desktop/style.tsindex 999317ff48d..6c0967df869 100644--- a/src/app/[variants]/(main)/settings/provider/_layout/Desktop/style.ts+++ b/src/app/[variants]/(main)/settings/provider/_layout/Desktop/style.ts@@ -1,7 +1,7 @@import { createStaticStyles } from 'antd-style';export const styles = createStaticStyles(({ css }) => ({- // 主容器+ // Main containermainContainer: css`max-height: 100%;`,diff --git a/src/app/[variants]/(main)/settings/provider/features/CreateNewProvider/index.tsx b/src/app/[variants]/(main)/settings/provider/features/CreateNewProvider/index.tsxindex 63e7ed409c5..3ee427a4a49 100644--- a/src/app/[variants]/(main)/settings/provider/features/CreateNewProvider/index.tsx+++ b/src/app/[variants]/(main)/settings/provider/features/CreateNewProvider/index.tsx@@ -28,13 +28,13 @@ const CreateNewProvider = memo<CreateNewProviderProps>(({ onClose, open }) => {setLoading(true);try {- // 如果 name 为空,使用 id 作为 name+ // If name is empty, use id as the nameconst finalValues = {...values,name: values.name || values.id,};- // 只为 openai 和 router (newapi) 类型的自定义 provider 添加 supportResponsesApi: true+ // Only add supportResponsesApi: true for custom providers of type openai and router (newapi)const sdkType = values.settings?.sdkType;if (sdkType === 'openai' || sdkType === 'router') {finalValues.settings = {diff --git a/src/app/[variants]/(main)/settings/provider/features/ProviderConfig/index.tsx b/src/app/[variants]/(main)/settings/provider/features/ProviderConfig/index.tsxindex e1d2a5c52b0..7a22d8b3cb4 100644--- a/src/app/[variants]/(main)/settings/provider/features/ProviderConfig/index.tsx+++ b/src/app/[variants]/(main)/settings/provider/features/ProviderConfig/index.tsx@@ -227,15 +227,15 @@ const ProviderConfig = memo<ProviderConfigProps>(lastInitializedIdRef.current = id;}, [isLoading, id, data, providerRuntimeConfig, form]);- // 标记是否正在进行连接测试+ // Flag to indicate if a connection test is in progressconst isCheckingConnection = useRef(false);const handleValueChange = useCallback((...params: Parameters<typeof updateAiProviderConfig>) => {- // 虽然 debouncedHandleValueChange 早于 onBeforeCheck 执行,- // 但是由于 debouncedHandleValueChange 因为 debounce 的原因,本来就会晚 500ms 执行- // 所以 isCheckingConnection.current 这时候已经更新了- // 测试链接时已经出发一次了 updateAiProviderConfig , 不应该重复更新+ // Although debouncedHandleValueChange executes before onBeforeCheck,+ // due to the debounce, debouncedHandleValueChange will actually execute 500ms later+ // so isCheckingConnection.current has already been updated at this point+ // updateAiProviderConfig has already been triggered once during the connection test, so it should not be updated againif (isCheckingConnection.current) return;updateAiProviderConfig(...params);@@ -401,13 +401,13 @@ const ProviderConfig = memo<ProviderConfigProps>(model={data?.checkModel || checkModel!}provider={id}onAfterCheck={async () => {- // 重置连接测试状态,允许后续的 onValuesChange 更新+ // Reset connection test state to allow subsequent onValuesChange updatesisCheckingConnection.current = false;}}onBeforeCheck={async () => {- // 设置连接测试状态,阻止 onValuesChange 的重复请求+ // Set connection test state to prevent duplicate requests from onValuesChangeisCheckingConnection.current = true;- // 主动保存表单最新值,确保 fetchAiProviderRuntimeState 获取最新数据+ // Proactively save the latest form values to ensure fetchAiProviderRuntimeState retrieves up-to-date dataawait updateAiProviderConfig(id, form.getFieldsValue());}}/>diff --git a/src/app/[variants]/(main)/settings/proxy/features/ProxyForm.tsx b/src/app/[variants]/(main)/settings/proxy/features/ProxyForm.tsxindex af47dd4228f..311235da493 100644--- a/src/app/[variants]/(main)/settings/proxy/features/ProxyForm.tsx+++ b/src/app/[variants]/(main)/settings/proxy/features/ProxyForm.tsx@@ -44,15 +44,15 @@ const ProxyForm = () => {}}, [form, proxySettings]);- // 监听表单变化+ // Listen for form value changesconst handleValuesChange = useCallback(() => {setLoading(true);setHasUnsavedChanges(true);- setTestResult(null); // 清除之前的测试结果+ setTestResult(null); // Clear the previous test resultsetLoading(false);}, []);- // 保存配置+ // Save configurationconst handleSave = useCallback(async () => {try {setIsSaving(true);@@ -66,7 +66,7 @@ const ProxyForm = () => {}}, [form, setProxySettings]);- // 重置配置+ // Reset configurationconst handleReset = useCallback(() => {if (proxySettings) {form.setFieldsValue(proxySettings);@@ -75,20 +75,20 @@ const ProxyForm = () => {}}, [form, proxySettings]);- // 测试代理配置+ // Test proxy configurationconst handleTest = useCallback(async () => {try {setIsTesting(true);setTestResult(null);- // 验证表单并获取当前配置+ // Validate form and get current configurationconst values = await form.validateFields();const config: NetworkProxySettings = {...proxySettings,...values,};- // 使用新的 testProxyConfig 方法测试用户正在配置的代理+ // Use the new testProxyConfig method to test the proxy being configured by the userconst result = await desktopSettingsService.testProxyConfig(config, testUrl);setTestResult(result);@@ -199,7 +199,7 @@ const ProxyForm = () => {{t('proxy.testButton')}</Button></Space.Compact>- {/* 测试结果显示 */}+ {/* Test result display */}{!testResult ? null : testResult.success ? (<Alertclosablediff --git a/src/app/[variants]/(main)/settings/stats/features/usage/UsageCards/ActiveModels/ModelTable.tsx b/src/app/[variants]/(main)/settings/stats/features/usage/UsageCards/ActiveModels/ModelTable.tsxindex 58b241d3c09..6cc4aee3fab 100644--- a/src/app/[variants]/(main)/settings/stats/features/usage/UsageCards/ActiveModels/ModelTable.tsx+++ b/src/app/[variants]/(main)/settings/stats/features/usage/UsageCards/ActiveModels/ModelTable.tsx@@ -40,8 +40,8 @@ const formatData = (return Array.from(groupedLogs.entries()).map(([key, logs]) => {- // 此处的 logs 为多日的 log,需要进行 sum- // 如果当前的 groupBy 是 Model,则 logs 应该按照 Provider 进行分组+ // The logs here span multiple days and need to be summed+ // If the current groupBy is Model, logs should be grouped by Providerconst spend = logs.reduce((acc, log) => {const key = groupBy === GroupBy.Model ? log.provider : log.model;acc.set(key, (acc.get(key) || 0) + log.spend);