diff --git a/src/components/chat-view/CustomModeView.tsx b/src/components/chat-view/CustomModeView.tsx index b6ce520..335475c 100644 --- a/src/components/chat-view/CustomModeView.tsx +++ b/src/components/chat-view/CustomModeView.tsx @@ -33,14 +33,14 @@ const CustomModeView = () => { return new PromptGenerator(getRAGEngine, app, settings, diffStrategy, customModePrompts, customModeList) }, [app, settings, diffStrategy, customModePrompts, customModeList]) - // 当前选择的模式 + // Currently selected mode const [selectedMode, setSelectedMode] = useState('ask') const [isBuiltinMode, setIsBuiltinMode] = useState(true) - const [isAdvancedCollapsed, setIsAdvancedCollapsed] = useState(false); + const [isAdvancedCollapsed, setIsAdvancedCollapsed] = useState(true); const isNewMode = React.useMemo(() => selectedMode === "add_new_mode", [selectedMode]) - // new mode config + // New mode configuration const [newMode, setNewMode] = useState({ id: '', slug: '', @@ -52,22 +52,22 @@ const CustomModeView = () => { updatedAt: 0, }) - // custom mode id + // Custom mode ID const [customModeId, setCustomModeId] = useState('') - // 模型名称 + // Mode name const [modeName, setModeName] = useState('') - // 角色定义 + // Role definition const [roleDefinition, setRoleDefinition] = useState('') - // 选中的工具组 + // Selected tool groups const [selectedTools, setSelectedTools] = useState([]) - // 自定义指令 + // Custom instructions const [customInstructions, setCustomInstructions] = useState('') - // 当模式变更时更新表单数据 + // Update form data when mode changes useEffect(() => { // new mode if (isNewMode) { @@ -87,7 +87,7 @@ const CustomModeView = () => { setRoleDefinition(builtinMode.roleDefinition); setCustomInstructions(builtinMode.customInstructions || ''); setSelectedTools(builtinMode.groups as GroupEntry[]); - setCustomModeId(''); // 内置模式没有自定义 ID + setCustomModeId(''); // Built-in modes don't have custom IDs } else { setIsBuiltinMode(false); const customMode = customModeList.find(m => m.slug === selectedMode); @@ -104,7 +104,7 @@ const CustomModeView = () => { }, [selectedMode, customModeList]); - // 处理工具组选择变更 + // Handle tool group selection change const handleToolChange = React.useCallback((tool: ToolGroup) => { if (isNewMode) { setNewMode((prev) => ({ @@ -121,7 +121,7 @@ const CustomModeView = () => { }); }, [isNewMode]) - // 更新模式配置 + // Update mode configuration const handleUpdateMode = React.useCallback(async () => { if (!isBuiltinMode) { await updateCustomMode( @@ -134,7 +134,7 @@ const CustomModeView = () => { } }, [isBuiltinMode, customModeId, modeName, roleDefinition, customInstructions, selectedTools]) - // 创建新模式 + // Create new mode const createNewMode = React.useCallback(async () => { if (!isNewMode) return; await createCustomMode( @@ -157,7 +157,7 @@ const CustomModeView = () => { setSelectedMode("add_new_mode") }, [isNewMode, modeName, roleDefinition, customInstructions, selectedTools]) - // 删除模式 + // Delete mode const deleteMode = React.useCallback(async () => { if (isNewMode || isBuiltinMode) return; await deleteCustomMode(customModeId); @@ -170,10 +170,10 @@ const CustomModeView = () => { return (
- {/* 模式配置标题和按钮 */} + {/* Mode configuration title and buttons */}
-

模式配置

+

Mode Configuration

{/*
*/}
- {/* 创建模式提示 */} + {/* Create mode tip */}
- 点击 + 创建模式,创建一个新模式。 + Click + to create a new mode
- {/* 模式选择区 */} + {/* Mode selection area */}
{[...buildinModes, ...customModeList].map(mode => (
- {/* 模式名称 */} + {/* Mode name */}
-

模式名称

+

Mode Name

{!isBuiltinMode && !isNewMode && (
{ - isBuiltinMode && ( -

内置模式名称不能被修改

+ isBuiltinMode ? ( +

Built-in mode names cannot be modified

+ ) : ( +

+ Mode names must only contain letters, numbers, and hyphens +

) } { setModeName(e.target.value) }} className="infio-custom-modes-input" - placeholder="输入模式名称..." + placeholder="Enter mode name..." disabled={isBuiltinMode} />
- {/* 角色定义 */} + {/* Role definition */}
-

角色定义

+

Role Definition

{isBuiltinMode && ( )}
-

设定专业领域和应答风格

+

Set professional domain and response style