Api session id support (#2158)

* Refactor api endpoint chat handler to its own function
remove legacy `chatWithWorkspace` and cleanup `index.js`

* Add `sessionId` in dev API to partition chats logically statelessly
This commit is contained in:
Timothy Carambat
2024-08-21 15:25:47 -07:00
committed by GitHub
parent 2d2e49bc00
commit fdc3add53c
12 changed files with 54 additions and 20 deletions

View File

@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "workspace_chats" ADD COLUMN "api_session_id" TEXT;

View File

@@ -170,17 +170,18 @@ model workspace_suggested_messages {
}
model workspace_chats {
id Int @id @default(autoincrement())
workspaceId Int
prompt String
response String
include Boolean @default(true)
user_id Int?
thread_id Int? // No relation to prevent whole table migration
createdAt DateTime @default(now())
lastUpdatedAt DateTime @default(now())
feedbackScore Boolean?
users users? @relation(fields: [user_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
id Int @id @default(autoincrement())
workspaceId Int
prompt String
response String
include Boolean @default(true)
user_id Int?
thread_id Int? // No relation to prevent whole table migration
api_session_id String? // String identifier for only the dev API to parition chats in any mode.
createdAt DateTime @default(now())
lastUpdatedAt DateTime @default(now())
feedbackScore Boolean?
users users? @relation(fields: [user_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
}
model workspace_agent_invocations {