GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(app): use current default model (#38603) · HQ123-BOOP/LibreCode@8d3ec1b

This repository was archived by the owner on Aug 18, 2026. It is now read-only.

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages
    • app/src
      • context
        • global-sync
          • utils.test.ts
          • utils.ts
        • local.tsx
      • hooks
        • provider-catalog.test.ts
        • provider-catalog.ts
        • use-providers.ts
      • pages/session/composer
        • prompt-model-selection.ts
    • session-ui/src/context
      • data.tsx
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/app/src/context/global-sync/utils.test.ts‎

Copy file name to clipboardExpand all lines: packages/app/src/context/global-sync/utils.test.ts
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ describe("normalizeProviderList", () => {
103103
)
104104

105105
expect(result.connected).toEqual(["openai"])
106+
expect(result.defaultModel).toEqual({ providerID: "openai", modelID: "gpt-5" })
106107
expect(result.default).toEqual({ openai: "gpt-5" })
107108
expect(result.all.get("openai")?.models["gpt-old"]).toBeUndefined()
108109
expect(result.all.get("openai")?.models["gpt-5"]).toMatchObject({
@@ -113,6 +114,10 @@ describe("normalizeProviderList", () => {
113114
variants: { high: {} },
114115
})
115116
})
117+
118+
test("preserves an empty current default", () => {
119+
expect(normalizeProviderList([] as ProviderListOutput["data"], [], null).defaultModel).toBeNull()
120+
})
116121
})
117122

118123
describe("directoryKey", () => {
Collapse file

‎packages/app/src/context/global-sync/utils.ts‎

Copy file name to clipboardExpand all lines: packages/app/src/context/global-sync/utils.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ export function normalizeProviderList(
139139
return {
140140
all,
141141
connected: providers.map((provider) => provider.id),
142+
defaultModel: defaultModel ? { providerID: defaultModel.providerID, modelID: defaultModel.id } : null,
142143
default: Object.fromEntries(
143144
providers.flatMap((provider) => {
144145
const model =
Collapse file

‎packages/app/src/context/local.tsx‎

Copy file name to clipboardExpand all lines: packages/app/src/context/local.tsx
+3-4Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { createStore } from "solid-js/store"
66
import { useModels } from "@/context/models"
77
import { useSettings } from "@/context/settings"
88
import { useProviders } from "@/hooks/use-providers"
9+
import { resolveDefaultModel } from "@/hooks/provider-catalog"
910
import { Persist, persisted } from "@/utils/persist"
1011
import { hasCustomAgent, resolveAgent } from "./local-agent"
1112
import { cycleModelVariant, getConfiguredAgentVariant, resolveModelVariant } from "./model-variant"
@@ -149,10 +150,8 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
149150
})
150151

151152
const configuredModel = () => {
152-
const configured = sync().data.config.model
153-
if (!configured) return
154-
const [providerID, modelID] = configured.split("/")
155-
const model = { providerID, modelID }
153+
const model = resolveDefaultModel(providers.defaultModel(), sync().data.config.model)
154+
if (!model) return
156155
if (validModel(model)) return model
157156
}
158157

Collapse file

‎packages/app/src/hooks/provider-catalog.test.ts‎

Copy file name to clipboardExpand all lines: packages/app/src/hooks/provider-catalog.test.ts
+19-1Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { expect, test } from "bun:test"
22
import type { NormalizedProviderListResponse } from "@opencode-ai/session-ui/context"
3-
import { selectProviderCatalog } from "./provider-catalog"
3+
import { resolveDefaultModel, selectProviderCatalog } from "./provider-catalog"
44

55
const catalog = (id: string): NormalizedProviderListResponse => ({
66
all: new Map([[id, { id, name: id, source: "api", env: [], options: {}, models: {} }]]),
@@ -57,3 +57,21 @@ test("falls back to the global catalog for route consumers", () => {
5757
}),
5858
).toBe(global)
5959
})
60+
61+
test("uses the current server default model", () => {
62+
expect(resolveDefaultModel({ providerID: "openai", modelID: "gpt-5" }, "anthropic/claude")).toEqual({
63+
providerID: "openai",
64+
modelID: "gpt-5",
65+
})
66+
})
67+
68+
test("does not use legacy config when the current server has no default", () => {
69+
expect(resolveDefaultModel(null, "anthropic/claude")).toBeUndefined()
70+
})
71+
72+
test("uses config for legacy servers", () => {
73+
expect(resolveDefaultModel(undefined, "anthropic/claude")).toEqual({
74+
providerID: "anthropic",
75+
modelID: "claude",
76+
})
77+
})
Collapse file

‎packages/app/src/hooks/provider-catalog.ts‎

Copy file name to clipboardExpand all lines: packages/app/src/hooks/provider-catalog.ts
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,13 @@ export function selectProviderCatalog(input: ProviderCatalogInput) {
2525
if (input.explicit) return emptyProviderCatalog
2626
return input.global
2727
}
28+
29+
export function resolveDefaultModel(
30+
current: NormalizedProviderListResponse["defaultModel"],
31+
legacy: string | undefined,
32+
) {
33+
if (current !== undefined) return current ?? undefined
34+
if (!legacy) return undefined
35+
const [providerID, modelID] = legacy.split("/")
36+
return { providerID, modelID }
37+
}
Collapse file

‎packages/app/src/hooks/use-providers.ts‎

Copy file name to clipboardExpand all lines: packages/app/src/hooks/use-providers.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export function useProviders(directory: Accessor<string | undefined>) {
4040
return {
4141
all: () => providers().all,
4242
default: () => providers().default,
43+
defaultModel: () => providers().defaultModel,
4344
popular: () =>
4445
pipe(
4546
providers().all,
Collapse file

‎packages/app/src/pages/session/composer/prompt-model-selection.ts‎

Copy file name to clipboardExpand all lines: packages/app/src/pages/session/composer/prompt-model-selection.ts
+3-4Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { usePrompt } from "@/context/prompt"
66
import { useSDK } from "@/context/sdk"
77
import { useSync } from "@/context/sync"
88
import { useProviders } from "@/hooks/use-providers"
9+
import { resolveDefaultModel } from "@/hooks/provider-catalog"
910

1011
export function createPromptModelSelection(input: { agent: () => { model?: ModelKey; variant?: string } | undefined }) {
1112
const sdk = useSDK()
@@ -21,10 +22,8 @@ export function createPromptModelSelection(input: { agent: () => { model?: Model
2122
}
2223

2324
const configured = () => {
24-
const value = sync().data.config.model
25-
if (!value) return
26-
const [providerID, modelID] = value.split("/")
27-
const model = { providerID, modelID }
25+
const model = resolveDefaultModel(providers.defaultModel(), sync().data.config.model)
26+
if (!model) return
2827
if (valid(model)) return model
2928
}
3029

Collapse file

‎packages/session-ui/src/context/data.tsx‎

Copy file name to clipboardExpand all lines: packages/session-ui/src/context/data.tsx
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ import { PreloadMultiFileDiffResult } from "@pierre/diffs/ssr"
55

66
export type NormalizedProviderListResponse = {
77
all: Map<string, Provider>
8+
defaultModel?: {
9+
providerID: string
10+
modelID: string
11+
} | null
812
default: {
913
[key: string]: string
1014
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.