From 33a831d2be1fd7bea60421287f118be0bd968650 Mon Sep 17 00:00:00 2001 From: Dax Raad Date: Thu, 29 May 2025 10:21:59 -0400 Subject: rework types --- js/src/llm/llm.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'js/src/llm') diff --git a/js/src/llm/llm.ts b/js/src/llm/llm.ts index 9c409c604..e6230584a 100644 --- a/js/src/llm/llm.ts +++ b/js/src/llm/llm.ts @@ -5,7 +5,7 @@ import path from "path"; import type { LanguageModel, Provider } from "ai"; import { NoSuchModelError } from "ai"; -import type { Config } from "../app/config"; +import { Config } from "../app/config"; import { BunProc } from "../bun"; import { Global } from "../global"; @@ -25,8 +25,8 @@ export namespace LLM { name: "Claude 4 Sonnet", cost: { input: 3.0 / 1_000_000, - inputCached: 3.75 / 1_000_000, output: 15.0 / 1_000_000, + inputCached: 3.75 / 1_000_000, outputCached: 0.3 / 1_000_000, }, contextWindow: 200000, @@ -77,6 +77,7 @@ export namespace LLM { }; const state = App.state("llm", async (app) => { + const config = await Config.get(); const providers: Record< string, { @@ -89,11 +90,11 @@ export namespace LLM { { info: Config.Model; instance: LanguageModel } >(); - const list = mergeDeep(NATIVE_PROVIDERS, app.config.providers ?? {}); + const list = mergeDeep(NATIVE_PROVIDERS, config.providers ?? {}); for (const [providerID, providerInfo] of Object.entries(list)) { if ( - !app.config.providers?.[providerID] && + !config.providers?.[providerID] && !AUTODETECT[providerID]?.some((env) => process.env[env]) ) continue; -- cgit v1.2.3