tui: allow specifying custom models file path via OPENCODE_MODELS_PATH
Users can now configure their own models configuration file by setting the OPENCODE_MODELS_PATH environment variable, providing more flexibility for testing and configuration.
This commit is contained in:
parent
8e5db3083c
commit
6ecd011e51
4 changed files with 4 additions and 6 deletions
|
|
@ -85,9 +85,9 @@ export namespace ModelsDev {
|
|||
}
|
||||
|
||||
export const Data = lazy(async () => {
|
||||
const file = Bun.file(filepath)
|
||||
const file = Bun.file(Flag.OPENCODE_MODELS_PATH ?? filepath)
|
||||
const result = await file.json().catch(() => {})
|
||||
if (result && typeof result === "object" && Object.keys(result).length > 0) return result
|
||||
if (result) return result
|
||||
// @ts-ignore
|
||||
const snapshot = await import("./models-snapshot")
|
||||
.then((m) => m.snapshot as Record<string, unknown>)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue