Added: - Groq AI provider (free, fast with llama-3.3-70b-versatile) - Timezone setting (22 timezones) - Journal context: include previous journals (3/7/14/30 days) - Test connection button for AI providers - Per-provider settings (API key, model, base URL remembered) - Detailed task logging (full prompts and responses) - Tasks page with expandable details - Progress modal with steps and AI output details Fixed: - Groq API endpoint (https://api.groq.com/openai/v1/chat/completions) - Ollama baseUrl leaking to other providers - Database schema references - Proper Prisma migrations (data-safe) Changed: - Default AI: OpenAI → Groq - Project renamed: TotalRecall → DearDiary - Strict anti-hallucination prompt - Docker uses prisma migrate deploy (non-destructive)
42 lines
1.4 KiB
Bash
42 lines
1.4 KiB
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
# Check if database exists and has data
|
|
if [ -f /data/deardiary.db ]; then
|
|
# Database exists - ensure migration tracking exists
|
|
bun -e "
|
|
const { PrismaClient } = require('@prisma/client');
|
|
const prisma = new PrismaClient({ datasourceUrl: 'file:/data/deardiary.db' });
|
|
|
|
async function main() {
|
|
try {
|
|
const tables = await prisma.\$queryRaw\`SELECT name FROM sqlite_master WHERE type='table' AND name='_prisma_migrations'\`;
|
|
if (tables.length === 0) {
|
|
await prisma.\$executeRaw\`
|
|
CREATE TABLE _prisma_migrations (
|
|
id TEXT PRIMARY KEY,
|
|
checksum TEXT NOT NULL,
|
|
finished_at DATETIME,
|
|
migration_name TEXT NOT NULL,
|
|
logs TEXT,
|
|
rolled_back_at DATETIME,
|
|
started_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
applied_steps_count INTEGER NOT NULL DEFAULT 0
|
|
)
|
|
\`;
|
|
await prisma.\$executeRaw\`INSERT INTO _prisma_migrations (id, checksum, finished_at, migration_name, applied_steps_count) VALUES (lower(hex(randomblob(16))), 'baseline', datetime('now'), '00000000000000_init', 1)\`;
|
|
console.log('Migration table created');
|
|
}
|
|
} catch (e) {
|
|
console.log('Migration check done');
|
|
}
|
|
await prisma.\$disconnect();
|
|
}
|
|
main();
|
|
"
|
|
fi
|
|
|
|
echo "Starting server..."
|
|
nginx -g 'daemon off;' &
|
|
exec bun ./dist/index.js
|