Ask several questions on one card
One `ask_user` call can now carry several questions, and they come back in a single submit. Asking one at a time cost a round trip and an interruption each, and by the third you had forgotten the first. Each question becomes an item with its own key; several items share a call index, because they belong to one call and one tool turn has to answer them all. Each answer is quoted beside the question it belongs to -- with four on a card, a bare list would leave the model matching them up by position and sometimes getting it wrong. Options are radios rather than submit buttons, so picking one does not send the form while two other questions are still blank. What you type beats what you picked: someone who writes in the box after clicking an option meant the writing. `_questions_in` also reads the shapes a small model actually sends -- a bare `question` string, a list of plain strings, one object where a list belonged. Getting that wrong costs a whole round trip and shows a card saying nothing. Two test fixes, both mine. `test_posting_a_message_stores_both_turns` raced the background generation it started: against a connection that refuses instantly the reply sometimes won, writing the error and marking the row complete before the assertions could read it. And the generation registry is module-global, so a test that started a reply left an entry -- and a Task belonging to a closed event loop -- for the rest of the session. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -411,8 +411,53 @@
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.06em;
|
||||
}
|
||||
.interaction__item { display: flex; flex-direction: column; gap: var(--sp-2); }
|
||||
.interaction__title { margin: 0; color: var(--ink); font-weight: 500; }
|
||||
.interaction__form { display: flex; flex-direction: column; gap: var(--sp-4); }
|
||||
/* One block per question. Several go on one card and submit together. */
|
||||
.interaction__question {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--sp-2);
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
min-width: 0;
|
||||
}
|
||||
.interaction__question + .interaction__question {
|
||||
padding-top: var(--sp-4);
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
.interaction__title { margin: 0; padding: 0; color: var(--ink); font-weight: 500; }
|
||||
.interaction__options { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
|
||||
.interaction__note { color: var(--ink-faint); font-size: var(--text-xs); }
|
||||
|
||||
/* An option. A radio, so picking one unpicks the last, but shaped like the
|
||||
button it reads as. */
|
||||
.chip { position: relative; display: inline-flex; }
|
||||
.chip input {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
opacity: 0;
|
||||
cursor: pointer;
|
||||
margin: 0;
|
||||
}
|
||||
.chip span {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-height: var(--control-h);
|
||||
padding: 0 var(--sp-3);
|
||||
border: 1px solid var(--border-strong);
|
||||
border-radius: var(--radius-sm);
|
||||
background: var(--surface-raised);
|
||||
color: var(--ink-muted);
|
||||
font-size: var(--text-sm);
|
||||
}
|
||||
.chip input:hover + span { background: var(--surface-hover); color: var(--ink); }
|
||||
.chip input:checked + span {
|
||||
border-color: var(--accent);
|
||||
background: var(--surface-active);
|
||||
color: var(--ink);
|
||||
}
|
||||
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
|
||||
.interaction__detail {
|
||||
margin: 0;
|
||||
padding: var(--sp-3);
|
||||
|
||||
Reference in New Issue
Block a user