DeepSeek R1 think formatter
functionSimple formatter that transforms <think> labels into collapsible "💠Thought for X seconds" panels.
deepseek_r1_think_formatter.py
Python · 27 lines13class Filter:14 def inlet(self, body, **kwargs):15 self.start = time()16 return body17 18 async def outlet(self, body, **kwargs):19 body["messages"][-1]["content"] = (20 body["messages"][-1]["content"]21 .replace(22 "<think>",23 f"<details>\n<summary>💠Thought for {int(time() - self.start)} seconds</summary>",24 ) Simple formatter that transforms labels into collapsible "💠Thought for X seconds" panels.
0
0 Simple formatter that transforms labels into collapsible "💠Thought for X seconds" panels.
0
0 
