adds search support with exa

This commit is contained in:
2026-02-13 23:49:55 -08:00
parent 5340c55aa6
commit 393dac37a7
14 changed files with 948 additions and 155 deletions

View File

@@ -22,6 +22,10 @@ enum MessageRole {
tool
}
enum SearchSource {
exa
}
model User {
id String @id @default(cuid())
createdAt DateTime @default(now())
@@ -31,6 +35,7 @@ model User {
handle String? @unique
chats Chat[]
searches Search[]
}
model Chat {
@@ -92,3 +97,50 @@ model LlmCall {
@@index([chatId, createdAt])
@@index([provider, model, createdAt])
}
model Search {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
title String?
query String?
source SearchSource @default(exa)
requestId String?
rawResponse Json?
latencyMs Int?
error String?
user User? @relation(fields: [userId], references: [id])
userId String?
results SearchResult[]
@@index([updatedAt])
@@index([userId])
}
model SearchResult {
id String @id @default(cuid())
createdAt DateTime @default(now())
search Search @relation(fields: [searchId], references: [id], onDelete: Cascade)
searchId String
rank Int
title String?
url String
publishedDate String?
author String?
text String?
highlights Json?
highlightScores Json?
score Float?
favicon String?
image String?
@@index([searchId, rank])
}