parent
a066fd0662
commit
e098c90485
4 changed files with 276 additions and 1 deletions
26
util/lastfm/roast.js
Normal file
26
util/lastfm/roast.js
Normal 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);
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue