wip: desktop work

This commit is contained in:
Adam
2025-10-30 14:41:13 -05:00
parent ba13f8da08
commit 48f50cf55e
4 changed files with 87 additions and 23 deletions

View File

@@ -71,7 +71,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
}
})
const { flat, active, onInput, onKeyDown } = useFilteredList<string>({
const { flat, active, onInput, onKeyDown, refetch } = useFilteredList<string>({
items: local.file.search,
key: (x) => x,
onSelect: (path) => {
@@ -81,6 +81,11 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
},
})
createEffect(() => {
local.model.recent()
refetch()
})
createEffect(
on(
() => store.contentParts,
@@ -369,16 +374,20 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
items={local.model.list()}
current={local.model.current()}
filterKeys={["provider.name", "name", "id"]}
groupBy={(x) => x.provider.name}
groupBy={(x) => (local.model.recent().includes(x) ? "Recent" : x.provider.name)}
sortGroupsBy={(a, b) => {
const order = ["opencode", "anthropic", "github-copilot", "openai", "google", "openrouter", "vercel"]
if (a.category === "Recent" && b.category !== "Recent") return -1
if (b.category === "Recent" && a.category !== "Recent") return 1
const aProvider = a.items[0].provider.id
const bProvider = b.items[0].provider.id
if (order.includes(aProvider) && !order.includes(bProvider)) return -1
if (!order.includes(aProvider) && order.includes(bProvider)) return 1
return order.indexOf(aProvider) - order.indexOf(bProvider)
}}
onSelect={(x) => local.model.set(x ? { modelID: x.id, providerID: x.provider.id } : undefined)}
onSelect={(x) =>
local.model.set(x ? { modelID: x.id, providerID: x.provider.id } : undefined, { recent: true })
}
trigger={
<Button as="div" variant="ghost">
{local.model.current()?.name ?? "Select model"}