Skip to content

armgit / my-yt

Public Imported from GitHub
0

A clean and minimal youtube frontend, without all the ads and whistles

JavaScript

fix: llm call

Christian Feiad8c106165d0
diff --git a/lib/llm.js b/lib/llm.js
index d056948..4ed3b80 100644
--- a/lib/llm.js
+++ b/lib/llm.js
@@ -25,20 +25,20 @@ export async function fetchCompletionLMSTUDIO (
messages: [
{role: "system", content: system},
{role: "user", content: prompt}
- ],
- temperature: 0.9,
- max_tokens: -1,
- stream: false
+ ]
})
})
- if (!response.ok) { throw new Error(`HTTP error! Status: ${response.status}`) }
-
const data = await response.json()
+ if (!response.ok) {
+ console.error(data)
+ throw new Error(`HTTP error! Status: ${response.status}`)
+ }
+
let message = data.choices[data.choices.length - 1]?.message?.content || ''
message = message.replace('<|eot_id|>', '')
return message
} catch (error) {
- console.error('Error summarizing text:', error.message)
+ console.error('Error summarizing text:', error)
throw error
}
}
\ No newline at end of file