Skip to content

Commit 6df9ee6

Browse files
committed
Make hidden context after cancellation more explicit
1 parent 1860286 commit 6df9ee6

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

chatkit/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ async def handle_stream_cancelled(
365365
thread_id=thread.id,
366366
created_at=datetime.now(),
367367
id=self.store.generate_item_id("sdk_hidden_context", thread, context),
368-
content="The user cancelled the stream.",
368+
content="The user cancelled the stream. Stop responding to the prior request.",
369369
),
370370
context=context,
371371
)

tests/test_chatkit_server.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,10 @@ def generate_item_id(
271271
)
272272
hidden_context_item = items.data[-1]
273273
assert hidden_context_item.type == "sdk_hidden_context"
274-
assert hidden_context_item.content == "The user cancelled the stream."
274+
assert (
275+
hidden_context_item.content
276+
== "The user cancelled the stream. Stop responding to the prior request."
277+
)
275278

276279
assistant_message_item = await server.store.load_item(
277280
thread.id, "assistant-message-pending", DEFAULT_CONTEXT
@@ -331,7 +334,10 @@ def generate_item_id(
331334
)
332335
hidden_context_item = items.data[-1]
333336
assert hidden_context_item.type == "sdk_hidden_context"
334-
assert hidden_context_item.content == "The user cancelled the stream."
337+
assert (
338+
hidden_context_item.content
339+
== "The user cancelled the stream. Stop responding to the prior request."
340+
)
335341

336342
with pytest.raises(NotFoundError):
337343
await server.store.load_item(

0 commit comments

Comments
 (0)