Commit Graph

14 Commits

Author SHA1 Message Date
ZQR1101
7edddbec61 fix(web): pin chat to late-mounted quiz cards (#960)
* fix(web): pin chat to late-mounted quiz cards

QuizViewer loads after the 4s post-stream scroll window, so mastery quiz cards stay below the fold until the user scrolls. Watch [data-chat-grow] for 12s without re-pinning unrelated details expands.

Related to #955

* fix(web): extend the existing post-stream window for late viewers

The post-stream effect already existed for exactly this case — its comment
names QuizViewer — so a second, parallel MutationObserver with its own 12s
window meant two observers racing for the same pin, each unaware of the
other's deadline.

Fold the extension into that one effect: the window starts at 4s and only a
*newly appearing* ``[data-chat-grow]`` node pushes it out to 12s. Gating on
appearance rather than presence matters — presence alone is satisfied
permanently by any quiz card from an earlier turn, which would have re-pinned
the user on every later DOM mutation, the precise mis-classification the
short window exists to avoid. The teardown timer follows the current
deadline, so a turn with no late viewer stops observing at 4s as before.

---------

Co-authored-by: ZQR1101 <278034003+ZQR1101@users.noreply.github.com>
Co-authored-by: Frank <bingxizhao@novix.science>
2026-08-24 16:52:00 +08:00
Hamm0101
1de795cace fix(web): settle scroll to bottom after loading chat history (#802)
* fix(web): settle scroll to bottom after loading chat history

Every message wrapper uses content-visibility: auto with
containIntrinsicSize placeholders, so the first scrollTop = scrollHeight
pin in useLayoutEffect lands on an estimated "fake bottom" before the
browser lays out real heights. Reopening a long history session could
therefore stop mid-conversation instead of at the true bottom.

- Re-arm autoscroll and re-pin with a double requestAnimationFrame after
  session load completes, once real heights are laid out
- Listen for capture-phase load events in the post-stream observer so
  lazy images that settle inside the window also re-pin to the bottom

* fix(web): re-pin only on a cold open, and describe the real mechanism

Two corrections to this branch's own fix:

- The re-arm and re-pin ran on every completed load, including the
  background revalidate of a session painted instantly from cache. A
  reader who opened a known session and scrolled up to re-read something
  got yanked to the bottom when that round trip landed. Cold opens are
  the case with a stale pin; gate on it, and check the abort signal
  inside the queued frames so a superseded load cannot move a viewport
  that now belongs to a newer session.
- The comment justified the double-rAF with ``content-visibility: auto``
  and ``containIntrinsicSize`` placeholders, which do not appear anywhere
  in web/. The heights that actually arrive late are lazily-loaded images
  and the next/dynamic capability viewers. Same for the hook's listener:
  opening a history session is not its path (that effect does not re-run
  on a session switch), the window right after a stream stops is.

---------

Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>
2026-08-12 17:06:41 +08:00
Bingxi Zhao (Frank)
308a0606f9 perf(chat): eliminate the post-stream "generating" stall
The spinner (and a frozen tab) outlived the LLM stream by seconds and
grew with conversation length:

- DONE now carries the persisted user/assistant message ids so the
  frontend reconciles its optimistic ids in place (lib/turn-reconcile)
  instead of refetching, re-normalizing, and re-rendering the whole
  session after every turn.
- The turn-event workspace mirror writes the whole batch in one append
  off the event loop instead of one synchronous open/write per event.
- PocketBase gains a batch append_turn_events that uploads in the
  background; the events.jsonl rglob flush in update_turn_status is
  gone, and add_message returns the real record id.
- The streaming autoscroll pin is mutation/load-driven instead of an
  unconditional 60fps scrollHeight read (forced layout) per frame.
2026-07-24 17:35:19 +08:00
Bingxi Zhao (Frank)
d21687f83f fix(web): release autoscroll on scrollbar/keyboard scroll-up (#649)
During streaming the rAF re-pinned to the bottom every frame, so
scrolling up via the scrollbar thumb or PageUp/Home/arrows was yanked
back (wheel/touch already released). The loop now checks whether
scrollTop dropped below what it last pinned before re-pinning; a
decrease is unambiguous user intent (overflow-anchor:none means content
growth never lowers scrollTop), so it releases instead.
2026-07-24 00:42:28 +08:00
Bingxi Zhao (Frank)
46093e5e2b update msg 2026-06-11 20:03:34 +08:00
Bingxi Zhao (Frank)
c4d47668b7 release: v1.4.2 — Gemini 2.5+ unblocked, auth ContextVar fix, smooth streaming everywhere
- Centralize Gemini 2.5/3 reasoning_effort=none in
  reasoning_params.default_reasoning_effort_for so Visualize / Chat /
  Solve / agentic loop stop returning empty bodies on those models.
- Visualize: per-capability max_tokens default (16k) seeded from
  DEFAULT_AGENTS_SETTINGS, defensive root-tag trim on SVG/HTML output,
  graceful fallback when JSON-mode review step crashes.
- Fix #485: require_auth / require_admin are async so the
  set_current_user ContextVar reaches the endpoint instead of being
  discarded by anyio.to_thread.run_sync's worker-thread context copy.
  Adds _install_current_user helper shared by HTTP + WebSocket.
- Reasoning + native-tools chat protocol: formal content stream must
  still start with FINISH/TOOL/THINK/PAUSE; tool-call deltas no longer
  force-resolve labels and implicit_think_label is ignored, so
  protocol-repair catches missing labels instead of mis-routing turns.
- Smooth streaming on every chat surface: useSmoothStreamText through
  AssistantResponse, pin-to-bottom (useLayoutEffect) on book chat +
  quiz follow-up, data-chat-scroll-root opt-in for overflow-anchor:none.
- Sidebar: collapsible Recents region with own scroll viewport,
  deterministic Lucide icon per session via SessionAvatar, Docs link
  next to GitHub footer, "New Chat" button removed (nav handles it).
- Add Lemonade local provider (port 13305) — registry entry, README
  Docker host-gateway row, providers.md docs.
- Context-window models-endpoint probe honors DISABLE_SSL_VERIFY via
  TCPConnector(ssl=False).
- README: insert v1.4.2 release row, push v1.3.10 inside "Past
  releases" fold, bump install opt-in note to v1.4.2.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-28 22:36:21 +08:00
Bingxi Zhao (Frank)
932987921b support lemonade & minor fixes 2026-05-28 17:23:09 +08:00
Bingxi Zhao (Frank)
1596807242 refactor chat capability & RAG pipeline(llamaindex) 2026-05-13 21:36:07 +08:00
Bingxi Zhao (Frank)
fba51dc856 fix: auto-update, auto-scroll to the bottom 2026-04-25 17:47:56 +08:00
Bingxi Zhao (Frank)
77f29cbcc7 fix lint 2026-04-23 19:29:16 +08:00
Bingxi Zhao (Frank)
5384224932 fix: leakage repair 2026-04-11 12:23:32 +08:00
zzhtx258
f04851e536 fix bugs, and enforce math video length 2026-03-22 19:49:14 +08:00
Bingxi Zhao (Frank)
c15e22a4b3 chore: stable fix, add tutorbot 2026-03-20 20:27:17 +08:00
Bingxi Zhao (Frank)
91197f3729 chore: deeptutor 2.0 2026-03-13 01:47:38 +08:00