translate custom mode config view to english

This commit is contained in:
duanfuxiang 2025-04-29 18:37:26 +08:00
parent 16cd3a8691
commit 3ec2873166
2 changed files with 98 additions and 47 deletions

View File

@ -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<string>('ask')
const [isBuiltinMode, setIsBuiltinMode] = useState<boolean>(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<CustomMode>({
id: '',
slug: '',
@ -52,22 +52,22 @@ const CustomModeView = () => {
updatedAt: 0,
})
// custom mode id
// Custom mode ID
const [customModeId, setCustomModeId] = useState<string>('')
// 模型名称
// Mode name
const [modeName, setModeName] = useState<string>('')
// 角色定义
// Role definition
const [roleDefinition, setRoleDefinition] = useState<string>('')
// 选中的工具组
// Selected tool groups
const [selectedTools, setSelectedTools] = useState<GroupEntry[]>([])
// 自定义指令
// Custom instructions
const [customInstructions, setCustomInstructions] = useState<string>('')
// 当模式变更时更新表单数据
// 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 (
<div className="infio-custom-modes-container">
{/* 模式配置标题和按钮 */}
{/* Mode configuration title and buttons */}
<div className="infio-custom-modes-header">
<div className="infio-custom-modes-title">
<h2></h2>
<h2>Mode Configuration</h2>
</div>
{/* <div className="infio-custom-modes-actions">
<button className="infio-custom-modes-btn">
@ -185,12 +185,12 @@ const CustomModeView = () => {
</div> */}
</div>
{/* 创建模式提示 */}
{/* Create mode tip */}
<div className="infio-custom-modes-tip">
+
Click + to create a new mode
</div>
{/* 模式选择区 */}
{/* Mode selection area */}
<div className="infio-custom-modes-builtin">
{[...buildinModes, ...customModeList].map(mode => (
<button
@ -210,10 +210,10 @@ const CustomModeView = () => {
</button>
</div>
{/* 模式名称 */}
{/* Mode name */}
<div className="infio-custom-modes-section">
<div className="infio-section-header">
<h3></h3>
<h3>Mode Name</h3>
{!isBuiltinMode && !isNewMode && (
<button className="infio-section-btn" onClick={deleteMode}>
<Trash2 size={16} />
@ -221,8 +221,12 @@ const CustomModeView = () => {
)}
</div>
{
isBuiltinMode && (
<p className="infio-section-subtitle"></p>
isBuiltinMode ? (
<p className="infio-section-subtitle">Built-in mode names cannot be modified</p>
) : (
<p className="infio-section-subtitle">
Mode names must only contain letters, numbers, and hyphens
</p>
)
}
<input
@ -235,22 +239,22 @@ const CustomModeView = () => {
setModeName(e.target.value)
}}
className="infio-custom-modes-input"
placeholder="输入模式名称..."
placeholder="Enter mode name..."
disabled={isBuiltinMode}
/>
</div>
{/* 角色定义 */}
{/* Role definition */}
<div className="infio-custom-modes-section">
<div className="infio-section-header">
<h3></h3>
<h3>Role Definition</h3>
{isBuiltinMode && (
<button className="infio-section-btn">
<Undo2 size={16} />
</button>
)}
</div>
<p className="infio-section-subtitle"></p>
<p className="infio-section-subtitle">Set professional domain and response style</p>
<textarea
className="infio-custom-textarea"
value={roleDefinition}
@ -260,14 +264,14 @@ const CustomModeView = () => {
}
setRoleDefinition(e.target.value)
}}
placeholder="输入角色定义..."
placeholder="Enter role definition..."
/>
</div>
{/* 可用功能 */}
{/* Available features */}
<div className="infio-custom-modes-section">
<div className="infio-section-header">
<h3></h3>
<h3>Available Features</h3>
{/* {!isBuiltinMode && (
<button className="infio-section-btn">
<Undo2 size={16} />
@ -276,7 +280,7 @@ const CustomModeView = () => {
</div>
{
isBuiltinMode && (
<p className="infio-section-subtitle"></p>
<p className="infio-section-subtitle">Available features of built-in modes cannot be modified</p>
)
}
<div className="infio-tools-list">
@ -288,7 +292,7 @@ const CustomModeView = () => {
checked={selectedTools.includes('read')}
onChange={() => handleToolChange('read')}
/>
Read Files
</label>
</div>
<div className="infio-tool-item">
@ -299,7 +303,7 @@ const CustomModeView = () => {
checked={selectedTools.includes('edit')}
onChange={() => handleToolChange('edit')}
/>
Edit Files
</label>
</div>
<div className="infio-tool-item">
@ -310,18 +314,23 @@ const CustomModeView = () => {
checked={selectedTools.includes('research')}
onChange={() => handleToolChange('research')}
/>
Web Search
</label>
</div>
</div>
</div>
{/* 模式专属规则 */}
{/* Mode-specific rules */}
<div className="infio-custom-modes-section">
<div className="infio-section-header">
<h3> </h3>
<h3>Mode-Specific Rules (Optional)</h3>
{isBuiltinMode && (
<button className="infio-section-btn">
<Undo2 size={16} />
</button>
)}
</div>
<p className="infio-section-subtitle"></p>
<p className="infio-section-subtitle">Mode-specific rules</p>
<textarea
className="infio-custom-textarea"
value={customInstructions}
@ -331,14 +340,14 @@ const CustomModeView = () => {
}
setCustomInstructions(e.target.value)
}}
placeholder="输入模式自定义指令..."
placeholder="Enter mode custom instructions..."
/>
<p className="infio-section-footer">
<a href="#" className="infio-link" onClick={() => openOrCreateMarkdownFile(app, `_infio_prompts/${modeName}/rules.md`, 0)}>_infio_prompts/{modeName}/rules</a>
Support reading configuration from<a href="#" className="infio-link" onClick={() => openOrCreateMarkdownFile(app, `_infio_prompts/${modeName}/rules.md`, 0)}>_infio_prompts/{modeName}/rules</a> file
</p>
</div>
{/* 高级, 覆盖系统提示词 */}
{/* Advanced, override system prompt */}
<div className="infio-custom-modes-section">
<div
className="infio-section-header infio-section-header-collapsible"
@ -346,15 +355,15 @@ const CustomModeView = () => {
>
<div className="infio-section-header-title-container">
{isAdvancedCollapsed ? <ChevronRight size={16} /> : <ChevronDown size={16} />}
<h6 className="infio-section-header-title"></h6>
<h6 className="infio-section-header-title">Override System Prompt</h6>
</div>
</div>
{!isAdvancedCollapsed && (
<>
<p className="infio-section-subtitle">
You can completely replace the system prompt for this mode (excluding role definition and custom instructions) by creating a file
<a href="#" className="infio-link" onClick={() => openOrCreateMarkdownFile(app, `_infio_prompts/${modeName}/system_prompt.md`, 0)}>_infio_prompts/{modeName}/system_prompt</a>
使, <button
. This is a very advanced feature that will override all built-in prompts including tool usage, please use with caution <button
className="infio-preview-btn"
onClick={async () => {
let filesSearchMethod = settings.filesSearchMethod
@ -386,13 +395,13 @@ const CustomModeView = () => {
}
}
>
Preview System Prompt
</button>
</p></>
)}
</div>
{/* 保存 */}
{/* Save */}
<div className="infio-custom-modes-actions">
<button
className="infio-preview-btn"
@ -404,11 +413,11 @@ const CustomModeView = () => {
}
}}
>
Save
</button>
</div>
{/* 样式 */}
{/* Styles */}
<style>
{`
.infio-custom-modes-container {

View File

@ -504,6 +504,48 @@ export const deepSeekModels = {
export type QwenModelId = keyof typeof qwenModels
export const qwenDefaultModelId: QwenModelId = "qwen-max-latest"
export const qwenModels = {
"qwen3-235b-a22b": {
maxTokens: 129_024,
contextWindow: 131_072,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.002,
outputPrice: 0.006,
cacheWritesPrice: 0.002,
cacheReadsPrice: 0.006,
},
"qwen3-32b": {
maxTokens: 129_024,
contextWindow: 131_072,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.002,
outputPrice: 0.006,
},
"qwen3-30b-a3b": {
maxTokens: 129_024,
contextWindow: 131_072,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.002,
outputPrice: 0.006,
},
"qwen3-14b": {
maxTokens: 129_024,
contextWindow: 131_072,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.002,
outputPrice: 0.006,
},
"qwen3-8b": {
maxTokens: 129_024,
contextWindow: 131_072,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.002,
outputPrice: 0.006,
},
"qwen2.5-coder-32b-instruct": {
maxTokens: 8_192,
contextWindow: 131_072,