Skip to content

Commit

Permalink
refactor: update logging and variable naming 🛠️
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed Dec 11, 2024
1 parent 5d6f2e6 commit 96756dd
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/cli/src/nodehost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,13 @@ class ModelManager implements ModelService {
if (this.pulled.includes(modelid)) return { ok: true }

if (provider === MODEL_PROVIDER_OLLAMA) {
logVerbose(`ollama: pull ${model}`)
logVerbose(`${provider}: pull ${model}`)
try {
const conn = await this.getModelToken(modelid)
const res = await fetch(`${conn.base}/api/pull`, {

let res: Response
// OLLAMA
res = await fetch(`${conn.base}/api/pull`, {
method: "POST",
headers: {
"User-Agent": TOOL_ID,
Expand All @@ -115,13 +118,14 @@ class ModelManager implements ModelService {
),
})
if (res.ok) {
const resp = await res.json()
const resj = await res.json()
//logVerbose(JSON.stringify(resj, null, 2))
}
if (res.ok) this.pulled.push(modelid)
return { ok: res.ok, status: res.status }
} catch (e) {
logError(`ollama: failed to pull model ${model}`)
trace?.error("ollama: pull model failed", e)
logError(`${provider}: failed to pull model ${model}`)
trace?.error(`${provider}: pull model failed`, e)
return { ok: false, status: 500, error: serializeError(e) }
}
}
Expand Down

0 comments on commit 96756dd

Please sign in to comment.