Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
coderai
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexlab
coderai
Commits
e4cb426b
Commit
e4cb426b
authored
Mar 01, 2026
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix thinking display to update on every chunk and fix timer thread
parent
bcd150e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
12 deletions
+16
-12
coder
coder
+16
-12
No files found.
coder
View file @
e4cb426b
...
@@ -467,19 +467,22 @@ class CoderClient:
...
@@ -467,19 +467,22 @@ class CoderClient:
def
update_timer
():
def
update_timer
():
"""Background thread to update timer every second."""
"""Background thread to update timer every second."""
nonlocal
last_elapsed
while
not
stop_timer
.
is_set
():
while
not
stop_timer
.
is_set
():
if
in_thinking
:
if
in_thinking
:
current_time
=
time
.
time
()
current_time
=
time
.
time
()
elapsed
=
int
(
current_time
-
thinking_start_time
)
elapsed
=
int
(
current_time
-
thinking_start_time
)
if
elapsed
!=
last_elapsed
:
print_thinking_line
(
elapsed
,
thinking_content
,
timer_update
=
True
)
last_elapsed
=
elapsed
print_thinking_line
(
elapsed
,
thinking_content
)
time
.
sleep
(
0.5
)
time
.
sleep
(
0.5
)
def
print_thinking_line
(
elapsed
,
content
,
final
=
False
):
def
print_thinking_line
(
elapsed
,
content
,
final
=
False
,
timer_update
=
False
):
"""Print or update the thinking line."""
"""Print or update the thinking line."""
nonlocal
thinking_line_printed
nonlocal
thinking_line_printed
,
last_elapsed
# Only update if elapsed changed or it's a forced update
if
timer_update
and
elapsed
==
last_elapsed
:
return
last_elapsed
=
elapsed
# Filter out <tool> and <tool_call> tags and newlines for display
# Filter out <tool> and <tool_call> tags and newlines for display
display_content
=
re
.
sub
(
r'<tool[^>]*>.*?</tool>'
,
''
,
content
,
flags
=
re
.
DOTALL
)
display_content
=
re
.
sub
(
r'<tool[^>]*>.*?</tool>'
,
''
,
content
,
flags
=
re
.
DOTALL
)
display_content
=
re
.
sub
(
r'<tool_call[^>]*>.*?</tool_call>'
,
''
,
display_content
,
flags
=
re
.
DOTALL
)
display_content
=
re
.
sub
(
r'<tool_call[^>]*>.*?</tool_call>'
,
''
,
display_content
,
flags
=
re
.
DOTALL
)
...
@@ -571,8 +574,11 @@ class CoderClient:
...
@@ -571,8 +574,11 @@ class CoderClient:
think_part
=
parts
[
0
]
think_part
=
parts
[
0
]
if
think_part
:
if
think_part
:
thinking_content
+=
think_part
thinking_content
+=
think_part
# Update display one last time
elapsed
=
int
(
time
.
time
()
-
thinking_start_time
)
print_thinking_line
(
elapsed
,
thinking_content
)
# Show final thinking line
# Show final thinking line
with newline
elapsed
=
int
(
time
.
time
()
-
thinking_start_time
)
elapsed
=
int
(
time
.
time
()
-
thinking_start_time
)
print_thinking_line
(
elapsed
,
thinking_content
,
final
=
True
)
print_thinking_line
(
elapsed
,
thinking_content
,
final
=
True
)
...
@@ -587,12 +593,10 @@ class CoderClient:
...
@@ -587,12 +593,10 @@ class CoderClient:
print
(
actual_content
,
end
=
''
,
flush
=
True
)
print
(
actual_content
,
end
=
''
,
flush
=
True
)
full_content
+=
actual_content
full_content
+=
actual_content
else
:
else
:
# Still thinking - accumulate
# Still thinking - accumulate
and update display immediately
thinking_content
+=
content
thinking_content
+=
content
# Update display every few chars
elapsed
=
int
(
time
.
time
()
-
thinking_start_time
)
if
len
(
thinking_content
)
%
10
==
0
:
print_thinking_line
(
elapsed
,
thinking_content
)
elapsed
=
int
(
time
.
time
()
-
thinking_start_time
)
print_thinking_line
(
elapsed
,
thinking_content
)
else
:
else
:
# Check for tool calls in normal content too
# Check for tool calls in normal content too
parsed_tools
=
parse_tool_calls_from_content
(
content
)
parsed_tools
=
parse_tool_calls_from_content
(
content
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment