Skip to content

Commit a4907b6

Browse files
committed
fix: resolve OpenAI Compatible embedder provider save validation issue
- Fix validation schema for OpenAI Compatible provider to properly handle model dimension field - Improve validation data preparation to ensure numeric fields are properly converted - Ensure validation errors are displayed to users when required fields are missing - Resolves issue where Save button would not work for OpenAI Compatible provider Fixes #5842
1 parent a7771a3 commit a4907b6

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

webview-ui/src/components/chat/CodeIndexPopover.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,20 @@ export const CodeIndexPopover: React.FC<CodeIndexPopoverProps> = ({
369369
dataToValidate[key] = "placeholder-valid"
370370
}
371371
} else {
372-
dataToValidate[key] = value
372+
// Special handling for model dimension field - ensure it's a number when required
373+
if (key === "codebaseIndexEmbedderModelDimension") {
374+
// For OpenAI Compatible provider, this field is required and must be a number
375+
if (currentSettings.codebaseIndexEmbedderProvider === "openai-compatible") {
376+
// Convert to number if it's a string, or use undefined if empty
377+
const numValue = typeof value === "string" ? parseInt(value, 10) : (value as number)
378+
dataToValidate[key] = isNaN(numValue) ? undefined : numValue
379+
} else {
380+
// For other providers, it's optional
381+
dataToValidate[key] = value
382+
}
383+
} else {
384+
dataToValidate[key] = value
385+
}
373386
}
374387
}
375388

0 commit comments

Comments
 (0)