perf: open long sessions without re-reading every tool result

A chat page carried every finished tool result, and the app fetched it
twice when opening a chat, with a 20 second deadline. On a slow link a
long session (this one was ~530 KB per page) timed out.

- ask for shelled pages (x-openchamber-part-shells: v1), which drops
  finished tool results: ~180 KB for the same page
- fetch one message by id when its tool row is opened
- keep tool and step updates local from events instead of re-reading
  the page on every step, and only resync after a real disconnect
- 60 second deadline with a retry button

Bump version to 0.1.11 (build 12).
This commit is contained in:
blumia committed 2026-11-16 20:04:42 +08:00
1 parent 0e34d82a06
commit e67490e768
8 files changed
+256 -20

No files matched your search

+8
View File
@@ -85,6 +85,9 @@ func (c *controller) startEvents(client *ocapi.Client) {
}
ctx, cancel := context.WithCancel(context.Background())
c.cancelSSE = cancel
// A stream that reconnects lost events; a fresh connection (the one
// made when connecting) is the list's first read, not a gap.
wasDown := false
sub := ocapi.Subscription{
Types: eventTypes,
OnEvent: func(ev ocapi.Event) {
@@ -98,6 +101,7 @@ func (c *controller) startEvents(client *ocapi.Client) {
OnState: func(st ocapi.SubscriptionState, err error) {
switch st {
case ocapi.Disconnected:
wasDown = true
ui.Post(func() {
if c.client != client {
return
@@ -105,6 +109,10 @@ func (c *controller) startEvents(client *ocapi.Client) {
c.status.Set("连接中断,正在重连…")
})
case ocapi.Subscribed:
if !wasDown {
return
}
wasDown = false
// Events missed while the stream was down are gone;
// re-read the list and the open chat's tail.
ui.Post(func() {