Repository navigation
Widget: OSAChatWidget.seed, smooth open and dock, bottom-right Move to corner icon - #732
Conversation
… chat
seed(text, {mode}?) sends nothing: the text is the assistant's first message
(marked seeded), the window opens in the mode, and the reader's first send
carries it as prior_turns. A seeded chat counts as a chat with content in
History, trimming, retiring and the empty-chat checks; the reply gets no
thumbs row. Tested in happy-dom (new test-widget-seed.js, wired into CI;
test-widget-reseed.js extended).
… model (#730) Server side of OSAChatWidget.seed: prior_turns of one assistant turn for an unknown session returns 200, the model sees one user message with the text and the researcher message, and the stored history is [human, ai]. No src/ change needed. Tested: tests/test_api/test_reseed.py passes.
Keyframe animations on the opened state (scrim fade-in, window fade and scale from 0.98) and after a dock (corner window fade-in, scrim fade-out under a class a 150 ms timer removes). State changes (inert, scroll lock, focus, events) are immediate and nothing waits for an animation event. All off in the reduced-motion block. Tested: test-widget-seed.js (durations, reduced motion, no animationend or transitionend, timer cleanup); the host-api tests pass unchanged.
ICONS.dock is now an arrow to the bottom right (M7 7l10 10, M17 7v10H7) in the same 24x24 stroke svg, drawn at the header icons' 18 px. Label and title stay 'Move to corner'. Tested: test-widget-seed.js checks the paths, view box, size, aria-label and title.
The 120 ms open scales the window from 98%, so a size read in the first frames was 2% short (60 px field read 58.8). center-stage-check.mjs and privacy-choices-check.mjs now wait for finite animations before each read, and not on a call that carries a user gesture. Tested in Chrome: both harnesses pass.
Preview Deployment
This preview will be updated automatically when you push new commits. |
…eck the dock fade starts in real Chrome (tested: center-stage and privacy-choices checks pass)
…pen; count a seeded chat as content on context switch and return; trim before the seed length limit; pop-out and context tests; docs tidy (tested: widget suites, hygiene tests)
|
Review round 1, outcomes (fix commits 7095b39 and 80d85b3 on this branch):
Tests run: all |
…-wrap widget comments (comment and doc text only; not run)
|
Review round 2 outcomes:
|
|
Verdict: ready and merged. Every acceptance criterion is covered by the diff and tests (seed tests wired into frontend-tests, reseed test extended, motion and icon tests, TestASeededOpeningReply, docs and changelog), both review rounds have outcomes, and all checks passed on the head (Lint, Test 3.11 and 3.12, Frontend Tests). The PR says Refs #730, so #730 stays open for the check on test.nemar.org. |
Summary
Three changes to
frontend/osa-chat-widget.jsfor the NEMAR website (nemarOrg/website#525), which will callOSAChatWidget.seed(text, {mode: 'center'})and feature-detect it.OSAChatWidget.seed(text, {mode}?): puts the text at the head of the chat as the assistant's first message (seeded: true, replacing the greeting) and opens the window inmode. It sends nothing: no request, nosendevent, no Turnstile token. Validated likeask()(non-empty string, at mostRESEED_TURN_MAX_CHARS,modeOption), queued beforeinit(), refused while a reply loads. A chat with no reader message is reused; one with a reader message stays in History and a new chat opens.selectReseedTurnskeeps a seeded message (still pure), so the reader's first send carriesprior_turns: [{role: "assistant", text}]with noexpect_session.chatIsEmpty()replaces everymessages.length <= 1empty-chat test (start screen, reset button, suggestions,setConfig's greeting,resetChat).hasUserMessage,trimConversationsandretireActiveConversationcount a seeded chat as content,conversationTitlefalls back to the seeded text,normalizePersistedMessagekeeps the mark across a reload, and the seeded reply has no thumbs row.closingclass). State changes stay immediate; the cosmetic classes are removed by a 150 mssetTimeout, nothing listens foranimationendortransitionend; all off in the one reduced-motion block.ICONS.dockis an arrow to the bottom right (M7 7l10 10,M17 7v10H7); label and title stay "Move to corner".Server: no
src/change.TestASeededOpeningReplyintests/test_api/test_reseed.pyshows an assistant-onlyprior_turnsfor an unknown session is accepted and reaches the model as one user message.The two Chrome harnesses that measure the dialog (
center-stage-check.mjs,privacy-choices-check.mjs) now wait for finite animations before each read, since the open scales the window from 98%.After merge the maintainer checks it on test.nemar.org; the issue stays open until then.
Refs #730
Commands run
bun frontend/test-widget-seed.js: 129 passed, 0 failed (new, wired into the frontend-tests job)bun frontend/test-widget-host-api.js: 243 passed, 0 failed (unchanged)bun frontend/test-widget-reseed.js: 67 passed, 0 failed (extended)bun frontend/test-widget-session-lost.js: 79 passed;test-widget-host-styles.js: 39 passed;test-widget-history-panel.js: 200 passedfrontend/test-widget-*.js,test-markdown.js,test-citation-markers.js,test-streaming.js: passbun scripts/build-runtime-bundle.js --check: bundle is currentuv run pytest tests/test_api/test_reseed.py tests/test_frontend/ --no-cov: all passed (57 in test_reseed.py, 174 in test_frontend)uv run ruff check .anduv run ruff format --check .: cleanbun frontend/browser-harness/center-stage-check.mjsandprivacy-choices-check.mjsin Chrome: pass