diff --git a/packages/backend/server/src/plugins/copilot/prompt.ts b/packages/backend/server/src/plugins/copilot/prompt.ts index f7ab278e77..c71c4fc2fd 100644 --- a/packages/backend/server/src/plugins/copilot/prompt.ts +++ b/packages/backend/server/src/plugins/copilot/prompt.ts @@ -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, })), }, diff --git a/packages/backend/server/src/plugins/copilot/session.ts b/packages/backend/server/src/plugins/copilot/session.ts index 607772d647..aa5b033a3c 100644 --- a/packages/backend/server/src/plugins/copilot/session.ts +++ b/packages/backend/server/src/plugins/copilot/session.ts @@ -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, }, diff --git a/packages/backend/server/src/plugins/copilot/types.ts b/packages/backend/server/src/plugins/copilot/types.ts index 2d6f5651c1..805f0b3387 100644 --- a/packages/backend/server/src/plugins/copilot/types.ts +++ b/packages/backend/server/src/plugins/copilot/types.ts @@ -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()