A chat response is formatted for a chat window, and pasting it anywhere else brings the formatting with it. Converting it into usable text is a sequence of separate operations, and doing them in the wrong order makes each one harder.
The Markdown goes first. Headings, emphasis, bullet points and numbered lists are syntax, and they render as literal asterisks and hashes in any destination that does not parse Markdown: a plain-text email, a CMS field, a form, a document. Code blocks need a decision at this point rather than later, because their content must not be touched while everything around them is.
Typography goes second. Em dashes, curly quotes, ellipsis characters and the invisible spaces described elsewhere on this site all arrive with generated text and all survive copy and paste. They are the layer that makes text recognisable as machine-produced regardless of what it says, and removing them changes the encoding rather than the meaning.
Structural residue goes third and is the part people forget. Numbered lists that were meaningful in a chat read as arbitrary in an article. Section headings that were navigation in a long answer become clutter in a short document. Closing paragraphs that summarise what was just said add nothing to a reader who has just read it. None of this is removable by a rule; it needs reading.
What no tool can do is the voice. The phrasing patterns that mark generated text are editorial, and the only way to remove them is to rewrite the sentences. The mechanical passes are worth running first precisely because they clear the noise, and what remains is prose you can judge on its merits rather than through a layer of artefacts.
One caution: if the response contains code, extract it before cleaning. A typography pass that straightens quotes will happily convert the quotation marks inside a string literal and produce code that no longer compiles, with an error pointing at a line that looks perfectly fine.
Everything runs in the browser, which matters because the text is usually an unpublished draft.