diff options
| author | Dax Raad <[email protected]> | 2025-05-28 12:53:22 -0400 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2025-05-28 12:53:22 -0400 |
| commit | 55a6fcdd3f5b3c55712e5cfc9dd4d994da38d4c8 (patch) | |
| tree | aef660f4e7b0fae135dc1f90cf6920b53238ed5b /js/src/index.ts | |
| parent | 4132fcc1b286af5e61bf5eaa89f789988362f995 (diff) | |
| download | opencode-55a6fcdd3f5b3c55712e5cfc9dd4d994da38d4c8.tar.gz opencode-55a6fcdd3f5b3c55712e5cfc9dd4d994da38d4c8.zip | |
add provider_list
Diffstat (limited to 'js/src/index.ts')
| -rw-r--r-- | js/src/index.ts | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/js/src/index.ts b/js/src/index.ts index dc80206f7..3758ad718 100644 --- a/js/src/index.ts +++ b/js/src/index.ts @@ -7,6 +7,7 @@ import { Session } from "./session/session"; import cac from "cac"; import { Share } from "./share/share"; import { Storage } from "./storage/storage"; +import { LLM } from "./llm/llm"; const cli = cac("opencode"); @@ -90,9 +91,19 @@ cli } }); - const result = await Session.chat(session.id, { - type: "text", - text: message.join(" "), + const providers = await LLM.providers(); + const providerID = Object.keys(providers)[0]; + const modelID = Object.keys(providers[providerID].info.models!)[0]; + const result = await Session.chat({ + sessionID: session.id, + providerID, + modelID, + parts: [ + { + type: "text", + text: message.join(" "), + }, + ], }); for (const part of result.parts) { |
