feat(telegram): reasoning rides under the draft status while the turn runs
This commit is contained in:
1 parent
712c24de4e
commit
0fec15fb3b
3 files changed
+72
-10
No files matched your search
+38
-6
@@ -1228,18 +1228,50 @@ def test_progress_updates_reach_the_draft_but_hidden_reasoning_does_not() -> Non
|
||||
assert draft.status == texts.writing
|
||||
|
||||
|
||||
def test_reasoning_from_an_agent_whose_thinking_is_not_progress_stays_hidden() -> None:
|
||||
def test_reasoning_rides_under_the_status_and_never_reaches_the_text() -> None:
|
||||
draft = _progress_draft()
|
||||
texts = TelegramTexts()
|
||||
stub = SimpleNamespace(_drafts={"k": draft}, texts=texts)
|
||||
TelegramFrontend._feed_draft(
|
||||
cast("Any", stub),
|
||||
"k",
|
||||
_thinking_delta("weighing it"),
|
||||
thinking_is_progress=False,
|
||||
feed = functools.partial(
|
||||
TelegramFrontend._feed_draft, cast("Any", stub), "k", thinking_is_progress=False
|
||||
)
|
||||
|
||||
feed(_thinking_delta("weighing <it> "))
|
||||
feed(_thinking_delta("against the note"))
|
||||
assert draft.text == ""
|
||||
assert draft.status == texts.thinking
|
||||
assert draft._render() == (
|
||||
f"{texts.thinking}\n\n"
|
||||
"<blockquote>weighing <it> against the note</blockquote>",
|
||||
f"{texts.thinking}\n\nweighing <it> against the note",
|
||||
)
|
||||
|
||||
feed(
|
||||
{
|
||||
"event": {
|
||||
"type": "content_block_start",
|
||||
"index": 2,
|
||||
"content_block": {"type": "thinking"},
|
||||
}
|
||||
}
|
||||
)
|
||||
assert draft.reasoning == ""
|
||||
feed(_thinking_delta("word " * 200))
|
||||
shown = draft._render()[1].removeprefix(f"{texts.thinking}\n\n")
|
||||
assert shown.startswith("… word")
|
||||
assert len(shown) <= 402
|
||||
|
||||
feed(
|
||||
{
|
||||
"event": {
|
||||
"type": "content_block_delta",
|
||||
"index": 3,
|
||||
"delta": {"type": "text_delta", "text": "Done."},
|
||||
}
|
||||
}
|
||||
)
|
||||
assert draft.reasoning == ""
|
||||
assert draft._render()[1] == f"{texts.writing}\n\nDone."
|
||||
|
||||
|
||||
def test_a_tool_call_between_progress_updates_starts_a_new_paragraph() -> None:
|
||||
|
||||
Reference in new issue
Block a user