feat: fallback to unsplash cover when article contains no image
This commit is contained in:
@@ -195,6 +195,23 @@ respond with a plain unordered list each item starting with the year the movie w
|
||||
return recommendations;
|
||||
};
|
||||
|
||||
export async function createUnsplashSearchTerm(content: string) {
|
||||
if (!openAI) return;
|
||||
const chatCompletion = await openAI.chat.completions.create({
|
||||
model: model,
|
||||
messages: [
|
||||
{
|
||||
role: "system",
|
||||
content:
|
||||
"Please respond with a search term for unsplash for the following article",
|
||||
},
|
||||
{ role: "user", content: content.slice(0, 10_000) },
|
||||
],
|
||||
});
|
||||
|
||||
return chatCompletion.choices[0].message.content?.toLowerCase();
|
||||
}
|
||||
|
||||
export async function createTags(content: string) {
|
||||
if (!openAI) return;
|
||||
const chatCompletion = await openAI.chat.completions.create({
|
||||
|
||||
Reference in New Issue
Block a user