diff --git a/.changeset/fix-case-insensitive-model-search.md b/.changeset/fix-case-insensitive-model-search.md new file mode 100644 index 00000000000..0e42a39f8e9 --- /dev/null +++ b/.changeset/fix-case-insensitive-model-search.md @@ -0,0 +1,10 @@ +--- +"webview-ui": patch +--- + +Fix case-insensitive model search in ModelPicker + +Users can now search for models regardless of casing. For example, searching for "kimi k2.5" will find models like "Kimi-K2.5-Instruct". This fixes model discovery issues when using Azure Cognitive Services or other OpenAI-compatible providers that return models with different casing. + +Before: Search was case-sensitive, making it hard to find models +After: Search is case-insensitive for better discoverability diff --git a/.changeset/fix-kimi-model-search.md b/.changeset/fix-kimi-model-search.md new file mode 100644 index 00000000000..60ffea14ba0 --- /dev/null +++ b/.changeset/fix-kimi-model-search.md @@ -0,0 +1,5 @@ +--- +"kilo-code": patch +--- + +Fix Kimi model search and add Kimi models as fallback for OpenAI Compatible provider diff --git a/webview-ui/src/components/settings/ModelPicker.tsx b/webview-ui/src/components/settings/ModelPicker.tsx index 5f9d82ceacf..e2fecfa1515 100644 --- a/webview-ui/src/components/settings/ModelPicker.tsx +++ b/webview-ui/src/components/settings/ModelPicker.tsx @@ -98,6 +98,21 @@ export const ModelPicker = ({ const [searchValue, setSearchValue] = useState("") + // kilocode_change: Case-insensitive search with dash/space normalization + const normalizeForSearch = (str: string) => str.toLowerCase().replace(/[-_\s]/g, "") + + const filteredPreferredIds = useMemo(() => { + if (!searchValue.trim()) return preferredModelIds + const searchNormalized = normalizeForSearch(searchValue) + return preferredModelIds.filter((id) => normalizeForSearch(id).includes(searchNormalized)) + }, [preferredModelIds, searchValue]) + + const filteredRestIds = useMemo(() => { + if (!searchValue.trim()) return restModelIds + const searchNormalized = normalizeForSearch(searchValue) + return restModelIds.filter((id) => normalizeForSearch(id).includes(searchNormalized)) + }, [restModelIds, searchValue]) + const onSelect = useCallback( (modelId: string) => { if (!modelId) { @@ -179,7 +194,7 @@ export const ModelPicker = ({ - +
)} - {/* kilocode_change start: Section headers for recommended and all models */} - {preferredModelIds.length > 0 && ( - - {preferredModelIds.map((model) => ( + {/* kilocode_change start: Section headers for recommended and all models with case-insensitive search */} + {filteredPreferredIds.length > 0 && ( + + {filteredPreferredIds.map((model) => ( )} - {restModelIds.length > 0 && ( + {filteredRestIds.length > 0 && ( - {restModelIds.map((model) => ( + {filteredRestIds.map((model) => ( { + const fetchedModels = openAiModels ?? {} + if (isKimiEndpoint) { + return { ...moonshotModels, ...fetchedModels } + } + return fetchedModels + }, [isKimiEndpoint, openAiModels]) + + const defaultModelId = isKimiEndpoint ? moonshotDefaultModelId : "gpt-4o" + const handleAddCustomHeader = useCallback(() => { // Only update the local state to show the new row in the UI. setCustomHeaders((prev) => [...prev, ["", ""]]) @@ -138,10 +156,11 @@ export const OpenAICompatible = ({