mirror of
https://github.com/NCBM/plyngent.git
synced 2026-07-23 22:44:59 +08:00
core/cli: update display and state for streaming, error, cancel events
This commit is contained in:
@@ -96,10 +96,10 @@ async def test_run_chat_loop_text_only() -> None:
|
||||
]
|
||||
)
|
||||
messages: list[AnyChatMessage] = [UserChatMessage(content="hi")]
|
||||
events = [e async for e in run_chat_loop(client, messages, model="m")]
|
||||
assert isinstance(events[0], AssistantMessageEvent)
|
||||
assert isinstance(events[1], TextDeltaEvent)
|
||||
assert events[1].content == "hello"
|
||||
events = [e async for e in run_chat_loop(client, messages, model="m", stream=False)]
|
||||
assert isinstance(events[0], TextDeltaEvent)
|
||||
assert events[0].content == "hello"
|
||||
assert isinstance(events[1], AssistantMessageEvent)
|
||||
assert len(messages) == 2 # noqa: PLR2004
|
||||
assert len(client.calls) == 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user