Skip to content

Conversation

@korade-krushna
Copy link

@korade-krushna korade-krushna commented Dec 29, 2025

Description

Fixes a bug where artifacts were being rendered twice in the chat interface when an event contained both content (text or function calls) and an artifact delta.

Fixes

#325
google/adk-python#4036

What it does

Fixes Artifact Duplication: Updates storeMessage in ChatComponent to only process artifactDelta when the method is invoked for action processing (specifically when part is null). This ensures that calls to storeMessage for handling content (like text or functionCall) do not redundantly re-trigger artifact rendering.
Regression Testing: Adds comprehensive test cases to chat.component.spec.ts to verify that duplication is prevented while ensuring artifacts are still correctly rendered for text-only responses.

Features Demonstrated

  • Conditional logic refinement in Angular components
  • Jasmine unit testing for complex event streams
  • Idempotent artifact rendering handling

Testing Plan

  • Automated Tests: Run npm run test (or ng test) and verify all 441 tests pass.
    • Specific regression tests added:
      • should not duplicate artifact message when event has both content and artifact delta
      • should render artifact for text-only response
  • Manual Verification:
    1. Launch the application (adk-web).
    2. Use an agent that generates a mixed response (e.g., Saves an artifact AND returns text/function call in the same turn).
    3. Verify that the saved artifact card appears exactly once in the chat stream.

Checklist

  • I have signed the CLA
  • I have read the CONTRIBUTING.md
  • I have added a README for the sample (N/A)
  • The sample loads and runs correctly

@korade-krushna korade-krushna changed the title Update storeMessages to process not null part Fix duplicate artifact rendering in chat stream Dec 29, 2025
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.

1 participant