Skip to content

fix(ai-adapter): send catch up summaries as a one-shot prompt - #1423

Merged
Aryan-Verma-999 merged 1 commit into
RocketChat:developfrom
MuhammadFaizan-prog:fix/ai-adapter-summarize-one-shot
Nov 15, 2026
Merged

Aryan-Verma-999 merged 1 commit into
RocketChat:developfrom
MuhammadFaizan-prog:fix/ai-adapter-summarize-one-shot

Conversation

@MuhammadFaizan-prog

Copy link
Copy Markdown
Contributor

fix(ai-adapter): send catch up summaries as a one-shot prompt

Acceptance Criteria fulfillment

  • BaseAIAdapter.summarize() sends the transcript once instead of also sending the last 10 messages as chat turns.
  • The summary request uses empty history, like getSuggestions() already does, and keeps the caller's roomId, userId and metadata.
  • The transcript is marked as chat data, matching the reply suggestions prompt.
  • No change to the IAIAdapter interface or the adapters.

Fixes #1422

Video/Screenshots

No UI change. With buildChatMessages capturing the request for summarize(messages, { roomId, userId, history: messages }) on 20 messages (the Catch up call): Before: last message appears 2 times. After: 1 time; the full transcript and the summary instruction are still in the prompt.

PR Test Details

  1. In packages/ai-adapter call summarize() with 10+ messages and the same messages as context.history, capturing the request. 2) Check the latest message appears once. 3) prettier --check 'src/' and tsc --noEmit pass for packages/ai-adapter.

Prepared with AI assistance (Hark); I reviewed and own the final diff.

Note: The PR will be ready for live testing at https://rocketchat.github.io/EmbeddedChat/pulls/pr-<pr_number> after approval. Contributors are requested to replace <pr_number> with the actual PR number.

summarize() put the transcript in the prompt and also passed the same
messages as context.history, so every adapter sent the latest messages
twice and appended the instruction to the conversation. Send empty
history like getSuggestions(), keep roomId/userId/metadata, and mark the
transcript as chat data.
@Aryan-Verma-999

Copy link
Copy Markdown
Collaborator

LGTM, Thanks for the contribution :)

@Aryan-Verma-999
Aryan-Verma-999 merged commit 1cb7bb3 into RocketChat:develop Nov 15, 2026
4 checks passed
github-actions Bot added a commit that referenced this pull request Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AI catch up sends the conversation to the model twice (BaseAIAdapter.summarize)

2 participants