fix: history attachment query (#6670)

This commit is contained in:
darkskygit 2024-04-23 03:34:59 +00:00
parent c425cfa598
commit 01a0f60d03
No known key found for this signature in database
GPG Key ID: 97B7D036B1566E9D
3 changed files with 5 additions and 1 deletions

View File

@ -188,6 +188,7 @@ export class PromptService {
create: messages.map((m, idx) => ({
idx,
...m,
attachments: m.attachments || undefined,
params: m.params || undefined,
})),
},
@ -206,6 +207,7 @@ export class PromptService {
create: messages.map((m, idx) => ({
idx,
...m,
attachments: m.attachments || undefined,
params: m.params || undefined,
})),
},

View File

@ -161,6 +161,7 @@ export class ChatSessionService {
const messages = state.messages.map(m => ({
...m,
attachments: m.attachments || undefined,
params: m.params || undefined,
}));
@ -322,6 +323,7 @@ export class ChatSessionService {
select: {
role: true,
content: true,
attachments: true,
params: true,
createdAt: true,
},

View File

@ -59,7 +59,7 @@ export const ChatMessageRole = Object.values(AiPromptRole) as [
const PureMessageSchema = z.object({
content: z.string(),
attachments: z.array(z.string()).optional(),
attachments: z.array(z.string()).optional().nullable(),
params: z
.record(z.union([z.string(), z.array(z.string())]))
.optional()