mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 17:55:01 +00:00
refactor: Implement reasoning removal with regex in base_coder
This commit is contained in:
parent
d434f8641d
commit
8d2159761f
1 changed files with 5 additions and 3 deletions
|
@ -1884,9 +1884,11 @@ class Coder:
|
|||
new = new.rstrip()
|
||||
|
||||
res = cur + new
|
||||
# if self.main_model.remove_reasoning, then use that string. say it's "think"
|
||||
# then use a regex to remove "<think>.*</think>" from the res
|
||||
# the text may span many lines. ai!
|
||||
|
||||
if self.main_model.remove_reasoning:
|
||||
import re
|
||||
pattern = f"<{self.main_model.remove_reasoning}>.*?</{self.main_model.remove_reasoning}>"
|
||||
res = re.sub(pattern, "", res, flags=re.DOTALL)
|
||||
|
||||
return res
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue