Skip to content

Conversation

pamelafox
Copy link
Collaborator

@pamelafox pamelafox commented May 27, 2025

Purpose

The changes ensure that the "Thought Process" and "Supporting Content" buttons are disabled while content is actively streaming.

Screenshot 2025-05-27 at 2 11 43 PM

In theory, it should be possible to see the Thought Process and Supporting Content as soon as the first chunk is streamed in that contains the context, but:

  1. That would be a larger change as the AnalysisTab currently looks at the answers array which isn't populated until the stream finishes
  2. In the future, I don't know that it would always be true that the first chunk contains the context, so it's better to wait until the stream finishes to show the Thought Process and Supporting Content. Or to make sure we're very specific about only enabling the viewing of whichever context has been streamed so far.

Does this introduce a breaking change?

When developers merge from main and run the server, azd up, or azd deploy, will this produce an error?
If you're not sure, try it out on an old environment.

[ ] Yes
[X] No

Does this require changes to learn.microsoft.com docs?

This repository is referenced by this tutorial
which includes deployment, settings and usage instructions. If text or screenshot need to change in the tutorial,
check the box below and notify the tutorial author. A Microsoft employee can do this for you if you're an external contributor.

[ ] Yes
[X] No

Type of change

[X] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

Code quality checklist

See CONTRIBUTING.md for more details.

  • The current tests all pass (python -m pytest).
  • I added tests that prove my fix is effective or that my feature works - I don't think we have any e2e tests that check the mid-stream state.
  • I ran python -m pytest --cov to verify 100% coverage of added lines
  • I ran python -m mypy to check for type errors
  • I either used the pre-commit hooks or ran ruff and black manually on my code.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR disables the "Thought Process" and "Supporting Content" buttons during content streaming to prevent user interaction until streaming is complete.

  • Updated the disable logic for the Thought Process button by adding a check for the streaming state.
  • Updated the disable logic for the Supporting Content button similarly.

ariaLabel={t("tooltips.showThoughtProcess")}
onClick={() => onThoughtProcessClicked()}
disabled={!answer.context.thoughts?.length}
disabled={!answer.context.thoughts?.length || isStreaming}
Copy link
Preview

Copilot AI May 27, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider extracting the disable condition into a descriptive variable (e.g., isThoughtProcessDisabled) to improve readability and maintainability.

Suggested change
disabled={!answer.context.thoughts?.length || isStreaming}
disabled={isThoughtProcessDisabled}

Copilot uses AI. Check for mistakes.

ariaLabel={t("tooltips.showSupportingContent")}
onClick={() => onSupportingContentClicked()}
disabled={!answer.context.data_points}
disabled={!answer.context.data_points || isStreaming}
Copy link
Preview

Copilot AI May 27, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider extracting the disable condition into a descriptive variable (e.g., isSupportingContentDisabled) to enhance clarity and simplify future modifications.

Suggested change
disabled={!answer.context.data_points || isStreaming}
disabled={isSupportingContentDisabled}

Copilot uses AI. Check for mistakes.

@pamelafox pamelafox merged commit c4ef3be into Azure-Samples:main May 27, 2025
22 checks passed
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.

2 participants