Skip to content
Snippets Groups Projects
Commit ccd8b6ef authored by Stephen D's avatar Stephen D
Browse files

fixes

parent cd99288b
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
...@@ -28,16 +28,16 @@ file.write("Word: #{word}\n") ...@@ -28,16 +28,16 @@ file.write("Word: #{word}\n")
Thread.new do Thread.new do
cur_line = '' cur_line = ''
is_thinking = false thinks = nil
while c = stdout.getc while c = stdout.getc
file.write(c) file.write(c)
file.flush() file.flush()
if c == "\n" if c == "\n"
if cur_line.include?('<think>') if cur_line.include?('<think>')
is_thinking = true thinks = 0
elsif cur_line.include?('</think>') elsif cur_line.include?('</think>')
is_thinking = false thinks = nil
puts "</think>" # now we have 2 newlines puts "\n</think>" # now we have 2 newlines
end end
cur_line = '' cur_line = ''
...@@ -45,14 +45,13 @@ Thread.new do ...@@ -45,14 +45,13 @@ Thread.new do
cur_line += c cur_line += c
end end
if is_thinking if thinks.nil?
if c == ' '
print 'think '
elsif c == "\n"
puts
end
else
print c print c
else
if c == ' ' || c == "\n"
thinks += 1
print "\rthink x#{thinks}"
end
end end
end end
end end
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment