Skip to content

emrg: GUI session history on-demand loading (rant 2026-08-13T14:15:12 front-end) - #739

Merged
argszero merged 1 commit into
masterfrom
feature/gui-history-pagination
Aug 13, 2026
Merged

emrg: GUI session history on-demand loading (rant 2026-08-13T14:15:12 front-end)#739
argszero merged 1 commit into
masterfrom
feature/gui-history-pagination

Conversation

@argszero

Copy link
Copy Markdown
Owner

Front-end of GUI session-history on-demand loading (host rant 2026-08-13T14:15:12); backend pagination landed in #737.

  • emrg/gui/main.js emrg:listHistory: passes optional limit/offset through to the daemon, returns hasMore.
  • emrg/gui/renderer/js/app.js: on non-silent switchSession loads the most recent 50 messages (read-only user bubbles, Chat.addHistoryMessage); per-session historyPages state (offset/hasMore/loading); scrolling the session view to the top loads an older page (prepend + scroll-position compensation, 150ms debounce); load bar shows ↑ 加载更早消息没有更多历史.
  • emrg/gui/renderer/js/chat.js: addHistoryMessage (read-only, prepend-aware) + setLoadBar (top bar element).
  • emrg/gui/renderer/css/components.css: .msg.user.history (dimmed) + .history-load-bar styles.
  • emrg/gui/renderer/js/i18n.js: zh/en keys app.historyLoadMore/historyLoading/historyNoMore.
  • test/renderer.smoke.test.js: +1 smoke test (switch loads page 1 + load bar; scroll-to-top loads page 2 with offset=loaded; prepend keeps count). GUI 231→232 (renderer smoke 109→110); Agent.md synced.

/rewind list stays full-list (no limit passed) — no regression.

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

✅ LGTM — cycle (1/3)

Reviewed the GUI front-end for #737's backend pagination:

  • main.js: optional limit/offset passed through to the daemon, has_morehasMore — matches the list_history protocol from #737.
  • app.js: per-session page state (offset/hasMore/loading), loadHistory on non-silent switch (50 newest), loadOlderHistory prepends with scroll-position compensation (delta scrollTop + (scrollHeight - prevHeight)), debounced scroll-to-top trigger (150ms, passive), load-bar states (load-more / no-more), error fallback to a system message.
  • chat.js: addHistoryMessage reuses the user-bubble style + .history dimming; prepend anchors after the load bar (scroll position preserved); App.updateEmptyState?.() consistent with existing patterns.
  • i18n zh/en both added; CSS dims history bubbles (visual distinction from live messages).
  • Smoke test is discriminative: asserts limit=50/offset=0, 2 bubbles rendered, load bar shown, scroll→second call offset=已加载数, prepend → 3 bubbles, no-more state.
  • Verified locally: cd emrg/gui && npm test232 pass / 0 fail; Agent.md GUI counts synced (231→232, 109→110 renderer smoke); CI test + test-windows PASS (31674780319).

Non-blocking nit: app.historyLoading i18n key is currently unused (no visible loading state while fetching) — fine to keep for a future spinner.

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

✅ LGTM — cycle. CI test + test-windows both pass (run 31674780319); 773 pytest + 232 GUI tests green locally (renderer smoke +1: switch loads page-1 history + load bar; scroll-to-top prepends page-2 with offset=loaded); emrg:listHistory passes limit/offset through; Agent.md GUI count synced 231→232.

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

✅ LGTM — cycle (3/3)

Re-verified against current master d855ef6: diff unchanged (f02982d), mergeStateStatus CLEAN, CI test + test-windows PASS (run 31674780319). GUI pagination front-end for #737 — per-session page state, scroll-to-top prepend with position compensation, read-only history bubbles, zh/en i18n, discriminative smoke test. Three consecutive ✅ from different cycles with no ❌ in between — merging.

@argszero
argszero merged commit 0cc5b8f into master Aug 13, 2026
2 checks passed
argszero pushed a commit to pm25coder/emrg that referenced this pull request Aug 13, 2026
pm25coder pushed a commit to pm25coder/emrg that referenced this pull request Aug 13, 2026
argszero pushed a commit that referenced this pull request Aug 13, 2026
Co-authored-by: EMRG Evolution <emrg@argszero.dev>
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