Updates to the archiving system to **NOT** crash the container every

single time it tries to archive stuff & remove goals before next devlog
markdown file.
This commit is contained in:
yuanhau 2025-06-16 22:10:57 +08:00
parent 5445a3d1c0
commit fce450bc7e
5 changed files with 17 additions and 24 deletions

View file

@ -38,7 +38,7 @@ export default defineEventHandler(async (event) => {
},
{
role: "system",
content: `You are a news summarizer. You will be given a news article and you will summarize it into a short paragraph. The user's current locale is ${locale || "zh-tw"} please use the correct language as the response.`,
content: `You are a news summarizer. You will be given a news article and you will summarize it into a short paragraph. The user's current locale is ${locale.toString()} please use the correct language as the response.`,
},
],
model: "gemma2-9b-it",

View file

@ -43,12 +43,12 @@ async function storeArticlesIfItDoesNotExists(data, RequestId) {
SELECT * FROM news_articles
WHERE jsondata = ${data}
`;
if (checkDataIsInDatabase.length === 0) {
if (checkDataIsInDatabase.length > 0) {
return;
}
const storeData = await sql`
INSERT INTO news_articles (uuid, article_id, jsondata)
VALUES (${uuidv4()}, ${RequestId}, ${data})
VALUES (${uuidv4()}, ${RequestId}, ${data}::JSON)
`;
console.log(storeData);
return;