-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Description
有个编辑 model 时候 block 的 bug fix #246
重现:我创建了一个 AI 模型,但是 model name 输错了(输成了 deepseek) 然后再次编辑这个 model 想要清空 model name 就报错了
Bug Description
When attempting to save a new AI model configuration (e.g., adding a DeepSeek model), the system displays an error message "模型不存在" (Model does not exist), even when the model has been selected from the dropdown list.
Root Cause
In web/src/components/AITradersPage.tsx line 281, the handleSaveModelConfig function validates the model by searching only in supportedModels:
const modelToUpdate = supportedModels?.find(m => m.id === modelId);
if (\!modelToUpdate) {
alert(t('modelNotExist', language));
return;
}This validation fails when:
- User creates a new model configuration
- The model is not found in
supportedModels(which comes from the default user's configuration)
Steps to Reproduce
- Navigate to AI Traders page
- Click "Add AI Model"
- Select a model from the dropdown (e.g., DeepSeek)
- Enter API Key
- Click Save
- Error: "模型不存在"
Proposed Solution
Update the validation logic to check both allModels (user's configured models) and supportedModels:
const existingModel = allModels?.find(m => m.id === modelId);
let updatedModels;
// Find model from either configured or supported lists
const modelToUpdate = existingModel || supportedModels?.find(m => m.id === modelId);
if (\!modelToUpdate) {
alert(t('modelNotExist', language));
return;
}Related
- PR test: Add minimal UT infrastructure and fix Issue #227 #229 fixes a similar issue for editing traders, but does not address this model configuration save issue
- This is a separate bug in the model configuration workflow
Environment
- Browser: Chrome/Firefox
- Version: Latest dev branch
🤖 Generated with Claude Code
Metadata
Metadata
Assignees
Labels
No labels