Skip to content

Commit 64c6955

Browse files
authored
Make provider list searchable and alphabetically sorted (#2029)
* Make providers list searchable * Sort providers alphabetically and add Kilo Code to top * Add changeset
1 parent 1a0df5a commit 64c6955

File tree

3 files changed

+30
-19
lines changed

3 files changed

+30
-19
lines changed

.changeset/tall-paths-fry.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"kilo-code": patch
3+
---
4+
5+
Add search to provider list and sort it alphabetically

webview-ui/src/components/settings/ApiOptions.tsx

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ import {
5555
SelectValue,
5656
SelectContent,
5757
SelectItem,
58-
// SearchableSelect, // kilocode_change
59-
SelectSeparator,
58+
SearchableSelect,
6059
Collapsible,
6160
CollapsibleTrigger,
6261
CollapsibleContent,
@@ -420,6 +419,17 @@ const ApiOptions = ({
420419
}
421420
}, [selectedProvider])
422421

422+
// Convert providers to SearchableSelect options
423+
// kilocode_change start: no organizationAllowList yet
424+
const providerOptions = useMemo(
425+
() =>
426+
PROVIDERS.map(({ value, label }) => {
427+
return { value, label }
428+
}),
429+
[],
430+
)
431+
// kilocode_change end
432+
423433
return (
424434
<div className="flex flex-col gap-3">
425435
<div className="flex flex-col gap-1 relative">
@@ -433,21 +443,16 @@ const ApiOptions = ({
433443
</div>
434444
)}
435445
</div>
436-
<Select value={selectedProvider} onValueChange={(value) => onProviderChange(value as ProviderName)}>
437-
<SelectTrigger className="w-full">
438-
<SelectValue placeholder={t("settings:common.select")} />
439-
</SelectTrigger>
440-
<SelectContent>
441-
{/* kilocode_change start: separator */}
442-
{PROVIDERS.map(({ value, label }, i) => (
443-
<Fragment key={value}>
444-
<SelectItem value={value}>{label}</SelectItem>
445-
{i === 0 ? <SelectSeparator /> : null}
446-
</Fragment>
447-
))}
448-
{/* kilocode_change end */}
449-
</SelectContent>
450-
</Select>
446+
<SearchableSelect
447+
value={selectedProvider}
448+
onValueChange={(value) => onProviderChange(value as ProviderName)}
449+
options={providerOptions}
450+
placeholder={t("settings:common.select")}
451+
searchPlaceholder={t("settings:providers.searchProviderPlaceholder")}
452+
emptyMessage={t("settings:providers.noProviderMatchFound")}
453+
className="w-full"
454+
data-testid="provider-select"
455+
/>
451456
</div>
452457

453458
{errorMessage && <ApiErrorMessage errorMessage={errorMessage} />}

webview-ui/src/components/settings/constants.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ export const MODELS_BY_PROVIDER: Partial<Record<ProviderName, Record<string, Mod
4949
}
5050

5151
export const PROVIDERS = [
52-
{ value: "kilocode", label: "Kilo Code" },
5352
{ value: "openrouter", label: "OpenRouter" },
5453
{ value: "anthropic", label: "Anthropic" },
5554
{ value: "claude-code", label: "Claude Code" },
@@ -84,4 +83,6 @@ export const PROVIDERS = [
8483
{ value: "zai", label: "Z AI" },
8584
{ value: "fireworks", label: "Fireworks AI" },
8685
{ value: "io-intelligence", label: "IO Intelligence" },
87-
] // .sort((a, b) => a.label.localeCompare(b.label)) // kilocode_change: Sort providers with kilocode first
86+
].sort((a, b) => a.label.localeCompare(b.label))
87+
88+
PROVIDERS.unshift({ value: "kilocode", label: "Kilo Code" }) // kilocode_change

0 commit comments

Comments
 (0)