temp
All checks were successful
CI / CI (push) Successful in 1m21s

This commit is contained in:
SileNce5k 2025-04-30 19:48:33 +02:00
parent a066fd0662
commit 9715a20be6
Signed by: SileNce
GPG key ID: B0A142BB4291B204
4 changed files with 278 additions and 1 deletions

26
util/lastfm/roast.js Normal file
View file

@ -0,0 +1,26 @@
require("dotenv").config();
module.exports = async function(topArtists, topAlbums) {
let prompt = "Roast the top artists and top albums the user has listened to most for the last year. Go as hard as possible."
let answer = "";
await fetch(`https://openrouter.ai/api/v1/chat/completions`, {
method: `POST`,
headers: {
"Authorization": `Bearer ${process.env.OPENROUTER_API_KEY}`,
"Content-Type": `application/json`
},
body: JSON.stringify({
"model": `deepseek/deepseek-chat-v3-0324:free`,
"messages": [
{
"role": `system`,
"content": prompt
}
],
"max_tokens": 250
})
}).then(response => response.json()).then(data => {
answer = data.choices[0].message.content;
}).catch(error => {
console.error(error);
});
}