Skip to content

Stop streaming button for chat_v2 #315

@johschmidt42

Description

@johschmidt42

Would it be possible to see a stop button added to the chat?

Reading the docs about background jobs, I came to the conclusion that we need to check if a given variable has been changed while iterating over an async iterator. But is there a better way to this?

Here's some example pseudo using httpx:

async with (
    AsyncClient() as client,
    client.stream(...) as stream,
):
    async with self:
        self.is_streaming = True

    async for line in stream.aiter_lines():
        if not self.is_streaming:
            break

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions