Skip to content

fix(agent-insights): Filter empty input messages #93409

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

ArthurKnaus
Copy link
Member

Sometimes we receive messages with not renderable content.
Screenshot 2025-06-12 at 11 16 03

This PR filters those messages.

@ArthurKnaus ArthurKnaus requested a review from a team June 12, 2025 09:16
@ArthurKnaus ArthurKnaus requested a review from a team as a code owner June 12, 2025 09:16
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jun 12, 2025
Comment on lines -25 to -28
return content
.filter((part: any) => part.type === 'text')
.map((part: any) => part.text)
.join('\n');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this part not needed anymore?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code de-duplication. renderUserMessage & renderAssistantMessage became renderTextMessages

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that part I saw, but I mean the filter().map().join()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is still doing it?

function renderTextMessages(content: any) {
  if (!Array.isArray(content)) {
    return content;
  }
  return content
    .filter((part: any) => part.type === 'text')
    .map((part: any) => part.text)
    .join('\n');
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, sorry, I read that diff wrong - looked like we were just returning content. Thanks for clarifying :)

@ArthurKnaus ArthurKnaus enabled auto-merge (squash) June 12, 2025 09:26
@ArthurKnaus ArthurKnaus merged commit 52b4933 into master Jun 12, 2025
44 checks passed
@ArthurKnaus ArthurKnaus deleted the aknaus/fix/agent-insights/filter-empty-input-messages branch June 12, 2025 09:27
vishnupsatish pushed a commit that referenced this pull request Jun 12, 2025
Sometimes we receive messages with not renderable content.
This PR filters those messages.
andrewshie-sentry pushed a commit that referenced this pull request Jun 19, 2025
Sometimes we receive messages with not renderable content.
This PR filters those messages.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants