Skip to content
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

Fix generator placeholder and optimize updates #6105

Merged
merged 3 commits into from Jan 9, 2024

Conversation

ahuang11
Copy link
Contributor

@ahuang11 ahuang11 commented Dec 20, 2023

In generator tasks, the condition while not task.done() and num_entries == len(self._chat_log): leads to tasks completing almost instantly, as generators are lazily evaluated. Consequently, relying on task.done() becomes unreliable.

When using submit_task(generator), the state.FiNISHED is quickly reached because, technically, the generator is lazily evaluated and returned. To illustrate, the generator is considered "finished" in a mere 1.33 microseconds, as depicted in the image below:

image

So it's not reliable to depend on task.done() Instead, we should use callback_state.IDLE to track business (when re-reading this, I was confused and realized, business -> busy-ness)

Also, this updates how the placeholder text gets updated.

Addresses
https://discourse.holoviz.org/t/spinning-icon-effect-that-appears-when-the-user-sends-a-message-in-chatinterface/6582/10?u=ahuang11

Copy link

codecov bot commented Dec 20, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (7f25eb1) 84.67% compared to head (7c97bfa) 84.65%.

Files Patch % Lines
panel/chat/feed.py 50.00% 2 Missing ⚠️
panel/tests/chat/test_feed.py 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6105      +/-   ##
==========================================
- Coverage   84.67%   84.65%   -0.02%     
==========================================
  Files         296      296              
  Lines       44100    44105       +5     
==========================================
- Hits        37341    37338       -3     
- Misses       6759     6767       +8     
Flag Coverage Δ
ui-tests 40.69% <6.66%> (-0.01%) ⬇️
unitexamples-tests 72.66% <80.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@philippjfr philippjfr merged commit 6d1750d into main Jan 9, 2024
12 of 13 checks passed
@philippjfr philippjfr deleted the fix_placeholder_generator branch January 9, 2024 17:48
This was referenced Jan 17, 2024
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.

None yet

2 participants