fix reading model from config

This commit is contained in:
Dax Raad
2025-07-25 10:53:06 -04:00
parent 0795a577e0
commit 250a86ec52

View File

@@ -22,13 +22,16 @@ export namespace Mode {
export type Info = z.infer<typeof Info> export type Info = z.infer<typeof Info>
const state = App.state("mode", async () => { const state = App.state("mode", async () => {
const cfg = await Config.get() const cfg = await Config.get()
const model = cfg.model ? Provider.parseModel(cfg.model) : undefined
const result: Record<string, Info> = { const result: Record<string, Info> = {
build: { build: {
model,
name: "build", name: "build",
tools: {}, tools: {},
}, },
plan: { plan: {
name: "plan", name: "plan",
model,
tools: { tools: {
write: false, write: false,
edit: false, edit: false,
@@ -45,10 +48,7 @@ export namespace Mode {
tools: {}, tools: {},
} }
item.name = key item.name = key
const model = value.model ?? cfg.model if (value.model) item.model = Provider.parseModel(value.model)
if (model) {
item.model = Provider.parseModel(model)
}
if (value.prompt) item.prompt = value.prompt if (value.prompt) item.prompt = value.prompt
if (value.tools) if (value.tools)
item.tools = { item.tools = {