Skip to content

Commit 38a406e

Browse files
committed
chore: format code
1 parent 6d7e677 commit 38a406e

File tree

2 files changed

+10
-19
lines changed

2 files changed

+10
-19
lines changed

packages/opencode/src/provider/models.ts

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@ export namespace ModelsDev {
99
const log = Log.create({ service: "models.dev" })
1010
const filepath = path.join(Global.Path.cache, "models.json")
1111

12-
const isoDate = z
13-
.string()
14-
.regex(/^\d{4}-\d{2}(-\d{2})?$/, {
15-
message: "Must be in YYYY-MM or YYYY-MM-DD format",
16-
})
12+
const isoDate = z.string().regex(/^\d{4}-\d{2}(-\d{2})?$/, {
13+
message: "Must be in YYYY-MM or YYYY-MM-DD format",
14+
})
1715

1816
export const Model = z
1917
.object({
@@ -52,23 +50,18 @@ export namespace ModelsDev {
5250
options: z.record(z.string(), z.any()).optional(),
5351
provider: z.object({ npm: z.string().optional(), api: z.string().optional() }).optional(),
5452
})
55-
.refine(
56-
(data) => !(data.reasoning === false && data.cost?.reasoning !== undefined),
57-
{
58-
message: "Cannot set cost.reasoning when reasoning is false",
59-
path: ["cost", "reasoning"],
60-
},
61-
)
53+
.refine((data) => !(data.reasoning === false && data.cost?.reasoning !== undefined), {
54+
message: "Cannot set cost.reasoning when reasoning is false",
55+
path: ["cost", "reasoning"],
56+
})
6257
.meta({
6358
ref: "Model",
6459
})
6560
export type Model = z.infer<typeof Model>
6661

6762
export const Provider = z
6863
.object({
69-
api: z
70-
.string()
71-
.optional(),
64+
api: z.string().optional(),
7265
name: z.string().min(1, "Provider name cannot be empty"),
7366
env: z.array(z.string()).min(1, "Provider env cannot be empty"),
7467
id: z.string(),

packages/opencode/src/provider/provider.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,7 @@ export namespace Provider {
206206

207207
for (const [modelID, model] of Object.entries(provider.models ?? {})) {
208208
const existingModel = parsed.models[modelID]
209-
const baseModalities =
210-
model.modalities ??
209+
const baseModalities = model.modalities ??
211210
existingModel?.modalities ?? {
212211
input: ["text"],
213212
output: ["text"],
@@ -239,8 +238,7 @@ export namespace Provider {
239238
...existingModel?.cost,
240239
...model.cost,
241240
},
242-
limit:
243-
model.limit ??
241+
limit: model.limit ??
244242
existingModel?.limit ?? {
245243
context: 0,
246244
output: 0,

0 commit comments

Comments
 (0)