Skip to content

feat(webui): push change notices to open pages over SSE - #989

Open
Col0ring wants to merge 4 commits into
modelscope:mainfrom
Col0ring:feat/server-change-events
Open

Col0ring wants to merge 4 commits into
modelscope:mainfrom
Col0ring:feat/server-change-events

Conversation

@Col0ring

Copy link
Copy Markdown
Contributor

Summary

Server-sent change stream

  • add an in-process event bus and a GET /api/events SSE endpoint that fans a change notice out to every open page
  • publish a notice from the envelope route after a successful management write (skipping presence, chat, recovery and the event stream itself), so a mutation made by any caller — including an external script or another tab — refreshes every open page
  • open one EventSource per tab at the app shell and revalidate the active routes on a change notice, coalescing a burst into one refresh; replay the matching in-tab event so components that hold their own state react to an external change like a local one
  • add a models-changed event and re-fetch the model catalog in the composer picker and the models settings page when it fires

Delete flow

  • when deleting the open project or session, await the navigation to a live URL before revalidating, so the refresh no longer aborts the route switch or flashes the deleted route's 404

Test

  • pnpm typecheck
  • pytest tests/test_state_lifecycle_api.py tests/test_chat.py (111 passed)

- add an in-process event bus and a GET /api/events SSE endpoint that fans a
  change notice out to every open page
- publish a notice from the envelope route after a successful management write,
  skipping presence, chat, recovery and the event stream itself
- open one EventSource per tab at the app shell and revalidate the active routes
  on a change notice, coalescing a burst into one refresh
- replay the matching in-tab event so components that hold their own state react
  to an external change like a local one
- add a models-changed event and re-fetch the model catalog in the composer
  picker and the models settings page when it fires
- when deleting the open project or session, await the navigation to a live URL
  before revalidating, so the refresh no longer aborts the switch or flashes the
  deleted route's 404
- add a projects-changed event and fire it from the bridge for project
  create/rename/delete, excluding the nested project settings routes
- re-fetch on the change stream in the composer project and search pills, the
  project and hub MCP/skill panels, the memory doc card, and the personalization
  and search settings pages
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