From 0f3c191ef10af3fa8108059a4a8b2d8ee5aab2c4 Mon Sep 17 00:00:00 2001 From: Teknium Date: Tue, 24 Mar 2026 19:38:17 -0700 Subject: [PATCH] fix(cli): enhance real-time reasoning output by forcing flush of long partial lines Updated the reasoning output mechanism to emit complete lines and force-flush long partial lines, ensuring reasoning is visible in real-time even without newlines. This improves user experience during reasoning sessions. --- cli.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cli.py b/cli.py index c15bd87b5b3b..9e82e03d3be4 100644 --- a/cli.py +++ b/cli.py @@ -1509,10 +1509,14 @@ class HermesCLI: self._reasoning_buf = getattr(self, "_reasoning_buf", "") + text - # Emit complete lines + # Emit complete lines, and force-flush long partial lines so + # reasoning is visible in real-time even without newlines. while "\n" in self._reasoning_buf: line, self._reasoning_buf = self._reasoning_buf.split("\n", 1) _cprint(f"{_DIM}{line}{_RST}") + if len(self._reasoning_buf) > 80: + _cprint(f"{_DIM}{self._reasoning_buf}{_RST}") + self._reasoning_buf = "" def _close_reasoning_box(self) -> None: """Close the live reasoning box if it's open."""