tui: fix provider sorting to prioritize recommended options

This commit is contained in:
Dax Raad 2025-11-27 13:54:42 -05:00
parent 95b667d21e
commit 9ecaf618db

View file

@ -26,6 +26,7 @@ export function createDialogProviderOptions() {
const options = createMemo(() => {
return pipe(
sync.data.provider_next.all,
sortBy((x) => PROVIDER_PRIORITY[x.id] ?? 99),
map((provider) => ({
title: provider.name,
value: provider.id,
@ -33,6 +34,7 @@ export function createDialogProviderOptions() {
opencode: "Recommended",
anthropic: "Claude Max or API key",
}[provider.id],
category: provider.id in PROVIDER_PRIORITY ? "Popular" : "Other",
async onSelect() {
const methods = sync.data.provider_auth[provider.id] ?? [
{
@ -85,7 +87,6 @@ export function createDialogProviderOptions() {
}
},
})),
sortBy((x) => PROVIDER_PRIORITY[x.value] ?? 99),
)
})
return options