fix(config): allow active provider model status
This commit is contained in:
parent
818b56dbd0
commit
3aeb870e71
6 changed files with 43 additions and 6 deletions
|
|
@ -49,7 +49,7 @@ export const Model = Schema.Struct({
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
experimental: Schema.optional(Schema.Boolean),
|
experimental: Schema.optional(Schema.Boolean),
|
||||||
status: Schema.optional(Schema.Literals(["alpha", "beta", "deprecated"])),
|
status: Schema.optional(Schema.Literals(["alpha", "beta", "deprecated", "active"])),
|
||||||
provider: Schema.optional(
|
provider: Schema.optional(
|
||||||
Schema.Struct({ npm: Schema.optional(Schema.String), api: Schema.optional(Schema.String) }),
|
Schema.Struct({ npm: Schema.optional(Schema.String), api: Schema.optional(Schema.String) }),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ export const Model = Schema.Struct({
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
status: Schema.optional(Schema.Literals(["alpha", "beta", "deprecated"])),
|
status: Schema.optional(Schema.Literals(["alpha", "beta", "deprecated", "active"])),
|
||||||
provider: Schema.optional(
|
provider: Schema.optional(
|
||||||
Schema.Struct({ npm: Schema.optional(Schema.String), api: Schema.optional(Schema.String) }),
|
Schema.Struct({ npm: Schema.optional(Schema.String), api: Schema.optional(Schema.String) }),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -47,4 +47,41 @@ describe("config HttpApi", () => {
|
||||||
lsp: false,
|
lsp: false,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test("serves config with active provider model status", async () => {
|
||||||
|
await using tmp = await tmpdir({
|
||||||
|
config: {
|
||||||
|
formatter: false,
|
||||||
|
lsp: false,
|
||||||
|
provider: {
|
||||||
|
omniroute: {
|
||||||
|
models: {
|
||||||
|
"gpt-4o": {
|
||||||
|
status: "active",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const response = await app().request("/config", {
|
||||||
|
headers: {
|
||||||
|
"x-opencode-directory": tmp.path,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(response.status).toBe(200)
|
||||||
|
expect(await response.json()).toMatchObject({
|
||||||
|
provider: {
|
||||||
|
omniroute: {
|
||||||
|
models: {
|
||||||
|
"gpt-4o": {
|
||||||
|
status: "active",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1065,7 +1065,7 @@ export type ProviderConfig = {
|
||||||
output: Array<"text" | "audio" | "image" | "video" | "pdf">
|
output: Array<"text" | "audio" | "image" | "video" | "pdf">
|
||||||
}
|
}
|
||||||
experimental?: boolean
|
experimental?: boolean
|
||||||
status?: "alpha" | "beta" | "deprecated"
|
status?: "alpha" | "beta" | "deprecated" | "active"
|
||||||
options?: {
|
options?: {
|
||||||
[key: string]: unknown
|
[key: string]: unknown
|
||||||
}
|
}
|
||||||
|
|
@ -3012,7 +3012,7 @@ export type ProviderListResponses = {
|
||||||
output: Array<"text" | "audio" | "image" | "video" | "pdf">
|
output: Array<"text" | "audio" | "image" | "video" | "pdf">
|
||||||
}
|
}
|
||||||
experimental?: boolean
|
experimental?: boolean
|
||||||
status?: "alpha" | "beta" | "deprecated"
|
status?: "alpha" | "beta" | "deprecated" | "active"
|
||||||
options: {
|
options: {
|
||||||
[key: string]: unknown
|
[key: string]: unknown
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1060,7 +1060,7 @@ export type ProviderConfig = {
|
||||||
output: Array<"text" | "audio" | "image" | "video" | "pdf">
|
output: Array<"text" | "audio" | "image" | "video" | "pdf">
|
||||||
}
|
}
|
||||||
experimental?: boolean
|
experimental?: boolean
|
||||||
status?: "alpha" | "beta" | "deprecated"
|
status?: "alpha" | "beta" | "deprecated" | "active"
|
||||||
provider?: {
|
provider?: {
|
||||||
npm?: string
|
npm?: string
|
||||||
api?: string
|
api?: string
|
||||||
|
|
|
||||||
|
|
@ -11725,7 +11725,7 @@
|
||||||
},
|
},
|
||||||
"status": {
|
"status": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["alpha", "beta", "deprecated"]
|
"enum": ["alpha", "beta", "deprecated", "active"]
|
||||||
},
|
},
|
||||||
"provider": {
|
"provider": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue