Skip to content

Commit 578d447

Browse files
committed
add model AssistantModeContext
1 parent 94ea55c commit 578d447

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

prisma/schema.prisma

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,20 @@ model AssistantMode {
7878
createdAt DateTime @default(now())
7979
updatedAt DateTime @updatedAt
8080
81+
contexts AssistantModeContext[]
8182
chatRoom ChatRoom[]
82-
llmProvider LLMProvider? @relation(fields: [llmProviderId], references: [id])
83-
author User? @relation(fields: [authorId], references: [id])
83+
llmProvider LLMProvider? @relation(fields: [llmProviderId], references: [id])
84+
author User? @relation(fields: [authorId], references: [id])
85+
}
86+
87+
model AssistantModeContext {
88+
id String @id @default(cuid())
89+
assistantModeId String
90+
data String
91+
createdAt DateTime @default(now())
92+
updatedAt DateTime @updatedAt
93+
94+
assistantMode AssistantMode @relation(fields: [assistantModeId], references: [id])
8495
}
8596

8697
model LLMProvider {

src/app/api/assistant-modes/route.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,12 @@ export async function POST(req: NextRequest) {
5858
description: data.description,
5959
systemPrompt: data.systemPrompt,
6060
authorId: session.user.id,
61-
visibility: 'PRIVATE'
61+
visibility: 'PRIVATE',
62+
contexts: {
63+
create: {
64+
data: data.context,
65+
}
66+
}
6267
}
6368
})
6469

0 commit comments

Comments
 (0)