Skip to content

Commit

Permalink
fix: message attachment merge (#8498)
Browse files Browse the repository at this point in the history
  • Loading branch information
darkskygit authored Oct 16, 2024
1 parent e7dcf63 commit 075ceda
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/backend/server/src/plugins/copilot/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,17 @@ export class ChatSession implements AsyncDisposable {
normalizedParams,
this.config.sessionId
);
finished[0].attachments = firstMessage.attachments;

// attachments should be combined with the first user message
const firstUserMessage =
finished.find(m => m.role === 'user') || finished[0];
firstUserMessage.attachments = [
finished[0].attachments || [],
firstMessage.attachments || [],
]
.flat()
.filter(v => !!v?.trim());

return finished;
}

Expand Down

0 comments on commit 075ceda

Please sign in to comment.