Add model switching interruption and support for reasoning model tokens

#4
by treerats88 - opened

This update adds thread termination when swapping models and introduces clean plain-text formatting for reasoning models.

Major Changes:

  1. Instant Generation Stop: Implemented a custom StoppingCriteria linked to a global flag. Clicking "Load" now immediately terminates any active text generation thread, preventing background leaks and UI collisions when swapping models.
  2. Reasoning Model Support: Added detection and plain-text formatting for Supra-50M-Reasoning special tokens (converting <|begin_of_thought|> and <|begin_of_solution|> into clean ๐Ÿง  Thinking Process: and โœ… Final Answer: text blocks) to render properly inside the existing gr.Textbox layout.
stanley-00 changed pull request status to merged

Merged, thanks for your contribution

Sign up or log in to comment