Closed
Description
Confirmation
- I confirm that I am a maintainer and so can use this template. If I am not, I understand this issue will be closed and I will be asked to use a different template.
Issue body
Consider this design:
processor = StreamProcessor()
processor.add_handler(TextMessage, ...) # register a handler for `TextMessage` type.
processor.add_handler(HandoffMessage, ...) # register ad handler for the `HandoffMessage` type
stream = team.run_stream()
result = processor(stream)
We can then rewrite Console
to subclass StreamProcessor
to provide handlers for all the built-in message types and default handler for unknown message types.
Now you can customize Console
to override handling of specific message types.