The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(desktop): star models into a Favorites section of the picker
Brooklyn Nicholsona413ffd96e3f
diff --git a/apps/desktop/src/app/shell/model-catalog-menu.test.tsx b/apps/desktop/src/app/shell/model-catalog-menu.test.tsxindex 71c2f5f2278..84f649af025 100644--- a/apps/desktop/src/app/shell/model-catalog-menu.test.tsx+++ b/apps/desktop/src/app/shell/model-catalog-menu.test.tsx@@ -16,6 +16,7 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'viteimport { DropdownMenu, DropdownMenuContent } from '@/components/ui/dropdown-menu'import { queryClient } from '@/lib/query-client'+import { $favoriteModels, favoriteModelKey, toggleFavoriteModel } from '@/store/favorite-models'import { $localModelsEnabled } from '@/store/local-models-flag'import { localModelsKey, localModelsOwner } from '@/store/local-runtime-jobs'import { setShowModelPricing } from '@/store/model-pricing'@@ -26,7 +27,6 @@ import {setModelVisibilityOpen,setVisibleModels} from '@/store/model-visibility'-import { $pinnedModels, pinnedModelKey, togglePinnedModel } from '@/store/pinned-models'import { $defaultReasoningEffort } from '@/store/session'import type { LocalRuntimeJob } from '@/types/hermes'@@ -66,7 +66,7 @@ beforeEach((): void => {queryClient.setDefaultOptions({ queries: { ...queryClient.getDefaultOptions().queries, retry: false } })window.localStorage.clear()$visibleModels.set(null)- $pinnedModels.set([])+ $favoriteModels.set([])queryClient.setQueryData(localModelsKey(localModelsOwner(), 'jobs'), [])// These suites exercise the local-models rows, which ship behind --local.$localModelsEnabled.set(true)@@ -220,99 +220,104 @@ describe('the catalog owns model curation', () => {})})-// Pinning is a promise about the LIST: "keep this one where I can always-// reach it". That promise is what decides where a pinned row paints — its own-// section at the top, and nowhere twice.-describe('the catalog owns pinned models', () => {- it('lifts a pinned model into the Pinned section above the provider groups', async () => {- togglePinnedModel('google', 'gemini-2.5-flash')+// A star is a promise about the LIST: "keep this one where I can always reach+// it". That promise is what decides where a favorite paints — its own section+// at the top, and nowhere twice.+describe('the catalog owns favorite models', () => {+ it('lifts a favorite into the Favorites section above the provider groups', async () => {+ toggleFavoriteModel('google', 'gemini-2.5-flash')renderMenu()const rows = (await screen.findAllByText(/Gemini 2\.5/i)).map(node => node.closest('[role="menuitem"]')!)- // Its own section heading paints above the provider groups…- expect(screen.getByText('Pinned')).toBeTruthy()-- // …and the row's DOM order reflects it: the section label comes before- // the provider group heading (the LAST 'Google' text — the pinned row's- // provider chip paints one first).- const pinnedLabel = screen.getByText('Pinned')+ // The section label comes before the provider group heading (the LAST+ // 'Google' text — the favorite row's provider chip paints one first).+ const label = screen.getByText('Favorites')const googleTexts = screen.getAllByText('Google')const googleHeading = googleTexts[googleTexts.length - 1]- expect(pinnedLabel.compareDocumentPosition(googleHeading) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy()+ expect(label.compareDocumentPosition(googleHeading) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy()// The provider chip names the row's provider, so two labs sharing a model// id stay apart in the mixed section.expect(rows.some(row => row.textContent?.includes('Google'))).toBe(true)})- it('does not also list a pinned model under its provider', async () => {- togglePinnedModel('google', 'gemini-2.5-flash')+ it('does not also list a favorite under its provider', async () => {+ toggleFavoriteModel('google', 'gemini-2.5-flash')renderMenu()- await screen.findByText('Pinned')+ await screen.findByText('Favorites')- // Listed once, under Pinned — not also down in Google's group.+ // Listed once, under Favorites — not also down in Google's group.expect(screen.getAllByText(/Gemini 2\.5/i)).toHaveLength(1)})- it('keeps a pin whose provider is not connected without painting an empty section', async () => {- $pinnedModels.set([pinnedModelKey('anthropic', 'claude-sonnet-4.6')])+ it('keeps a favorite whose provider is not connected without painting an empty section', async () => {+ $favoriteModels.set([favoriteModelKey('anthropic', 'claude-sonnet-4.6')])renderMenu()await screen.findByText(/Gemini 3\.1 Pro/i)- expect(screen.queryByText('Pinned')).toBeNull()+ expect(screen.queryByText('Favorites')).toBeNull()})- // Curation and pinning are different questions: "which models do I usually- // want listed" vs "which one do I want first". A pin wins.- it('shows a pinned model the Edit Models shortlist hides', async () => {+ // Curation and favorites are different questions: "which models do I+ // usually want listed" vs "which one do I want first". A star wins.+ it('shows a favorite the Edit Models shortlist hides', async () => {setVisibleModels(new Set([modelVisibilityKey('google', 'gemini-3.1-pro')]))- togglePinnedModel('google', 'gemini-2.5-flash')+ toggleFavoriteModel('google', 'gemini-2.5-flash')renderMenu()- await screen.findByText('Pinned')+ await screen.findByText('Favorites')expect(screen.getAllByText(/Gemini 2\.5/i)).toHaveLength(1)})it('folds the section away while searching and lists the match in its provider place', async () => {- togglePinnedModel('google', 'gemini-2.5-flash')+ toggleFavoriteModel('google', 'gemini-2.5-flash')renderMenu()- await screen.findByText('Pinned')+ await screen.findByText('Favorites')fireEvent.change(screen.getByRole('textbox', { name: 'Search models' }), { target: { value: 'gemini-2.5' } })// A query means "show me every match": the section folds and the match- // paints in its provider's place. Still exactly once.+ // paints in its provider's place. Still exactly once, still starred.await vi.waitFor(() => {- expect(screen.queryByText('Pinned')).toBeNull()+ expect(screen.queryByText('Favorites')).toBeNull()})expect(screen.getAllByText(/Gemini 2\.5/i)).toHaveLength(1)+ expect(screen.getByRole('button', { name: 'Remove from favorites' }).getAttribute('aria-pressed')).toBe('true')})- // The same gesture as a sidebar chat: shift-click pins, and the menu stays- // put so a second shift-click (now on the row in the Pinned section) undoes- // it. Neither click is a pick.- it('shift-click toggles the pin without selecting the model or closing the menu', async () => {+ // Starring is never a pick: the star, a shift-click on the row (the+ // sidebar's pin gesture) and Shift+Enter all toggle in place, the menu stays+ // open, and the same gesture on the moved row undoes it.+ it('the star, shift-click and Shift+Enter toggle a favorite without selecting or closing', async () => {const select = renderMenu()- const row = (await screen.findByText('Gemini 2.5')).closest('[role="menuitem"]')!+ const key = favoriteModelKey('google', 'gemini-2.5-flash')+ const row = () => screen.getByText('Gemini 2.5').closest('[role="menuitem"]')!+ const star = () => row().querySelector('button[aria-pressed]')!++ await screen.findByText('Gemini 2.5')+ fireEvent.click(star())+ expect($favoriteModels.get()).toEqual([key])+ await screen.findByText('Favorites')- fireEvent.click(row, { shiftKey: true })+ fireEvent.click(row(), { shiftKey: true })+ expect($favoriteModels.get()).toEqual([])- expect($pinnedModels.get()).toEqual([pinnedModelKey('google', 'gemini-2.5-flash')])- await screen.findByText('Pinned')+ const search = screen.getByRole('textbox', { name: 'Search models' })- fireEvent.click(screen.getByText('Gemini 2.5').closest('[role="menuitem"]')!, { shiftKey: true })+ fireEvent.change(search, { target: { value: 'gemini-2.5' } })+ await vi.waitFor(() => expect(screen.getAllByText(/Gemini 2\.5/i)).toHaveLength(1))+ fireEvent.keyDown(search, { key: 'Enter', shiftKey: true })+ expect($favoriteModels.get()).toEqual([key])- expect($pinnedModels.get()).toEqual([])- await vi.waitFor(() => expect(screen.queryByText('Pinned')).toBeNull())expect(select).not.toHaveBeenCalled()expect(closeMenu).not.toHaveBeenCalled()})diff --git a/apps/desktop/src/app/shell/model-catalog-menu.tsx b/apps/desktop/src/app/shell/model-catalog-menu.tsxindex c8d9ff1d12c..e97f44e1f16 100644--- a/apps/desktop/src/app/shell/model-catalog-menu.tsx+++ b/apps/desktop/src/app/shell/model-catalog-menu.tsx@@ -29,6 +29,7 @@ import {} from '@/components/ui/dropdown-menu'import { HighlightMatches } from '@/components/ui/highlight-matches'import { Skeleton } from '@/components/ui/skeleton'+import { Tip, TipHintLabel } from '@/components/ui/tooltip'import type { HermesGateway } from '@/hermes'import { useI18n } from '@/i18n'import { triggerHaptic } from '@/lib/haptics'@@ -39,6 +40,7 @@ import { reasoningEffortLabel } from '@/lib/reasoning-effort'import { foldIncludes, normalize } from '@/lib/text'import { cn } from '@/lib/utils'import { $customModels, addCustomModel, customModelCandidate, withCustomModels } from '@/store/custom-models'+import { $favoriteModels, favoriteModelKey, toggleFavoriteModel } from '@/store/favorite-models'import { $localModelsEnabled } from '@/store/local-models-flag'import {type LocalModelsOwner,@@ -58,7 +60,6 @@ import {seedKnownModels,setModelVisibilityOpen} from '@/store/model-visibility'-import { $pinnedModels, pinnedModelKey, togglePinnedModel } from '@/store/pinned-models'import { $collapsedProviders, toggleCollapsedProvider } from '@/store/provider-collapse'import { $defaultReasoningEffort } from '@/store/session'import type { LocalModelLoadProgress, LocalRuntimeJob } from '@/types/hermes'@@ -218,10 +219,10 @@ export function ModelCatalogMenu({// and the composer would end up disagreeing about what "my models" means.const visibleModels = useStore($visibleModels)const customModels = useStore($customModels)- // Pinned models, same reasoning as the shortlist above: one global+ // Favorite models, same reasoning as the shortlist above: one global// preference owned by the catalog, so the composer pill, session tiles and- // the kanban override all show the same Pinned section.- const pinnedKeys = useStore($pinnedModels)+ // the kanban override all show the same Favorites section.+ const favoriteKeys = useStore($favoriteModels)const modelOptions = useQuery({queryKey: modelOptionsQueryKey(profile, sessionId, ownerConnectionId),@@ -329,29 +330,33 @@ export function ModelCatalogMenu({[visibleModels, pickerProviders])- // Pinned models paint their own section ABOVE the provider groups — the- // whole point of pinning one. Resolved against the catalog we actually- // fetched, so a pin whose provider is not connected (or whose model the lab+ // Favorites paint their own section ABOVE the provider groups — the whole+ // point of starring one. Resolved against the catalog we actually fetched,+ // so a favorite whose provider is not connected (or whose model the lab// retired) has no row to show; it is KEPT, not dropped, for when it returns.- // Pins ignore the Edit Models shortlist on purpose: pinning IS an explicit- // "always show me this one". A search turns the section off — a query means- // "show me every match", and those are listed in their provider's place.- const pinnedRows = useMemo(- () => (q ? [] : resolvePinnedRows(pickerProviders, pinnedKeys)),- [pickerProviders, pinnedKeys, q]+ // Favorites ignore the Edit Models shortlist on purpose: a star IS an+ // explicit "always show me this one". A search turns the section off — a+ // query means "show me every match", listed in their provider's place.+ const favoriteRows = useMemo(+ () => (q ? [] : resolveFavoriteRows(pickerProviders, favoriteKeys)),+ [pickerProviders, favoriteKeys, q])// The same rows are dropped from the provider groups, so no model is ever- // listed twice in one open menu.- const pinnedRowKeys = useMemo(- () => new Set(pinnedRows.map(({ family, provider }) => pinnedModelKey(provider.slug, family.id))),- [pinnedRows]- )+ // listed twice in one open menu. Not while searching: a query lists every+ // match in its provider's place.+ const favoriteSet = useMemo(() => new Set(favoriteKeys), [favoriteKeys])const groups = useMemo(() =>- groupModels(pickerProviders, search, { model: current.model, provider: current.provider }, shownKeys, pinnedRowKeys),- [pickerProviders, search, current.model, current.provider, shownKeys, pinnedRowKeys]+ groupModels(+ pickerProviders,+ search,+ { model: current.model, provider: current.provider },+ shownKeys,+ q ? null : favoriteSet+ ),+ [pickerProviders, search, current.model, current.provider, shownKeys, q, favoriteSet])// Presets are searchable rows like everything else — an unfiltered preset@@ -366,9 +371,9 @@ export function ModelCatalogMenu({// The scrolling catalog list only mounts when it has rows; otherwise a// section below it (MoA, custom slug) would sit under two separators.- // Pins count: a catalog whose every curated family is pinned has+ // Favorites count: a catalog whose every curated family is starred has// groups but no group rows, and the section must still paint.- const hasList = !hideCatalog && (groups.length > 0 || shownDownloads.length > 0 || pinnedRows.length > 0)+ const hasList = !hideCatalog && (groups.length > 0 || shownDownloads.length > 0 || favoriteRows.length > 0)// A typed id no provider lists is still a model to the backend. Offer it as// a row per configured provider (the current one first) so a slug the@@ -435,7 +440,7 @@ export function ModelCatalogMenu({}// ── Keyboard selection (cmdk semantics on a Radix menu) ───────────────────- // One flat list mirroring EXACTLY what's rendered (Pinned section,+ // One flat list mirroring EXACTLY what's rendered (Favorites section,// collapse, filter, presets), so the selection can never sit on a hidden row.type KbRow =| { key: string; kind: 'custom'; provider: ModelOptionProvider; slug: string }@@ -444,14 +449,12 @@ export function ModelCatalogMenu({const kbRows = useMemo<KbRow[]>(() => [- ...pinnedRows.map(- ({ family, provider }): KbRow => ({- family,- key: `${provider.slug}:${family.id}`,- kind: 'family',- provider- })- ),+ ...favoriteRows.map(({ family, provider }): KbRow => ({+ family,+ key: `${provider.slug}:${family.id}`,+ kind: 'family',+ provider+ })),...groups.flatMap(group =>collapsedProviders.includes(group.provider.slug) && !search? []@@ -472,10 +475,13 @@ export function ModelCatalogMenu({})): [])],- [pinnedRows, groups, collapsedProviders, search, shownMoaPresets, customSlug, customProviders]+ [favoriteRows, groups, collapsedProviders, search, shownMoaPresets, customSlug, customProviders])- const [kbOverride, setKbOverride] = useState<null | number>(null)+ // The row the arrows (or a Shift+Enter star) last put the highlight on,+ // held by KEY: a starred row moves into or out of Favorites, and the+ // highlight follows it rather than staying on the old index.+ const [kbOverride, setKbOverride] = useState<null | string>(null)// Searchable DropdownMenu rows already cancel Radix's hover-to-focus while// the search owns focus (#53980). Keep rows hit-testable so the first// deliberate click works even before the pointer has moved (#123040).@@ -490,7 +496,8 @@ export function ModelCatalogMenu({const autoIndex = q ? (kbRows.length > 0 ? 0 : -1) : kbRows.findIndex(row => rowIsCurrent(row))- const kbIndex = kbOverride !== null && kbOverride < kbRows.length ? kbOverride : autoIndex+ const overrideIndex = kbOverride === null ? -1 : kbRows.findIndex(row => row.key === kbOverride)+ const kbIndex = overrideIndex >= 0 ? overrideIndex : autoIndexconst kbActiveKey = kbIndex >= 0 ? kbRows[kbIndex].key : nullconst stepKb = (delta: -1 | 1) => {@@ -500,7 +507,7 @@ export function ModelCatalogMenu({const from = kbIndex >= 0 ? kbIndex : delta === 1 ? -1 : 0- setKbOverride((from + delta + kbRows.length) % kbRows.length)+ setKbOverride(kbRows[(from + delta + kbRows.length) % kbRows.length].key)}const commitKbRow = () => {@@ -529,6 +536,21 @@ export function ModelCatalogMenu({closeMenu()}+ // Shift+Enter stars the highlighted model — the keyboard twin of+ // shift-clicking a row. Pinning the highlight to its key lets it follow+ // the row to its new slot.+ const toggleKbFavorite = () => {+ const row = kbIndex >= 0 ? kbRows[kbIndex] : undefined++ if (row?.kind !== 'family') {+ return+ }++ setKbOverride(row.key)+ triggerHaptic('selection')+ toggleFavoriteModel(row.provider.slug, row.family.id)+ }+// ── Keyboard path into a row's edit submenu (#86966) ─────────────────────// Rows are HIGHLIGHTED, not DOM-focused (focus stays in the search input so// typing keeps working), which is why Radix's own ArrowRight-on-the-trigger@@ -635,6 +657,10 @@ export function ModelCatalogMenu({event.preventDefault()event.stopPropagation()stepKb(event.key === 'ArrowDown' ? 1 : -1)+ } else if (isSubmitEnter(event) && event.shiftKey) {+ event.preventDefault()+ event.stopPropagation()+ toggleKbFavorite()} else if (isSubmitEnter(event)) {event.preventDefault()event.stopPropagation()@@ -676,30 +702,34 @@ export function ModelCatalogMenu({<DropdownMenuItem className={dropdownMenuRow} disabled>{error}</DropdownMenuItem>- ) : groups.length === 0 && pinnedRows.length === 0 && moaPresets.length === 0 && shownDownloads.length === 0 && !customSlug ? (+ ) : groups.length === 0 &&+ favoriteRows.length === 0 &&+ moaPresets.length === 0 &&+ shownDownloads.length === 0 &&+ !customSlug ? (<DropdownMenuItem className={dropdownMenuRow} disabled>{copy.noModels}</DropdownMenuItem>) : hasList ? (<div className="max-h-[max(150px,30dvh)] overflow-y-auto py-0.5" ref={listRef}>- {/* Pinned models first — the shortcut the pin exists for. The- section paints nothing while searching, where every match is- listed in its provider's place instead. */}- {pinnedRows.length > 0 ? (+ {/* Favorites first — the shortcut the star exists for. The section+ paints nothing with no favorites, and nothing while searching,+ where every match is listed in its provider's place instead. */}+ {favoriteRows.length > 0 ? (<DropdownMenuGroup className="py-0.5">- <DropdownMenuLabel className={dropdownMenuSectionLabel}>{copy.pinned}</DropdownMenuLabel>- {pinnedRows.map(({ family, provider }) => (+ <DropdownMenuLabel className={catalogGroupLabel}>{copy.favorites}</DropdownMenuLabel>+ {favoriteRows.map(({ family, provider }) => (<ModelFamilyRowcontroller={controller}current={current}defaultEffort={defaultEffort}family={family}+ favoritekbProps={kbRowProps(`${provider.slug}:${family.id}`)}key={`${provider.slug}:${family.id}`}loadingModels={loadingModels}onSelect={selectFamily}onSubOpenChange={handleSubOpenChange}- pinnedKeys={pinnedKeys}provider={provider}search={search}showProvider@@ -717,7 +747,10 @@ export function ModelCatalogMenu({return (<DropdownMenuGroup className="py-0.5" key={slug}><DropdownMenuItem- className="group/label flex w-full items-center gap-1 px-2 pb-0.5 pt-0.5 text-[0.625rem] font-semibold uppercase tracking-wider text-(--ui-text-tertiary) cursor-pointer !bg-transparent focus:!bg-transparent"+ className={cn(+ catalogGroupLabel,+ 'group/label flex w-full cursor-pointer items-center gap-1 !bg-transparent focus:!bg-transparent'+ )}onSelect={event => {event.preventDefault()toggleCollapsedProvider(slug)@@ -740,12 +773,12 @@ export function ModelCatalogMenu({current={current}defaultEffort={defaultEffort}family={family}+ favorite={favoriteSet.has(favoriteModelKey(group.provider.slug, family.id))}kbProps={kbRowProps(`${group.provider.slug}:${family.id}`)}key={`${group.provider.slug}:${family.id}`}loadingModels={loadingModels}onSelect={selectFamily}onSubOpenChange={handleSubOpenChange}- pinnedKeys={pinnedKeys}provider={group.provider}search={search}/>@@ -760,9 +793,7 @@ export function ModelCatalogMenu({})}{!hasLocalGroup && shownDownloads.length > 0 && (<DropdownMenuGroup className="py-0.5" key="local-downloads">- <DropdownMenuLabel className="px-2 pb-0.5 pt-0.5 text-[0.625rem] font-semibold uppercase tracking-wider text-(--ui-text-tertiary)">- {copyPicker.localDownloadsHeading}- </DropdownMenuLabel>+ <DropdownMenuLabel className={catalogGroupLabel}>{copyPicker.localDownloadsHeading}</DropdownMenuLabel>{shownDownloads.map(job => (<DownloadingModelRow jobId={job.jobId} key={job.jobId} owner={owner} target={job.target} />))}@@ -856,27 +887,27 @@ export function ModelCatalogMenu({export { dropdownMenuRow }/** Row props the flat keyboard selection paints onto whichever trigger is- * active — shared by the Pinned section and the provider groups. */+ * active — shared by the Favorites section and the provider groups. */interface KbRowProps {'data-kb-active'?: stringclassName: string}-/** One pinned model, resolved against the live catalog. */-interface PinnedRow {+/** One favorite model, resolved against the live catalog. */+interface FavoriteRow {family: ModelFamilyprovider: ModelOptionProvider}-/** Resolve stored pins into paintable rows, in the order the user pinned- * them. A key with no family in THIS catalog yields no row — and is not- * dropped, so it comes back when its provider reconnects. */-function resolvePinnedRows(providers: readonly ModelOptionProvider[], keys: readonly string[]): PinnedRow[] {- const byKey = new Map<string, PinnedRow>()+/** Resolve stored favorites into paintable rows, in the order the user+ * starred them. A key with no family in THIS catalog yields no row — and is+ * not dropped, so it comes back when its provider reconnects. */+function resolveFavoriteRows(providers: readonly ModelOptionProvider[], keys: readonly string[]): FavoriteRow[] {+ const byKey = new Map<string, FavoriteRow>()for (const provider of providers) {for (const family of collapseModelFamilies(provider.models ?? [])) {- byKey.set(pinnedModelKey(provider.slug, family.id), { family, provider })+ byKey.set(favoriteModelKey(provider.slug, family.id), { family, provider })}}@@ -892,35 +923,37 @@ interface ModelFamilyRowProps {current: ModelChoicedefaultEffort: stringfamily: ModelFamily- /** Keyboard/hover props built by the host, so the Pinned section and the- * provider groups share ONE flat selection order. */+ /** Whether this model is starred — paints the filled star. */+ favorite: boolean+ /** Keyboard/hover props built by the host, so the Favorites section and+ * the provider groups share ONE flat selection order. */kbProps: KbRowPropsloadingModels: Record<string, LocalModelLoadProgress>/** Commit this family — what a click means belongs to the host that owns it. */onSelect: (family: ModelFamily, provider: ModelOptionProvider) => Promise<boolean | void> | void/** Keyboard-focus round trip for the sub this row opens (#86966). */onSubOpenChange?: (open: boolean, key: string) => void- pinnedKeys: readonly string[]provider: ModelOptionProvidersearch: string- /** Name the provider on the row. On in the Pinned section, where rows+ /** Name the provider on the row. On in the Favorites section, where rows* from every provider sit together and two labs can share a model name. */showProvider?: boolean}-/** One model family row: the trigger that commits the model, plus the- * hover-revealed options submenu. Shared by the Pinned section and the- * provider groups, so the two can never paint a model differently. */+/** One model family row: the favorite star, the trigger that commits the+ * model, plus the hover-revealed options submenu. Shared by the Favorites+ * section and the provider groups, so the two can never paint a model+ * differently. */function ModelFamilyRow({controller,current,defaultEffort,family,+ favorite,kbProps,loadingModels,onSelect,onSubOpenChange,- pinnedKeys,provider,search,showProvider@@ -971,7 +1004,7 @@ function ModelFamilyRow({// Row meta (provider, variant tag, fast mode, reasoning effort) renders as// discrete badge chips BESIDE the name — not appended to it — so "High"// reads as the model's reasoning setting, never as part of a differently-- // named model. The provider chip only paints in the Pinned section,+ // named model. The provider chip only paints in the Favorites section,// where rows from every provider sit together.const metaTags = [showProvider ? provider.name : null,@@ -983,7 +1016,7 @@ function ModelFamilyRow({].filter((chip): chip is string => Boolean(chip))// Clicking the row commits the model and closes; the edit submenu- // (reasoning/fast/pin) is reached by HOVER, so you can tweak those without+ // (reasoning/fast) is reached by HOVER, so you can tweak those without// the click dismissing everything. The trailing caret is what advertises// that submenu — without it the row's effort badge reads as a fixed// model+effort combo rather than an editable setting (#86966).@@ -995,19 +1028,23 @@ function ModelFamilyRow({closeMenu()}- const togglePin = () => togglePinnedModel(provider.slug, family.id)+ const toggleFavorite = () => {+ triggerHaptic('selection')+ toggleFavoriteModel(provider.slug, family.id)+ }++ const favoriteLabel = favorite ? copy.removeFavorite : copy.addFavoritereturn (<DropdownMenuSub onOpenChange={open => onSubOpenChange?.(open, rowKey)}><DropdownMenuSubTriggeronClick={event => {- // Shift-click pins, the same gesture as a chat row in the sidebar.- // Nothing is picked and the menu stays open, so a second shift-click- // (on the row, now in the Pinned section) undoes it.+ // Shift-click stars, the same gesture that pins a chat row in the+ // sidebar. Nothing is picked and the menu stays open, so a second+ // shift-click (on the row, now under Favorites) undoes it.if (event.shiftKey) {event.preventDefault()- triggerHaptic('selection')- togglePin()+ toggleFavorite()return}@@ -1020,7 +1057,35 @@ function ModelFamilyRow({}}}{...kbProps}+ className={cn(kbProps.className, 'group/model')}>+ {/* The star IS the favorite control: filled when starred, a quiet+ outline otherwise. Its click never reaches the row, so starring+ neither selects the model nor closes the menu. Not a tab stop —+ the search field owns keyboard focus (Shift+Enter stars). */}+ <Tip+ label={<TipHintLabel hint={favorite ? undefined : copy.favoriteShortcut} text={favoriteLabel} />}+ >+ <button+ aria-label={favoriteLabel}+ aria-pressed={favorite}+ className={cn(+ '-mx-0.5 grid size-4 shrink-0 place-items-center rounded-sm transition-colors duration-100 hover:text-foreground hover:transition-none',+ favorite+ ? 'text-(--ui-text-secondary)'+ : 'text-(--ui-text-quaternary) group-hover/model:text-(--ui-text-tertiary) group-hover/model:transition-none group-data-[kb-active]/model:text-(--ui-text-tertiary)'+ )}+ onClick={event => {+ event.preventDefault()+ event.stopPropagation()+ toggleFavorite()+ }}+ tabIndex={-1}+ type="button"+ >+ <Codicon name={favorite ? 'star-full' : 'star-empty'} size="0.75rem" />+ </button>+ </Tip><span className="flex min-w-0 flex-1 items-center gap-1.5"><span className="min-w-0 truncate"><HighlightMatches foldSeparators query={search} text={name} />@@ -1054,13 +1119,11 @@ function ModelFamilyRow({effortWire={isCurrent ? current.effortWire : undefined}fastControl={fastControl}isActive={isCurrent}- isPinned={pinnedKeys.includes(pinnedModelKey(provider.slug, family.id))}model={family.id}onSelectModel={nextModel => controller.select(nextModel, provider.slug)}onSetOptions={patch =>controller.setOptions(patch, { isActive: isCurrent, model: family.id, provider: provider.slug })}- onTogglePin={togglePin}provider={provider.slug}reasoning={caps?.reasoning ?? true}/>@@ -1080,6 +1143,10 @@ function caretAtEnd(input: HTMLInputElement): boolean {// _local_runtime_row). Downloads-in-flight attach to this group.const LOCAL_PROVIDER_SLUG = 'llamacpp'+// Heading for every row group in the list (Favorites, providers, downloads).+const catalogGroupLabel =+ 'px-2 pb-0.5 pt-0.5 text-[0.625rem] font-semibold uppercase tracking-wider text-(--ui-text-tertiary)'+// A model still downloading: visible so the user knows it's coming (and// where it will land), disabled so it can't be selected early, with the// same byte progress the Local Models pane shows. Percent is selected HERE,@@ -1156,7 +1223,8 @@ function groupModels(search: string,current: { model: string; provider: string },visible: Set<string> | null,- pinned: ReadonlySet<string>+ /** Favorites to leave out (they paint in their own section); null lists every row. */+ favorites: ReadonlySet<string> | null): ProviderGroup[] {const q = normalize(search)const groups: ProviderGroup[] = []@@ -1196,19 +1264,11 @@ function groupModels(? allFamilies.find(family => family.id === current.model || family.fastId === current.model)?.id: undefined- // Pinned families already paint in the Pinned section, so drop them- // here: an open menu never lists the same model twice. Only while not- // searching — a query lists every match in its provider's place.- const pinnedHere = q- ? null- : new Set(- allFamilies- .filter(family => pinned.has(pinnedModelKey(provider.slug, family.id)))- .map(family => family.id)- )-+ // Favorites already paint in the Favorites section, so drop them here:+ // an open menu never lists the same model twice.const families = allFamilies.filter(- family => (shown.has(family.id) || family.id === activeId) && !pinnedHere?.has(family.id)+ family =>+ (shown.has(family.id) || family.id === activeId) && !favorites?.has(favoriteModelKey(provider.slug, family.id)))if (families.length > 0) {diff --git a/apps/desktop/src/app/shell/model-edit-submenu.test.tsx b/apps/desktop/src/app/shell/model-edit-submenu.test.tsxindex 6231acf1112..3685f8e44aa 100644--- a/apps/desktop/src/app/shell/model-edit-submenu.test.tsx+++ b/apps/desktop/src/app/shell/model-edit-submenu.test.tsx@@ -28,10 +28,8 @@ function renderSubmenu(opts: {effort?: stringfastControl: FastControlisActive?: boolean- isPinned?: booleanonSelectModel?: (model: string) => voidonSetOptions: (patch: { effort?: string; fast?: boolean }) => void- onTogglePin?: () => voidreasoning: boolean}) {return render(@@ -44,11 +42,9 @@ function renderSubmenu(opts: {effort={opts.effort ?? 'medium'}fastControl={opts.fastControl}isActive={opts.isActive ?? true}- isPinned={opts.isPinned}model="m1"onSelectModel={opts.onSelectModel ?? vi.fn()}onSetOptions={opts.onSetOptions}- onTogglePin={opts.onTogglePin}provider="p1"reasoning={opts.reasoning}/>@@ -133,39 +129,3 @@ describe('ModelEditSubmenu reports edits without performing them', () => {expect(onSelectModel).toHaveBeenCalledWith('m1-fast')})})--// Pinning is not a capability: lifting a model to the top of the picker has-// nothing to do with what the model can be asked for, so the row reports it-// even when the submenu has nothing else to offer.-describe('ModelEditSubmenu reports pins without performing them', () => {- it('offers the pin even on a model with no reasoning or fast options', () => {- const onTogglePin = vi.fn()- renderSubmenu({ fastControl: { kind: 'none' }, onSetOptions: vi.fn(), onTogglePin, reasoning: false })-- expect(screen.getByText('No options for this model')).toBeTruthy()-- fireEvent.click(screen.getByText('Pin'))-- expect(onTogglePin).toHaveBeenCalled()- })-- it('names the pin action by state, so unpinning is never a blind click', () => {- renderSubmenu({- fastControl: { kind: 'none' },- isPinned: true,- onSetOptions: vi.fn(),- onTogglePin: vi.fn(),- reasoning: false- })-- expect(screen.getByText('Unpin')).toBeTruthy()- expect(screen.queryByText('Pin')).toBeNull()- })-- it('renders no pin row when the surface passes no toggle', () => {- renderSubmenu({ fastControl: { kind: 'none' }, onSetOptions: vi.fn(), reasoning: false })-- expect(screen.queryByText('Pin')).toBeNull()- expect(screen.queryByText('Unpin')).toBeNull()- })-})diff --git a/apps/desktop/src/app/shell/model-edit-submenu.tsx b/apps/desktop/src/app/shell/model-edit-submenu.tsxindex b966aed4481..f7b38ced10b 100644--- a/apps/desktop/src/app/shell/model-edit-submenu.tsx+++ b/apps/desktop/src/app/shell/model-edit-submenu.tsx@@ -1,6 +1,5 @@import { REASONING_EFFORTS } from '@hermes/shared'-import { Codicon } from '@/components/ui/codicon'import {DropdownMenuItem,DropdownMenuLabel,@@ -9,7 +8,6 @@ import {dropdownMenuRow,dropdownMenuSectionLabel,DropdownMenuSeparator,- DropdownMenuShortcut,DropdownMenuSubContent} from '@/components/ui/dropdown-menu'import { Switch } from '@/components/ui/switch'@@ -80,9 +78,6 @@ interface ModelEditSubmenuProps {fastControl: FastControl/** Whether this row's model is the active one. */isActive: boolean- /** Whether this row's model is pinned (lifted to the top of the catalog).- * Only meaningful together with `onTogglePin`. */- isPinned?: boolean/** This row's model id. */model: string/** Switch to a specific model id (used to swap base ⇄ -fast variant). */@@ -92,10 +87,6 @@ interface ModelEditSubmenuProps {* controller decides what an edit means. That's what lets the same submenu* drive a live chat session and a detached per-task override. */onSetOptions: (patch: { effort?: string; fast?: boolean }) => void- /** Pin or unpin this row's model — reported like any other edit, the- * catalog owns where a pin is kept. Absent on surfaces that have no- * catalog behind them (the composer's reasoning pill). */- onTogglePin?: () => void/** This row's provider slug. */provider: string/** Whether this model supports reasoning effort. */@@ -124,10 +115,8 @@ export function ModelOptionsContent({effortWire,fastControl,isActive,- isPinned,onSelectModel,onSetOptions,- onTogglePin,reasoning}: ModelEditSubmenuProps) {const { t } = useI18n()@@ -160,73 +149,44 @@ export function ModelOptionsContent({const hasFast = fastControl.kind !== 'none'const fastOn = fastControl.kind === 'none' ? false : fastControl.on- return (+ return !hasFast && !reasoning ? (+ <div className="px-2.5 py-3 text-xs text-(--ui-text-tertiary)">{copy.noOptions}</div>+ ) : (<>- {!hasFast && !reasoning ? (- <div className="px-2.5 py-3 text-xs text-(--ui-text-tertiary)">{copy.noOptions}</div>- ) : (- <>- <DropdownMenuLabel className={dropdownMenuSectionLabel}>{copy.options}</DropdownMenuLabel>- {showThinkingToggle ? (- <DropdownMenuItem className={dropdownMenuRow} onSelect={event => event.preventDefault()}>- {copy.thinking}- <Switch- checked={thinkingOn}- className="ml-auto"- onCheckedChange={checked => onSetOptions({ effort: checked ? effortValue || defaultEffort : 'none' })}- size="xs"- />- </DropdownMenuItem>- ) : null}- {hasFast ? (- <DropdownMenuItem className={dropdownMenuRow} onSelect={event => event.preventDefault()}>- {copy.fast}- <Switch checked={fastOn} className="ml-auto" onCheckedChange={setFast} size="xs" />- </DropdownMenuItem>- ) : null}- {reasoning ? (- <>- <DropdownMenuSeparator className="mx-0" />- <DropdownMenuLabel className={dropdownMenuSectionLabel}>{copy.effort}</DropdownMenuLabel>- <DropdownMenuRadioGroup onValueChange={value => onSetOptions({ effort: value })} value={effortValue}>- {REASONING_EFFORTS.map(value => (- <DropdownMenuRadioItem- className={dropdownMenuRow}- key={value}- onSelect={event => event.preventDefault()}- value={value}- >- {clamp?.effort === value ? `${copy[value]} (${copy.sendsOnRoute(copy[clamp.wire])})` : copy[value]}- </DropdownMenuRadioItem>- ))}- </DropdownMenuRadioGroup>- </>- ) : null}- </>- )}- {/* Pinning sits OUTSIDE the capability gates above: lifting a model to- the top of the picker has nothing to do with what it can be asked- for, so a model with no reasoning/fast options still offers it. Only- the catalog passes the callback; the reasoning pill has no list to- reorder. The trailing hint teaches the row's shift-click shortcut,- the same gesture that pins a chat in the sidebar. */}- {onTogglePin ? (+ <DropdownMenuLabel className={dropdownMenuSectionLabel}>{copy.options}</DropdownMenuLabel>+ {showThinkingToggle ? (+ <DropdownMenuItem className={dropdownMenuRow} onSelect={event => event.preventDefault()}>+ {copy.thinking}+ <Switch+ checked={thinkingOn}+ className="ml-auto"+ onCheckedChange={checked => onSetOptions({ effort: checked ? effortValue || defaultEffort : 'none' })}+ size="xs"+ />+ </DropdownMenuItem>+ ) : null}+ {hasFast ? (+ <DropdownMenuItem className={dropdownMenuRow} onSelect={event => event.preventDefault()}>+ {copy.fast}+ <Switch checked={fastOn} className="ml-auto" onCheckedChange={setFast} size="xs" />+ </DropdownMenuItem>+ ) : null}+ {reasoning ? (<><DropdownMenuSeparator className="mx-0" />- <DropdownMenuItem- className={dropdownMenuRow}- onSelect={event => {- event.preventDefault()- onTogglePin()- }}- title={copy.shiftClickHint}- >- <Codicon name="pin" size="0.75rem" />- {isPinned ? copy.unpin : copy.pin}- {isPinned ? null : (- <DropdownMenuShortcut className="pl-3 tracking-normal">{copy.pinShortcut}</DropdownMenuShortcut>- )}- </DropdownMenuItem>+ <DropdownMenuLabel className={dropdownMenuSectionLabel}>{copy.effort}</DropdownMenuLabel>+ <DropdownMenuRadioGroup onValueChange={value => onSetOptions({ effort: value })} value={effortValue}>+ {REASONING_EFFORTS.map(value => (+ <DropdownMenuRadioItem+ className={dropdownMenuRow}+ key={value}+ onSelect={event => event.preventDefault()}+ value={value}+ >+ {clamp?.effort === value ? `${copy[value]} (${copy.sendsOnRoute(copy[clamp.wire])})` : copy[value]}+ </DropdownMenuRadioItem>+ ))}+ </DropdownMenuRadioGroup></>) : null}</>diff --git a/apps/desktop/src/i18n/ar.ts b/apps/desktop/src/i18n/ar.tsindex b8ec1f7cd2c..dd990d3a784 100644--- a/apps/desktop/src/i18n/ar.ts+++ b/apps/desktop/src/i18n/ar.ts@@ -2940,7 +2940,10 @@ export const ar = defineLocale({editModels: 'تحرير النماذج',followDefault: 'استخدام الافتراضي من الإعدادات',refreshModels: 'تحديث النماذج',- pinned: 'المثبتة',+ favorites: 'المفضلة',+ addFavorite: 'إضافة إلى المفضلة',+ removeFavorite: 'إزالة من المفضلة',+ favoriteShortcut: '⇧ نقرة',fast: 'سريع',free: 'مجاني',cacheRead: 'قراءة من الذاكرة المؤقتة',@@ -2952,10 +2955,6 @@ export const ar = defineLocale({options: 'الخيارات',thinking: 'التفكير',fast: 'سريع',- pin: 'تثبيت',- unpin: 'إلغاء التثبيت',- shiftClickHint: 'انقر مع Shift على نموذج لتثبيته',- pinShortcut: '⇧ نقرة',effort: 'الجهد',minimal: 'أدنى',low: 'منخفض',diff --git a/apps/desktop/src/i18n/de.ts b/apps/desktop/src/i18n/de.tsindex 8fdb8bac594..efbfca23b48 100644--- a/apps/desktop/src/i18n/de.ts+++ b/apps/desktop/src/i18n/de.ts@@ -5044,7 +5044,10 @@ export const deOverrides = {editModels: 'Modelle bearbeiten…',followDefault: 'Standard aus den Einstellungen verwenden',refreshModels: 'Modelle aktualisieren',- pinned: 'Angepinnt',+ favorites: 'Favoriten',+ addFavorite: 'Zu Favoriten hinzufügen',+ removeFavorite: 'Aus Favoriten entfernen',+ favoriteShortcut: '⇧ Klick',fast: 'Schnell',free: 'kostenlos',cacheRead: 'Cache-Lesung',@@ -5056,10 +5059,6 @@ export const deOverrides = {options: 'Optionen',thinking: 'Denken',fast: 'Schnell',- pin: 'Anpinnen',- unpin: 'Lösen',- shiftClickHint: 'Shift-Klick auf ein Modell zum Anpinnen',- pinShortcut: '⇧ Klick',effort: 'Aufwand',minimal: 'Minimal',low: 'Niedrig',diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex 18cf6e27bed..0c2432cf619 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -4647,7 +4647,10 @@ export const en: Translations = {editModels: 'Edit models…',followDefault: 'Use Settings default',refreshModels: 'Refresh models',- pinned: 'Pinned',+ favorites: 'Favorites',+ addFavorite: 'Add to favorites',+ removeFavorite: 'Remove from favorites',+ favoriteShortcut: '⇧ Click',fast: 'Fast',free: 'free',cacheRead: 'cached read',@@ -4659,10 +4662,6 @@ export const en: Translations = {options: 'Options',thinking: 'Thinking',fast: 'Fast',- pin: 'Pin',- unpin: 'Unpin',- shiftClickHint: 'Shift-click a model to pin',- pinShortcut: '⇧ Click',effort: 'Effort',minimal: 'Minimal',low: 'Low',diff --git a/apps/desktop/src/i18n/es.ts b/apps/desktop/src/i18n/es.tsindex 7d72b814ec4..8b73d86d7cb 100644--- a/apps/desktop/src/i18n/es.ts+++ b/apps/desktop/src/i18n/es.ts@@ -5036,7 +5036,10 @@ export const esOverrides = {editModels: 'Editar modelos…',followDefault: 'Usar el predeterminado de Ajustes',refreshModels: 'Actualizar modelos',- pinned: 'Fijadas',+ favorites: 'Favoritos',+ addFavorite: 'Añadir a favoritos',+ removeFavorite: 'Quitar de favoritos',+ favoriteShortcut: '⇧ Clic',fast: 'Rápido',free: 'gratis',cacheRead: 'lectura en caché',@@ -5048,10 +5051,6 @@ export const esOverrides = {options: 'Opciones',thinking: 'Razonamiento',fast: 'Rápido',- pin: 'Fijar',- unpin: 'Desfijar',- shiftClickHint: 'Mayús-clic en un modelo para fijarlo',- pinShortcut: '⇧ Clic',effort: 'Esfuerzo',minimal: 'Mínimo',low: 'Bajo',diff --git a/apps/desktop/src/i18n/fr.ts b/apps/desktop/src/i18n/fr.tsindex b6fba7459ef..12eb9f91d34 100644--- a/apps/desktop/src/i18n/fr.ts+++ b/apps/desktop/src/i18n/fr.ts@@ -5058,7 +5058,10 @@ export const frOverrides = {editModels: 'Modifier les modèles…',followDefault: 'Utiliser le modèle par défaut des Réglages',refreshModels: 'Actualiser les modèles',- pinned: 'Épinglées',+ favorites: 'Favoris',+ addFavorite: 'Ajouter aux favoris',+ removeFavorite: 'Retirer des favoris',+ favoriteShortcut: '⇧ Clic',fast: 'Rapide',free: 'gratuit',cacheRead: 'lecture en cache',@@ -5070,10 +5073,6 @@ export const frOverrides = {options: 'Options',thinking: 'Réflexion',fast: 'Rapide',- pin: 'Épingler',- unpin: 'Désépingler',- shiftClickHint: "Shift-clic sur un modèle pour l'épingler",- pinShortcut: '⇧ Clic',effort: 'Effort',minimal: 'Minimal',low: 'Faible',diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.tsindex 0f4333868f1..4652e562cf6 100644--- a/apps/desktop/src/i18n/ja.ts+++ b/apps/desktop/src/i18n/ja.ts@@ -3389,7 +3389,10 @@ export const ja = defineLocale({editModels: 'モデルを編集…',followDefault: '設定のデフォルトを使用',refreshModels: 'モデルを更新',- pinned: 'ピン留め',+ favorites: 'お気に入り',+ addFavorite: 'お気に入りに追加',+ removeFavorite: 'お気に入りから削除',+ favoriteShortcut: '⇧ クリック',fast: '高速',free: '無料',cacheRead: 'キャッシュ読み取り',@@ -3401,10 +3404,6 @@ export const ja = defineLocale({options: 'オプション',thinking: '思考',fast: '高速',- pin: 'ピン留め',- unpin: 'ピン留めを解除',- shiftClickHint: 'Shift クリックでモデルをピン留め',- pinShortcut: '⇧ クリック',effort: '努力度',minimal: '最小',low: '低',diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.tsindex 66b1803c391..ac56756a79d 100644--- a/apps/desktop/src/i18n/ru.ts+++ b/apps/desktop/src/i18n/ru.ts@@ -3616,7 +3616,10 @@ export const ru = defineLocale({editModels: 'Изменить модели…',followDefault: 'Использовать модель по умолчанию из настроек',refreshModels: 'Обновить модели',- pinned: 'Закреплённые',+ favorites: 'Избранное',+ addFavorite: 'Добавить в избранное',+ removeFavorite: 'Убрать из избранного',+ favoriteShortcut: '⇧ Клик',fast: 'Быстрая',free: 'бесплатно',cacheRead: 'чтение из кэша',@@ -3628,10 +3631,6 @@ export const ru = defineLocale({options: 'Опции',thinking: 'Размышление',fast: 'Быстрая',- pin: 'Закрепить',- unpin: 'Открепить',- shiftClickHint: 'Shift-клик по модели, чтобы закрепить',- pinShortcut: '⇧ Клик',effort: 'Усилия',minimal: 'Минимально',low: 'Низкое',diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.tsindex d53d50fd785..98c441858fe 100644--- a/apps/desktop/src/i18n/types.ts+++ b/apps/desktop/src/i18n/types.ts@@ -3899,7 +3899,10 @@ export interface Translations {editModels: stringfollowDefault: stringrefreshModels: string- pinned: string+ favorites: string+ addFavorite: string+ removeFavorite: string+ favoriteShortcut: stringfast: stringfree: stringcacheRead: string@@ -3910,10 +3913,6 @@ export interface Translations {options: stringthinking: stringfast: string- pin: string- unpin: string- shiftClickHint: string- pinShortcut: stringeffort: stringminimal: stringlow: stringdiff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.tsindex 2aa9139e05e..3fa5f070709 100644--- a/apps/desktop/src/i18n/zh-hant.ts+++ b/apps/desktop/src/i18n/zh-hant.ts@@ -3570,7 +3570,10 @@ export const zhHant = defineLocale({editModels: '編輯模型…',followDefault: '使用設定中的預設模型',refreshModels: '重新整理模型',- pinned: '已釘選',+ favorites: '我的最愛',+ addFavorite: '加入我的最愛',+ removeFavorite: '從我的最愛移除',+ favoriteShortcut: '⇧ 點擊',fast: '快速',free: '免費',cacheRead: '快取讀取',@@ -3582,10 +3585,6 @@ export const zhHant = defineLocale({options: '選項',thinking: '思考',fast: '快速',- pin: '釘選',- unpin: '取消釘選',- shiftClickHint: 'Shift + 點擊模型以釘選',- pinShortcut: '⇧ 點擊',effort: '推理強度',minimal: '最小',low: '低',diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.tsindex 117d21f1d71..5fa5aeadcd6 100644--- a/apps/desktop/src/i18n/zh.ts+++ b/apps/desktop/src/i18n/zh.ts@@ -4345,7 +4345,10 @@ export const zh = defineLocale({editModels: '编辑模型…',followDefault: '使用设置中的默认模型',refreshModels: '刷新模型',- pinned: '已置顶',+ favorites: '收藏',+ addFavorite: '添加到收藏',+ removeFavorite: '从收藏中移除',+ favoriteShortcut: '⇧ 单击',fast: '快速',free: '免费',cacheRead: '缓存读取',@@ -4357,10 +4360,6 @@ export const zh = defineLocale({options: '选项',thinking: '思考',fast: '快速',- pin: '置顶',- unpin: '取消置顶',- shiftClickHint: 'Shift+ 单击模型以置顶',- pinShortcut: '⇧ 单击',effort: '推理强度',minimal: '最小',low: '低',diff --git a/apps/desktop/src/store/favorite-models.test.ts b/apps/desktop/src/store/favorite-models.test.tsnew file mode 100644index 00000000000..75fa4f78b0a--- /dev/null+++ b/apps/desktop/src/store/favorite-models.test.ts@@ -0,0 +1,102 @@+import { afterEach, beforeEach, describe, expect, it } from 'vitest'++import {+ $favoriteModels,+ favoriteModelKey,+ isModelFavorite,+ setFavoriteModels,+ toggleFavoriteModel+} from './favorite-models'++const STORAGE_KEY = 'hermes.desktop.favorite-models'++beforeEach(() => {+ window.localStorage.clear()+ $favoriteModels.set([])+})++afterEach(() => {+ window.localStorage.clear()+})++// Favorite order IS the display order — the catalog renders favorites in this+// array's order, so "most recently starred wins the top slot" would be a+// behaviour change, not a detail. Appending keeps a user's first star where+// they put it.+describe('favorite models keep their starred order', () => {+ it('appends new favorites after existing ones', () => {+ toggleFavoriteModel('nous', 'opus-5')+ toggleFavoriteModel('anthropic', 'claude-sonnet-5')++ expect($favoriteModels.get()).toEqual([+ favoriteModelKey('nous', 'opus-5'),+ favoriteModelKey('anthropic', 'claude-sonnet-5')+ ])+ })++ it('unfavoriting leaves the remaining order intact', () => {+ toggleFavoriteModel('nous', 'opus-5')+ toggleFavoriteModel('anthropic', 'claude-sonnet-5')+ toggleFavoriteModel('google', 'gemini-3.1-pro')++ toggleFavoriteModel('anthropic', 'claude-sonnet-5')++ expect($favoriteModels.get()).toEqual([+ favoriteModelKey('nous', 'opus-5'),+ favoriteModelKey('google', 'gemini-3.1-pro')+ ])+ })++ it('re-starring an unfavorited model puts it at the end, not back in its old slot', () => {+ toggleFavoriteModel('nous', 'opus-5')+ toggleFavoriteModel('google', 'gemini-3.1-pro')++ toggleFavoriteModel('nous', 'opus-5')+ toggleFavoriteModel('nous', 'opus-5')++ expect($favoriteModels.get()).toEqual([+ favoriteModelKey('google', 'gemini-3.1-pro'),+ favoriteModelKey('nous', 'opus-5')+ ])+ })+})++// A favorite is a durable preference: it has to survive the window closing,+// so the store must reach localStorage rather than only the atom.+describe('favorites persist', () => {+ it('writes the favorites list to storage', () => {+ toggleFavoriteModel('nous', 'opus-5')++ expect(JSON.parse(window.localStorage.getItem(STORAGE_KEY) ?? '[]')).toEqual([favoriteModelKey('nous', 'opus-5')])+ })++ it('clears the key once the last favorite is removed', () => {+ toggleFavoriteModel('nous', 'opus-5')+ toggleFavoriteModel('nous', 'opus-5')++ expect(window.localStorage.getItem(STORAGE_KEY)).toBeNull()+ })+})++// Models from different providers can share an id (an aggregator and the lab+// both serve `claude-opus-5`); starring one must not star the other.+describe('favorites are provider-scoped', () => {+ it('does not report a same-named model on another provider as a favorite', () => {+ toggleFavoriteModel('nous', 'claude-opus-5')++ expect(isModelFavorite('nous', 'claude-opus-5')).toBe(true)+ expect(isModelFavorite('openrouter', 'claude-opus-5')).toBe(false)+ })+})++// The whole list can be staged in one write (tests, a future settings UI);+// it must not grow a duplicate entry for one model.+describe('the favorites list dedupes on replace', () => {+ it('collapses duplicate keys', () => {+ const key = favoriteModelKey('google', 'gemini-3.1-pro')++ setFavoriteModels([key, key])++ expect($favoriteModels.get()).toEqual([key])+ })+})diff --git a/apps/desktop/src/store/favorite-models.ts b/apps/desktop/src/store/favorite-models.tsnew file mode 100644index 00000000000..296ac3a8770--- /dev/null+++ b/apps/desktop/src/store/favorite-models.ts@@ -0,0 +1,43 @@+import { atom } from 'nanostores'++import { persistStringArray, storedStringArray } from '@/lib/storage'++import { modelVisibilityKey } from './model-visibility'++const STORAGE_KEY = 'hermes.desktop.favorite-models'++/** Stable `provider::model` key for a favorite. Reuses the visibility-store+ * format so every model identity in the app is written the same way. */+export const favoriteModelKey = modelVisibilityKey++/**+ * Models the user starred into the Favorites section at the top of the model+ * catalog menu, ordered by when they were starred (first starred = first+ * shown). A renderer-local presentation preference in the same family as the+ * Edit Models shortlist and model presets: favorites only reshape THIS+ * dropdown's ordering, never the backend catalog. A key whose model the+ * current catalog no longer carries is kept, not dropped, so it returns when+ * its provider does.+ */+export const $favoriteModels = atom<string[]>(storedStringArray(STORAGE_KEY))++/** Whether a provider/model pair is currently a favorite. */+export function isModelFavorite(provider: string, model: string): boolean {+ return $favoriteModels.get().includes(favoriteModelKey(provider, model))+}++/** Replace the whole favorites list. Deduped, and an empty list clears the key. */+export function setFavoriteModels(keys: readonly string[]): void {+ const next = [...new Set(keys)]++ $favoriteModels.set(next)+ persistStringArray(STORAGE_KEY, next)+}++/** Favorite a provider/model pair (appended to the order) or unfavorite it. */+export function toggleFavoriteModel(provider: string, model: string): void {+ const key = favoriteModelKey(provider, model)+ const current = $favoriteModels.get()++ setFavoriteModels(current.includes(key) ? current.filter(entry => entry !== key) : [...current, key])+}diff --git a/apps/desktop/src/store/pinned-models.test.ts b/apps/desktop/src/store/pinned-models.test.tsdeleted file mode 100644index ca0f67bff3a..00000000000--- a/apps/desktop/src/store/pinned-models.test.ts+++ /dev/null@@ -1,103 +0,0 @@-import { afterEach, beforeEach, describe, expect, it } from 'vitest'--import {- $pinnedModels,- isModelPinned,- pinnedModelKey,- setPinnedModels,- togglePinnedModel-} from './pinned-models'--const STORAGE_KEY = 'hermes.desktop.pinned-models'--beforeEach(() => {- window.localStorage.clear()- $pinnedModels.set([])-})--afterEach(() => {- window.localStorage.clear()-})--// Pin order IS the display order — the catalog renders pins in this array's-// order, so "most recently pinned wins the top slot" would be a behaviour-// change, not a detail. Appending keeps a user's first pin where they put it.-describe('pinned models keep their pin order', () => {- it('appends new pins after existing ones', () => {- togglePinnedModel('nous', 'opus-5')- togglePinnedModel('anthropic', 'claude-sonnet-5')-- expect($pinnedModels.get()).toEqual([- pinnedModelKey('nous', 'opus-5'),- pinnedModelKey('anthropic', 'claude-sonnet-5')- ])- })-- it('unpinning leaves the remaining order intact', () => {- togglePinnedModel('nous', 'opus-5')- togglePinnedModel('anthropic', 'claude-sonnet-5')- togglePinnedModel('google', 'gemini-3.1-pro')-- togglePinnedModel('anthropic', 'claude-sonnet-5')-- expect($pinnedModels.get()).toEqual([- pinnedModelKey('nous', 'opus-5'),- pinnedModelKey('google', 'gemini-3.1-pro')- ])- })-- it('re-pinning an unpinned model puts it at the end, not back in its old slot', () => {- togglePinnedModel('nous', 'opus-5')- togglePinnedModel('google', 'gemini-3.1-pro')-- togglePinnedModel('nous', 'opus-5')- togglePinnedModel('nous', 'opus-5')-- expect($pinnedModels.get()).toEqual([- pinnedModelKey('google', 'gemini-3.1-pro'),- pinnedModelKey('nous', 'opus-5')- ])- })-})--// A pin is a durable preference: it has to survive the window closing, so the-// store must reach localStorage rather than only the atom.-describe('pins persist', () => {- it('writes the pin list to storage', () => {- togglePinnedModel('nous', 'opus-5')-- expect(JSON.parse(window.localStorage.getItem(STORAGE_KEY) ?? '[]')).toEqual([- pinnedModelKey('nous', 'opus-5')- ])- })-- it('clears the key once the last pin is removed', () => {- togglePinnedModel('nous', 'opus-5')- togglePinnedModel('nous', 'opus-5')-- expect(window.localStorage.getItem(STORAGE_KEY)).toBeNull()- })-})--// Models from different providers can share an id (an aggregator and the lab-// both serve `claude-opus-5`); pinning one must not pin the other.-describe('pins are provider-scoped', () => {- it('does not report a same-named model on another provider as pinned', () => {- togglePinnedModel('nous', 'claude-opus-5')-- expect(isModelPinned('nous', 'claude-opus-5')).toBe(true)- expect(isModelPinned('openrouter', 'claude-opus-5')).toBe(false)- })-})--// The whole list can be staged in one write (tests, a future settings UI);-// it must not grow a duplicate entry for one model.-describe('the pin list dedupes on replace', () => {- it('collapses duplicate keys', () => {- const key = pinnedModelKey('google', 'gemini-3.1-pro')-- setPinnedModels([key, key])-- expect($pinnedModels.get()).toEqual([key])- })-})diff --git a/apps/desktop/src/store/pinned-models.ts b/apps/desktop/src/store/pinned-models.tsdeleted file mode 100644index 1fdbfe60f1b..00000000000--- a/apps/desktop/src/store/pinned-models.ts+++ /dev/null@@ -1,42 +0,0 @@-import { atom } from 'nanostores'--import { persistStringArray, storedStringArray } from '@/lib/storage'--import { modelVisibilityKey } from './model-visibility'--const STORAGE_KEY = 'hermes.desktop.pinned-models'--/** Stable `provider::model` key for a pin. Reuses the visibility-store format- * so every model identity in the app is written the same way. */-export const pinnedModelKey = modelVisibilityKey--/**- * Models the user pinned to the top of the model catalog menu, ordered by pin- * time (first pinned = first shown). A renderer-local presentation preference- * in the same family as the Edit Models shortlist and model presets: pins only- * reshape THIS dropdown's ordering, never the backend catalog or another- * surface's picker. A key whose model the current catalog no longer carries is- * kept, not dropped, so it returns when its provider does.- */-export const $pinnedModels = atom<string[]>(storedStringArray(STORAGE_KEY))--/** Whether a provider/model pair is currently pinned. */-export function isModelPinned(provider: string, model: string): boolean {- return $pinnedModels.get().includes(pinnedModelKey(provider, model))-}--/** Replace the whole pin list. Deduped, and an empty list clears the key. */-export function setPinnedModels(keys: readonly string[]): void {- const next = [...new Set(keys)]-- $pinnedModels.set(next)- persistStringArray(STORAGE_KEY, next)-}--/** Pin a provider/model pair (appended to the order) or unpin it. */-export function togglePinnedModel(provider: string, model: string): void {- const key = pinnedModelKey(provider, model)- const current = $pinnedModels.get()-- setPinnedModels(current.includes(key) ? current.filter(entry => entry !== key) : [...current, key])-}diff --git a/locales/_keys.desktop.json b/locales/_keys.desktop.jsonindex 465cc8c057e..633ed2312f2 100644--- a/locales/_keys.desktop.json+++ b/locales/_keys.desktop.json@@ -3963,14 +3963,18 @@"shell.gatewayMenu.recentActivity","shell.gatewayMenu.reconnectGateway","shell.gatewayMenu.viewAllLogs",+ "shell.modelMenu.addFavorite","shell.modelMenu.cacheRead","shell.modelMenu.editModels","shell.modelMenu.fast",+ "shell.modelMenu.favoriteShortcut",+ "shell.modelMenu.favorites","shell.modelMenu.followDefault","shell.modelMenu.free","shell.modelMenu.noModels","shell.modelMenu.priceTitle","shell.modelMenu.refreshModels",+ "shell.modelMenu.removeFavorite","shell.modelMenu.search","shell.modelOptions.effort","shell.modelOptions.fast",