Skip to content

Commit

Permalink
#55 more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Oct 2, 2023
1 parent 595bcc9 commit cc78af1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/jekyll-chatgpt-translate/chatgpt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,12 @@ def translate(markdown, min: 32, window_length: 2000)
end
accum = []
until later[i].nil?
already = accum.join.split.count
if already > window_length
Jekyll.logger.debug("Already #{already} words, over the window_length of #{window_length}")
break
end
accum << later[i]
break if accum.join.split.count > window_length
i += 1
end
out << translate_pars(accum)
Expand Down
2 changes: 1 addition & 1 deletion test/test_chatgpt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def test_through_small_window
"done!\n\ndone!",
chat.translate(
"This is the first paragraph\n\nThis is second\n\nThis is third",
min: 1, window_length: 5
min: 1, window_length: 4
)
)
end
Expand Down

0 comments on commit cc78af1

Please sign in to comment.