Skip to content

Commit 353afa7

Browse files
authored
enhance(cli, query): update reasoning progress display (#368)
Improve the user experience when a model provides reasoning by showing incremental progress. When using the `progress` display mode, the CLI now prints "reasoning..." at the start and appends a dot for each subsequent reasoning chunk received from the model. This provides visual feedback that the model is still processing the request during longer reasoning phases. --------- Signed-off-by: Jean Mertz <[email protected]>
1 parent ccdbca9 commit 353afa7

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

crates/jp_cli/src/cmd/query/event.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,15 @@ impl StreamEventHandler {
4343
ChatResponse::Reasoning { ref reasoning } if !reasoning.is_empty() => {
4444
let mut display = match reasoning_display {
4545
ReasoningDisplayConfig::Summary => todo!(),
46-
ReasoningDisplayConfig::Static if self.reasoning_tokens.is_empty() => {
47-
Some("_reasoning..._".to_owned())
46+
ReasoningDisplayConfig::Static | ReasoningDisplayConfig::Progress
47+
if self.reasoning_tokens.is_empty() =>
48+
{
49+
Some("reasoning...".to_owned())
4850
}
51+
// For progress display, we start with `reasoning...` and then
52+
// append a dot for each new reasoning chunk, to indicate
53+
// that the reasoning is still ongoing.
54+
ReasoningDisplayConfig::Progress => Some(".".to_owned()),
4955
ReasoningDisplayConfig::Full => Some(reasoning.clone()),
5056
ReasoningDisplayConfig::Truncate(TruncateChars { characters }) => {
5157
let remaining =

crates/jp_config/src/style/reasoning.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ pub enum ReasoningDisplayConfig {
7676
/// reasoning.
7777
Static,
7878

79+
/// Similar to `Static`, but additional dots are added to indicate that the
80+
/// assistant is still reasoning.
81+
Progress,
82+
7983
/// Reasoning content is displayed as it is generated.
8084
#[default]
8185
Full,

0 commit comments

Comments
 (0)