feat: enhance creation of recommendation keywords
This commit is contained in:
@ -71,12 +71,13 @@ export async function createKeywords(type: string, description: string) {
|
||||
{
|
||||
"role": "system",
|
||||
"content":
|
||||
`you create some general vibey keywords to use in a recommendation system based on a ${type} description`,
|
||||
`you create some keywords to use in a recommendation system based on a ${type} description, create a range of keywords from very specific ones that describe the general vibe also include some that describe the genre`,
|
||||
},
|
||||
{ "role": "user", "content": description.slice(0, 2000) },
|
||||
{
|
||||
"role": "user",
|
||||
"content": "return a list of keywords seperated by commas",
|
||||
"content":
|
||||
"only return a list of around 20 keywords seperated by commas",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
@ -51,3 +51,10 @@ export async function createRecommendationResource(
|
||||
|
||||
cache.set(cacheId, JSON.stringify(resource));
|
||||
}
|
||||
|
||||
export async function getAllRecommendations() {
|
||||
const keys = await cache.keys("recommendations:movie:*");
|
||||
return Promise.all(keys.map((k) => cache.get(k))).then((res) =>
|
||||
res.map((r) => JSON.parse(r))
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user