mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-19 17:01:37 +03:00
fix(core): keep custom providers whose model sets only part of limit (#62240)
This commit is contained in:
@@ -250,9 +250,9 @@ function migrateModel(info: typeof ConfigProviderV1.Model.Type, npm: string | un
|
||||
cost: costs,
|
||||
disabled: info.status === "deprecated" ? true : undefined,
|
||||
limit: info.limit && {
|
||||
context: int(info.limit.context),
|
||||
context: info.limit.context === undefined ? undefined : int(info.limit.context),
|
||||
input: info.limit.input === undefined ? undefined : int(info.limit.input),
|
||||
output: int(info.limit.output),
|
||||
output: info.limit.output === undefined ? undefined : int(info.limit.output),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,9 +41,9 @@ export const Model = Schema.Struct({
|
||||
),
|
||||
limit: Schema.optional(
|
||||
Schema.Struct({
|
||||
context: Schema.Finite,
|
||||
context: Schema.optional(Schema.Finite),
|
||||
input: Schema.optional(Schema.Finite),
|
||||
output: Schema.Finite,
|
||||
output: Schema.optional(Schema.Finite),
|
||||
}),
|
||||
),
|
||||
modalities: Schema.optional(
|
||||
|
||||
@@ -694,6 +694,11 @@ describe("ConfigProviderPlugin.Plugin", () => {
|
||||
legacy: { models: { chat: { cost: { input: 0, output: 0 } } } },
|
||||
native: { models: { chat: { cost: { input: 0, output: 0 } } } },
|
||||
},
|
||||
{
|
||||
name: "context-only limits",
|
||||
legacy: { models: { chat: { limit: { context: 1000000 } } } },
|
||||
native: { models: { chat: { limit: { context: 1000000 } } } },
|
||||
},
|
||||
]) {
|
||||
it.effect(`matches native configuration for migrated ${scenario.name}`, () =>
|
||||
Effect.gen(function* () {
|
||||
|
||||
Reference in New Issue
Block a user