Skip to content

Conversation

@wanglam
Copy link
Collaborator

@wanglam wanglam commented Nov 10, 2025

Description

This change introduces persistent state management for the chatbot window using browser localStorage. The implementation extends the ChatService to track comprehensive window state including open/closed status, layout mode (sidecar or fullscreen), and padding size, automatically persisting changes to localStorage and restoring the chatbot to its previous configuration on application start.

Changelog

  • feat: Persist chatbot state in local storage

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

@wanglam wanglam changed the title Persist chatbot state in local storage [chat]Persist chatbot state in local storage Nov 10, 2025
@codecov
Copy link

codecov bot commented Nov 10, 2025

Codecov Report

❌ Patch coverage is 74.07407% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.76%. Comparing base (a2d096f) to head (5f3a0fb).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...gins/chat/public/components/chat_header_button.tsx 46.66% 5 Missing and 3 partials ⚠️
src/plugins/chat/public/services/chat_service.ts 77.77% 3 Missing and 1 partial ⚠️
src/plugins/chat/public/plugin.ts 90.47% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10895   +/-   ##
=======================================
  Coverage   60.76%   60.76%           
=======================================
  Files        4533     4533           
  Lines      122127   122162   +35     
  Branches    20459    20469   +10     
=======================================
+ Hits        74207    74232   +25     
- Misses      42687    42693    +6     
- Partials     5233     5237    +4     
Flag Coverage Δ
Linux_1 26.57% <ø> (+<0.01%) ⬆️
Linux_2 38.92% <ø> (-0.01%) ⬇️
Linux_3 39.43% <74.07%> (+0.01%) ⬆️
Linux_4 33.75% <ø> (+<0.01%) ⬆️
Windows_1 26.58% <ø> (+<0.01%) ⬆️
Windows_2 38.90% <ø> (-0.01%) ⬇️
Windows_3 39.44% <74.07%> (+0.01%) ⬆️
Windows_4 33.75% <ø> (+<0.01%) ⬆️

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@d-buckner
Copy link
Member

d-buckner commented Nov 10, 2025

How are we handling invalidation if a user logs out and signs in to another user? Or are we thinking about these preferences as client preferences instead of user preferences?

@wanglam
Copy link
Collaborator Author

wanglam commented Nov 10, 2025

How are we handling invalidation if a user logs out and signs in to another user? Or are we thinking about these preferences as client preferences instead of user preferences?

Yes. For now it's a client preferences. It won't be cleared after user logout. This is an existing feature in the dashboards assistant repo. I just sync back to the OSD chat plugin to keep the two chatbot have the same behavior.

@wanglam wanglam merged commit 01af8e7 into opensearch-project:main Nov 11, 2025
83 checks passed
lunalzm pushed a commit to lunalzm/OpenSearch-Dashboards that referenced this pull request Nov 11, 2025
* Persist chatbot state in local storage

Signed-off-by: Lin Wang <[email protected]>

* Changeset file for PR opensearch-project#10895 created/updated

---------

Signed-off-by: Lin Wang <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants