mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-05 08:33:10 +00:00
27 lines
690 B
TypeScript
27 lines
690 B
TypeScript
import { z } from "zod"
|
|
import { Global } from "."
|
|
import { lazy } from "../util/lazy"
|
|
import path from "path"
|
|
|
|
export namespace GlobalConfig {
|
|
export const Info = z.object({
|
|
provider: z.string().optional(),
|
|
model: z.string().optional(),
|
|
autoupdate: z.boolean().optional(),
|
|
autoshare: z.boolean().optional(),
|
|
disabled_providers: z.array(z.string()).optional(),
|
|
})
|
|
export type Info = z.infer<typeof Info>
|
|
|
|
export const get = lazy(async () => {
|
|
const toml = await import(path.join(Global.Path.config, "config"), {
|
|
with: {
|
|
type: "toml",
|
|
},
|
|
})
|
|
.then((mod) => mod.default)
|
|
.catch(() => ({}))
|
|
return Info.parse(toml)
|
|
})
|
|
}
|