Remove 【35†source】from Assistant Response

I have an idea of how you could do it.

A FIFO buffer of about 10 chunks.
Every new chunk, run a stripper on the contents of the buffer as a single string. A Regex needs brains to tell you the slice to be chopped out.
Under normal operations, maintaining the buffer as a string, but popping out the original chunk positions by tracking the length of all additions.

Similar is needed for your own limited markdown handler if not rewriting display, such as when you receive a markdown code block start on its own line, then tracking display write status being code (although markdown really needs a spec-compliant library that can handle AI mistakes, when output can be HTML).

Longer buffer can correspond to an amount of output you can block if you are concurrently sending the total response to moderations for particularly untrusted users.

Otherwise, you can strip the tail of your display text of them if you have UI object control. Doing it up proper is to rewrite the entirety with links when finalized.