reworked memory from json to sqlite

This commit is contained in:
Luna
2026-02-22 19:19:59 +01:00
parent 82bf5f9ca8
commit feb4de6f61
5 changed files with 345 additions and 118 deletions

View File

@@ -1,8 +1,12 @@
import dotenv from 'dotenv';
import path from 'path';
import { fileURLToPath } from 'url';
dotenv.config();
const defaultMemoryDbFile = fileURLToPath(new URL('../data/memory.sqlite', import.meta.url));
const legacyMemoryFile = fileURLToPath(new URL('../data/memory.json', import.meta.url));
const requiredEnv = ['DISCORD_TOKEN', 'OPENAI_API_KEY'];
requiredEnv.forEach((key) => {
if (!process.env[key]) {
@@ -20,7 +24,8 @@ export const config = {
coderUserId: process.env.CODER_USER_ID || null,
maxCoderPingIntervalMs: 6 * 60 * 60 * 1000,
shortTermLimit: 10,
memoryFile: fileURLToPath(new URL('../data/memory.json', import.meta.url)),
memoryDbFile: process.env.MEMORY_DB_FILE ? path.resolve(process.env.MEMORY_DB_FILE) : defaultMemoryDbFile,
legacyMemoryFile,
summaryTriggerChars: 3000,
memoryPruneThreshold: 0.2,
maxMemories: 200,