2023-09-28 23:00:03 +02:00
|
|
|
generator client {
|
|
|
|
provider = "prisma-client-js"
|
|
|
|
}
|
|
|
|
|
|
|
|
// Uncomment the following lines and comment out the SQLite datasource block above to use PostgreSQL
|
|
|
|
// Make sure to set the correct DATABASE_URL in your .env file
|
|
|
|
// After swapping run `yarn prisma:setup` from the root directory to migrate the database
|
|
|
|
//
|
|
|
|
// datasource db {
|
|
|
|
// provider = "postgresql"
|
|
|
|
// url = env("DATABASE_URL")
|
|
|
|
// }
|
|
|
|
datasource db {
|
|
|
|
provider = "sqlite"
|
|
|
|
url = "file:../storage/anythingllm.db"
|
|
|
|
}
|
|
|
|
|
|
|
|
model api_keys {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
secret String? @unique
|
|
|
|
createdBy Int?
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
lastUpdatedAt DateTime @default(now())
|
|
|
|
}
|
|
|
|
|
|
|
|
model workspace_documents {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
docId String @unique
|
|
|
|
filename String
|
|
|
|
docpath String
|
|
|
|
workspaceId Int
|
|
|
|
metadata String?
|
2024-02-21 22:15:45 +01:00
|
|
|
pinned Boolean? @default(false)
|
2023-09-28 23:00:03 +02:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
lastUpdatedAt DateTime @default(now())
|
|
|
|
workspace workspaces @relation(fields: [workspaceId], references: [id])
|
|
|
|
}
|
|
|
|
|
|
|
|
model invites {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
code String @unique
|
|
|
|
status String @default("pending")
|
|
|
|
claimedBy Int?
|
2024-03-27 00:38:32 +01:00
|
|
|
workspaceIds String?
|
2023-09-28 23:00:03 +02:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
createdBy Int
|
|
|
|
lastUpdatedAt DateTime @default(now())
|
|
|
|
}
|
|
|
|
|
|
|
|
model system_settings {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
label String @unique
|
|
|
|
value String?
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
lastUpdatedAt DateTime @default(now())
|
|
|
|
}
|
|
|
|
|
|
|
|
model users {
|
2024-04-16 19:50:10 +02:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
username String? @unique
|
|
|
|
password String
|
|
|
|
pfpFilename String?
|
|
|
|
role String @default("default")
|
|
|
|
suspended Int @default(0)
|
2024-04-26 01:52:30 +02:00
|
|
|
seen_recovery_codes Boolean? @default(false)
|
2024-04-16 19:50:10 +02:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
lastUpdatedAt DateTime @default(now())
|
|
|
|
workspace_chats workspace_chats[]
|
|
|
|
workspace_users workspace_users[]
|
|
|
|
embed_configs embed_configs[]
|
|
|
|
embed_chats embed_chats[]
|
|
|
|
threads workspace_threads[]
|
2024-04-26 01:52:30 +02:00
|
|
|
recovery_codes recovery_codes[]
|
|
|
|
password_reset_tokens password_reset_tokens[]
|
2024-04-16 19:50:10 +02:00
|
|
|
workspace_agent_invocations workspace_agent_invocations[]
|
2024-05-10 21:35:33 +02:00
|
|
|
slash_command_presets slash_command_presets[]
|
2023-09-28 23:00:03 +02:00
|
|
|
}
|
|
|
|
|
2024-04-26 01:52:30 +02:00
|
|
|
model recovery_codes {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
user_id Int
|
|
|
|
code_hash String
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
user users @relation(fields: [user_id], references: [id], onDelete: Cascade)
|
|
|
|
|
|
|
|
@@index([user_id])
|
|
|
|
}
|
|
|
|
|
|
|
|
model password_reset_tokens {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
user_id Int
|
|
|
|
token String @unique
|
|
|
|
expiresAt DateTime
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
user users @relation(fields: [user_id], references: [id], onDelete: Cascade)
|
|
|
|
|
|
|
|
@@index([user_id])
|
|
|
|
}
|
|
|
|
|
2023-09-28 23:00:03 +02:00
|
|
|
model document_vectors {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
docId String
|
|
|
|
vectorId String
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
lastUpdatedAt DateTime @default(now())
|
|
|
|
}
|
|
|
|
|
|
|
|
model welcome_messages {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
user String
|
|
|
|
response String
|
|
|
|
orderIndex Int?
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
}
|
|
|
|
|
|
|
|
model workspaces {
|
2024-02-06 20:24:33 +01:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
name String
|
|
|
|
slug String @unique
|
|
|
|
vectorTag String?
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
openAiTemp Float?
|
|
|
|
openAiHistory Int @default(20)
|
|
|
|
lastUpdatedAt DateTime @default(now())
|
|
|
|
openAiPrompt String?
|
|
|
|
similarityThreshold Float? @default(0.25)
|
2024-04-05 19:58:36 +02:00
|
|
|
chatProvider String?
|
2024-02-06 20:24:33 +01:00
|
|
|
chatModel String?
|
|
|
|
topN Int? @default(4)
|
2024-02-16 23:50:40 +01:00
|
|
|
chatMode String? @default("chat")
|
2024-03-27 00:38:32 +01:00
|
|
|
pfpFilename String?
|
2024-04-16 19:50:10 +02:00
|
|
|
agentProvider String?
|
|
|
|
agentModel String?
|
2024-05-01 01:14:30 +02:00
|
|
|
queryRefusalResponse String?
|
2024-02-06 20:24:33 +01:00
|
|
|
workspace_users workspace_users[]
|
|
|
|
documents workspace_documents[]
|
|
|
|
workspace_suggested_messages workspace_suggested_messages[]
|
|
|
|
embed_configs embed_configs[]
|
2024-02-09 03:37:22 +01:00
|
|
|
threads workspace_threads[]
|
2024-04-16 19:50:10 +02:00
|
|
|
workspace_agent_invocations workspace_agent_invocations[]
|
2024-02-09 03:37:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
model workspace_threads {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
name String
|
|
|
|
slug String @unique
|
|
|
|
workspace_id Int
|
|
|
|
user_id Int?
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
lastUpdatedAt DateTime @default(now())
|
|
|
|
workspace workspaces @relation(fields: [workspace_id], references: [id], onDelete: Cascade)
|
|
|
|
user users? @relation(fields: [user_id], references: [id], onDelete: Cascade)
|
|
|
|
|
|
|
|
@@index([workspace_id])
|
|
|
|
@@index([user_id])
|
2024-02-06 20:24:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
model workspace_suggested_messages {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
workspaceId Int
|
|
|
|
heading String
|
|
|
|
message String
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
lastUpdatedAt DateTime @default(now())
|
|
|
|
workspace workspaces @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
|
|
|
|
|
|
|
@@index([workspaceId])
|
2023-09-28 23:00:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
model workspace_chats {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
workspaceId Int
|
|
|
|
prompt String
|
|
|
|
response String
|
|
|
|
include Boolean @default(true)
|
|
|
|
user_id Int?
|
2024-02-09 03:37:22 +01:00
|
|
|
thread_id Int? // No relation to prevent whole table migration
|
2023-09-28 23:00:03 +02:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
lastUpdatedAt DateTime @default(now())
|
2024-02-13 20:33:05 +01:00
|
|
|
feedbackScore Boolean?
|
2023-09-28 23:00:03 +02:00
|
|
|
users users? @relation(fields: [user_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
|
|
}
|
|
|
|
|
2024-04-16 19:50:10 +02:00
|
|
|
model workspace_agent_invocations {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
uuid String @unique
|
|
|
|
prompt String // Contains agent invocation to parse + option additional text for seed.
|
|
|
|
closed Boolean @default(false)
|
|
|
|
user_id Int?
|
|
|
|
thread_id Int? // No relation to prevent whole table migration
|
|
|
|
workspace_id Int
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
lastUpdatedAt DateTime @default(now())
|
|
|
|
user users? @relation(fields: [user_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
|
|
workspace workspaces @relation(fields: [workspace_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
|
|
|
|
|
|
@@index([uuid])
|
|
|
|
}
|
|
|
|
|
2023-09-28 23:00:03 +02:00
|
|
|
model workspace_users {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
user_id Int
|
|
|
|
workspace_id Int
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
lastUpdatedAt DateTime @default(now())
|
|
|
|
workspaces workspaces @relation(fields: [workspace_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
|
|
users users @relation(fields: [user_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
|
|
}
|
2023-11-06 22:13:53 +01:00
|
|
|
|
|
|
|
model cache_data {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
name String
|
|
|
|
data String
|
|
|
|
belongsTo String?
|
|
|
|
byId Int?
|
|
|
|
expiresAt DateTime?
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
lastUpdatedAt DateTime @default(now())
|
|
|
|
}
|
2024-02-05 23:21:34 +01:00
|
|
|
|
|
|
|
model embed_configs {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
uuid String @unique
|
|
|
|
enabled Boolean @default(false)
|
|
|
|
chat_mode String @default("query")
|
|
|
|
allowlist_domains String?
|
|
|
|
allow_model_override Boolean @default(false)
|
|
|
|
allow_temperature_override Boolean @default(false)
|
|
|
|
allow_prompt_override Boolean @default(false)
|
|
|
|
max_chats_per_day Int?
|
|
|
|
max_chats_per_session Int?
|
|
|
|
workspace_id Int
|
|
|
|
createdBy Int?
|
|
|
|
usersId Int?
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
workspace workspaces @relation(fields: [workspace_id], references: [id], onDelete: Cascade)
|
|
|
|
embed_chats embed_chats[]
|
|
|
|
users users? @relation(fields: [usersId], references: [id])
|
|
|
|
}
|
|
|
|
|
|
|
|
model embed_chats {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
prompt String
|
|
|
|
response String
|
|
|
|
session_id String
|
|
|
|
include Boolean @default(true)
|
|
|
|
connection_information String?
|
|
|
|
embed_id Int
|
|
|
|
usersId Int?
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
embed_config embed_configs @relation(fields: [embed_id], references: [id], onDelete: Cascade)
|
|
|
|
users users? @relation(fields: [usersId], references: [id])
|
|
|
|
}
|
[FEAT] Automated audit logging (#667)
* WIP event logging - new table for events and new settings view for viewing
* WIP add logging
* UI for log rows
* rename files to Logging to prevent getting gitignore
* add metadata for all logging events and colored badges in logs page
* remove unneeded comment
* cleanup namespace for logging
* clean up backend calls
* update logging to show to => from settings changes
* add logging for invitations, created, deleted, and accepted
* add logging for user created, updated, suspended, or removed
* add logging for workspace deleted
* add logging for chat logs exported
* add logging for API keys, LLM, embedder, vector db, embed chat, and reset button
* modify event logs
* update to event log types
* simplify rendering of event badges
---------
Co-authored-by: timothycarambat <rambat1010@gmail.com>
2024-02-07 00:21:40 +01:00
|
|
|
|
|
|
|
model event_logs {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
event String
|
|
|
|
metadata String?
|
|
|
|
userId Int?
|
|
|
|
occurredAt DateTime @default(now())
|
|
|
|
|
|
|
|
@@index([event])
|
|
|
|
}
|
2024-05-10 21:35:33 +02:00
|
|
|
|
|
|
|
model slash_command_presets {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
command String
|
|
|
|
prompt String
|
|
|
|
description String
|
|
|
|
uid Int @default(0) // 0 is null user
|
|
|
|
userId Int?
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
lastUpdatedAt DateTime @default(now())
|
|
|
|
user users? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
|
|
|
|
@@unique([uid, command])
|
|
|
|
}
|