This commit is contained in:
Dax Raad
2025-06-10 13:30:08 -04:00
parent 96b5a079ff
commit ef7f1f0761
10 changed files with 193 additions and 31 deletions

View File

@@ -4,13 +4,9 @@ import path from "path"
export namespace ModelsDev {
const log = Log.create({ service: "models.dev" })
function filepath() {
return path.join(Global.Path.data, "models.json")
}
const file = Bun.file(path.join(Global.Path.cache, "models.json"))
export async function get() {
const file = Bun.file(filepath())
if (await file.exists()) {
refresh()
return file.json()
@@ -24,6 +20,6 @@ export namespace ModelsDev {
const result = await fetch("https://models.dev/api.json")
if (!result.ok)
throw new Error(`Failed to fetch models.dev: ${result.statusText}`)
await Bun.write(filepath(), result)
await Bun.write(file, result)
}
}

View File

@@ -18,7 +18,6 @@ import { LspHoverTool } from "../tool/lsp-hover"
import { PatchTool } from "../tool/patch"
import { ReadTool } from "../tool/read"
import type { Tool } from "../tool/tool"
import { WriteTool } from "../tool/write"
import { TodoReadTool, TodoWriteTool } from "../tool/todo"
import { AuthAnthropic } from "../auth/anthropic"