Skip to content

Instantly share code, notes, and snippets.

@wullemsb
Last active May 30, 2026 12:27
Show Gist options
  • Select an option

  • Save wullemsb/c0f3f9d4519a31ecc41603c480699df5 to your computer and use it in GitHub Desktop.

Select an option

Save wullemsb/c0f3f9d4519a31ecc41603c480699df5 to your computer and use it in GitHub Desktop.
IDisposable? subscription = null;
subscription = session.On(evt =>
{
switch (evt)
{
case AssistantMessageDeltaEvent delta
when !string.IsNullOrEmpty(delta.Data?.DeltaContent):
channel.Writer.TryWrite(delta.Data.DeltaContent);
break;
case SessionIdleEvent:
channel.Writer.TryComplete();
subscription?.Dispose();
break;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment