GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — tui: allow specifying custom models file path via OPENCODE_MODELS_PATH · koji/opencode@6ecd011

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .github/workflows
    • test.yml
  • packages/opencode
    • src
      • flag
        • flag.ts
      • provider
        • models.ts
    • test
      • preload.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.github/workflows/test.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/test.yml
-4Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ jobs:
6161
printf '%s\n' "XDG_STATE_HOME=${{ runner.temp }}/opencode-e2e/state" >> "$GITHUB_ENV"
6262
fi
6363
64-
- name: Copy models fixture
65-
run: |
66-
cp "${{ github.workspace }}/packages/opencode/test/tool/fixtures/models-api.json" "${{ github.workspace }}/packages/opencode/src/provider/models-snapshot.ts"
67-
6864
- name: Seed opencode data
6965
if: matrix.settings.name != 'windows'
7066
working-directory: packages/opencode
Collapse file

‎packages/opencode/src/flag/flag.ts‎

Copy file name to clipboardExpand all lines: packages/opencode/src/flag/flag.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export namespace Flag {
4747
export const OPENCODE_EXPERIMENTAL_PLAN_MODE = OPENCODE_EXPERIMENTAL || truthy("OPENCODE_EXPERIMENTAL_PLAN_MODE")
4848
export const OPENCODE_EXPERIMENTAL_MARKDOWN = truthy("OPENCODE_EXPERIMENTAL_MARKDOWN")
4949
export const OPENCODE_MODELS_URL = process.env["OPENCODE_MODELS_URL"]
50+
export const OPENCODE_MODELS_PATH = process.env["OPENCODE_MODELS_PATH"]
5051

5152
function number(key: string) {
5253
const value = process.env[key]
Collapse file

‎packages/opencode/src/provider/models.ts‎

Copy file name to clipboardExpand all lines: packages/opencode/src/provider/models.ts
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ export namespace ModelsDev {
8585
}
8686

8787
export const Data = lazy(async () => {
88-
const file = Bun.file(filepath)
88+
const file = Bun.file(Flag.OPENCODE_MODELS_PATH ?? filepath)
8989
const result = await file.json().catch(() => {})
90-
if (result && typeof result === "object" && Object.keys(result).length > 0) return result
90+
if (result) return result
9191
// @ts-ignore
9292
const snapshot = await import("./models-snapshot")
9393
.then((m) => m.snapshot as Record<string, unknown>)
Collapse file

‎packages/opencode/test/preload.ts‎

Copy file name to clipboardExpand all lines: packages/opencode/test/preload.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ process.env["XDG_DATA_HOME"] = path.join(dir, "share")
2525
process.env["XDG_CACHE_HOME"] = path.join(dir, "cache")
2626
process.env["XDG_CONFIG_HOME"] = path.join(dir, "config")
2727
process.env["XDG_STATE_HOME"] = path.join(dir, "state")
28+
process.env["OPENCODE_MODELS_PATH"] = path.join(import.meta.dir, "tool", "fixtures", "models-api.json")
2829

2930
// Write the cache version file to prevent global/index.ts from clearing the cache
3031
const cacheDir = path.join(dir, "cache", "opencode")

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.