Skip to content

Commit 3087ff7

Browse files
committed
WIP: colorizing the reasoning content
1 parent c381ea5 commit 3087ff7

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

common/console.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ namespace console {
155155
break;
156156
case error:
157157
fprintf(out, ANSI_BOLD ANSI_COLOR_RED);
158+
break;
159+
case reasoning:
160+
fprintf(out, ANSI_COLOR_BLUE);
161+
break;
158162
}
159163
current_display = display;
160164
fflush(out);

common/console.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ namespace console {
99
reset = 0,
1010
prompt,
1111
user_input,
12-
error
12+
error,
13+
reasoning
1314
};
1415

1516
void init(bool use_simple_io, bool use_advanced_display);

tools/main/main.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,8 +828,15 @@ int main(int argc, char ** argv) {
828828
if (auto * formatter = chat_add_and_format.get_partial_formatter()) {
829829
auto outputs = (*formatter)(assistant_ss.str());
830830
for (const auto & out : outputs) {
831-
LOG("%s", out.formatted.c_str());
831+
if (out.type == partial_formatter::REASONING) {
832+
console::set_display(console::reasoning);
833+
} else {
834+
console::set_display(console::reset);
835+
}
836+
fprintf(stdout, "%s", out.formatted.c_str());
837+
fflush(stdout);
832838
}
839+
console::set_display(console::reset);
833840
}
834841
}
835842

0 commit comments

Comments
 (0)