feat: v0.0.1 - Groq provider, timezone, journal context, test connection, task logging
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)
This commit is contained in:
103
backend/prisma/migrations/00000000000000_init.sql
Normal file
103
backend/prisma/migrations/00000000000000_init.sql
Normal file
@@ -0,0 +1,103 @@
|
||||
-- CreateInitialSchema
|
||||
CREATE TABLE IF NOT EXISTS "User" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"email" TEXT NOT NULL,
|
||||
"passwordHash" TEXT NOT NULL,
|
||||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" DATETIME NOT NULL
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS "User_email_key" ON "User"("email");
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "ApiKey" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"userId" TEXT NOT NULL,
|
||||
"keyHash" TEXT NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"lastUsedAt" DATETIME,
|
||||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
CONSTRAINT "ApiKey_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "ApiKey_userId_key" ON "ApiKey"("userId");
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS "ApiKey_keyHash_key" ON "ApiKey"("keyHash");
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "Entry" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"userId" TEXT NOT NULL,
|
||||
"date" TEXT NOT NULL,
|
||||
"type" TEXT NOT NULL,
|
||||
"content" TEXT NOT NULL,
|
||||
"mediaPath" TEXT,
|
||||
"metadata" TEXT,
|
||||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" DATETIME NOT NULL,
|
||||
CONSTRAINT "Entry_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "Entry_userId_date_key" ON "Entry"("userId", "date");
|
||||
CREATE INDEX IF NOT EXISTS "Entry_date_key" ON "Entry"("date");
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "Journal" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"userId" TEXT NOT NULL,
|
||||
"date" TEXT NOT NULL,
|
||||
"content" TEXT NOT NULL,
|
||||
"entryCount" INTEGER NOT NULL,
|
||||
"generatedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
CONSTRAINT "Journal_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS "Journal_userId_date_key" ON "Journal"("userId", "date");
|
||||
CREATE INDEX IF NOT EXISTS "Journal_userId_key" ON "Journal"("userId");
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "Task" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"userId" TEXT NOT NULL,
|
||||
"journalId" TEXT NOT NULL,
|
||||
"type" TEXT NOT NULL DEFAULT 'journal_generate',
|
||||
"status" TEXT NOT NULL DEFAULT 'pending',
|
||||
"provider" TEXT NOT NULL,
|
||||
"model" TEXT,
|
||||
"prompt" TEXT NOT NULL,
|
||||
"request" TEXT,
|
||||
"response" TEXT,
|
||||
"error" TEXT,
|
||||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"completedAt" DATETIME,
|
||||
CONSTRAINT "Task_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT "Task_journalId_fkey" FOREIGN KEY ("journalId") REFERENCES "Journal" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "Task_userId_key" ON "Task"("userId");
|
||||
CREATE INDEX IF NOT EXISTS "Task_journalId_key" ON "Task"("journalId");
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "Settings" (
|
||||
"userId" TEXT NOT NULL PRIMARY KEY,
|
||||
"aiProvider" TEXT NOT NULL DEFAULT 'groq',
|
||||
"aiApiKey" TEXT,
|
||||
"aiModel" TEXT NOT NULL DEFAULT 'llama-3.3-70b-versatile',
|
||||
"aiBaseUrl" TEXT,
|
||||
"journalPrompt" TEXT NOT NULL DEFAULT 'You are a factual diary summarizer. Your ONLY job is to summarize the entries provided to you - nothing more.\n\nCRITICAL RULES:\n1. ONLY use information explicitly stated in the entries below\n2. NEVER invent, assume, or hallucinate any detail not in the entries\n3. NEVER add activities, emotions, weather, or context not directly mentioned\n4. If something is unclear in the entries, simply state what IS clear\n5. Keep the summary grounded and factual - no embellishment\n6. Do not write in an overly creative or story-telling style\n7. Only reference what the user explicitly recorded\n\nStructure:\n- Start with what was recorded (meetings, tasks, activities)\n- Note any explicit feelings or observations mentioned\n- Keep it concise and factual\n- If there are gaps in the day, acknowledge only what was recorded',
|
||||
"language" TEXT NOT NULL DEFAULT 'en',
|
||||
"timezone" TEXT NOT NULL DEFAULT 'UTC',
|
||||
"providerSettings" TEXT,
|
||||
"journalContextDays" INTEGER NOT NULL DEFAULT 10,
|
||||
CONSTRAINT "Settings_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- Create _prisma_migrations table for Prisma migrate tracking
|
||||
CREATE TABLE IF NOT EXISTS "_prisma_migrations" (
|
||||
"id" TEXT NOT NULL 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
|
||||
);
|
||||
|
||||
-- Record this migration
|
||||
INSERT INTO "_prisma_migrations" ("id", "checksum", "finished_at", "migration_name", "applied_steps_count")
|
||||
VALUES (lower(hex(randomblob(16))), 'init', datetime('now'), '00000000000000_init', 1);
|
||||
Reference in New Issue
Block a user