From f9bd2f1ee0e6630e6b91d24798d084ff950831fd Mon Sep 17 00:00:00 2001 From: Luna Date: Sun, 1 Mar 2026 16:25:02 +0100 Subject: [PATCH] changes --- src/memory.js | 1 - src/mood.js | 10 ++-------- src/openai.js | 1 - 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/memory.js b/src/memory.js index ec9f4b3..d339cf6 100644 --- a/src/memory.js +++ b/src/memory.js @@ -397,7 +397,6 @@ export async function findSimilar(userId, query) { return retrieveRelevantMemories(db, userId, query); } -// Daily thought storage export async function getDailyThoughtFromDb(date) { const db = await loadDatabase(); const row = get(db, 'SELECT thought FROM daily_thoughts WHERE date = ?', [date]); diff --git a/src/mood.js b/src/mood.js index 65dde46..c694a75 100644 --- a/src/mood.js +++ b/src/mood.js @@ -12,9 +12,6 @@ const dailyMoods = [ let overrideMood = null; let currentDailyMood = null; -/** - * Get today's date as YYYY-MM-DD for comparison - */ function getTodayDate() { const d = new Date(); return d.toISOString().split('T')[0]; @@ -50,7 +47,6 @@ async function setDailyThought(thought) { async function generateDailyThought() { const today = getTodayDate(); - // Check if we already have a thought for today in the DB const existingThought = await getDailyThoughtFromDb(today); if (existingThought) { console.log('[mood] using existing thought for today:', existingThought); @@ -67,8 +63,7 @@ async function generateDailyThought() { ]; const resp = await chatCompletion(messages, { temperature: 0.8, maxTokens: 40 }); newThought = (resp && resp.trim()) || ''; - - // Truncate to 120 characters if it exceeds + if (newThought.length > 120) { newThought = newThought.substring(0, 117) + '...'; } @@ -85,8 +80,7 @@ async function generateDailyThought() { ]; newThought = fallbacks[Math.floor(Math.random() * fallbacks.length)]; } - - // Save to database + await saveDailyThought(today, newThought); console.log('[mood] generated and saved new thought for today:', newThought); return newThought; diff --git a/src/openai.js b/src/openai.js index 64ac4e0..85f38bc 100644 --- a/src/openai.js +++ b/src/openai.js @@ -44,7 +44,6 @@ async function postJson(path, body) { const e = new Error(`Request timed out after ${timeout}ms`); e.code = 'UND_ERR_CONNECT_TIMEOUT'; controller.abort(); - // store on global so the catch sees it throw e; }, timeout);