@@ -4,34 +4,9 @@ import { join } from "path";
44import { readdir , stat } from "fs/promises" ;
55import { parse } from "@iarna/toml" ;
66import { file } from "bun" ;
7+ import { ModelSchema , ProviderSchema } from "../app/schemas" ;
78import { z } from "zod" ;
89
9- // Define schema for provider.toml
10- const ProviderSchema = z
11- . object ( {
12- name : z . string ( ) . min ( 1 , "Provider name cannot be empty" ) ,
13- } )
14- . strict ( ) ;
15-
16- // Define schema for model files
17- const ModelSchema = z
18- . object ( {
19- name : z . string ( ) . min ( 1 , "Model name cannot be empty" ) ,
20- attachment : z . boolean ( ) . default ( false ) . optional ( ) ,
21- reasoning : z . boolean ( ) . default ( false ) . optional ( ) ,
22- cost : z . object ( {
23- input : z . number ( ) . min ( 0 , "Input price cannot be negative" ) ,
24- output : z . number ( ) . min ( 0 , "Output price cannot be negative" ) ,
25- inputCached : z . number ( ) . min ( 0 , "Input cached price cannot be negative" ) ,
26- outputCached : z . number ( ) . min ( 0 , "Output cached price cannot be negative" ) ,
27- } ) ,
28- limit : z . object ( {
29- context : z . number ( ) . min ( 0 , "Context window must be positive" ) ,
30- output : z . number ( ) . min ( 0 , "Output tokens must be positive" ) ,
31- } ) ,
32- } )
33- . strict ( ) ;
34-
3510async function validate ( ) {
3611 const providersDir = join ( import . meta. dir , ".." , "providers" ) ;
3712
0 commit comments