Files
deardiary/backend/prisma/schema.prisma
lotherk 5c217853de 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)
2026-03-26 21:56:29 +00:00

105 lines
3.2 KiB
Plaintext

generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "sqlite"
url = env("DATABASE_URL")
}
model User {
id String @id @default(uuid())
email String @unique
passwordHash String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
apiKeys ApiKey[]
entries Entry[]
journals Journal[]
tasks Task[]
settings Settings?
}
model ApiKey {
id String @id @default(uuid())
userId String
keyHash String @unique
name String
lastUsedAt DateTime?
createdAt DateTime @default(now())
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@index([userId])
}
model Entry {
id String @id @default(uuid())
userId String
date String
type String
content String
mediaPath String?
metadata String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@index([userId, date])
@@index([date])
}
model Journal {
id String @id @default(uuid())
userId String
date String
content String
entryCount Int
generatedAt DateTime @default(now())
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
tasks Task[]
@@unique([userId, date])
@@index([userId])
}
model Task {
id String @id @default(uuid())
userId String
journalId String
type String @default("journal_generate")
status String @default("pending")
provider String
model String?
prompt String
request String?
response String?
error String?
createdAt DateTime @default(now())
completedAt DateTime?
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
journal Journal @relation(fields: [journalId], references: [id], onDelete: Cascade)
@@index([userId])
@@index([journalId])
}
model Settings {
userId String @id
aiProvider String @default("groq")
aiApiKey String?
aiModel String @default("llama-3.3-70b-versatile")
aiBaseUrl String?
journalPrompt String @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 String @default("en")
timezone String @default("UTC")
providerSettings String?
journalContextDays Int @default(10)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
}