mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 14:25:00 +00:00
refactor: Simplify reasoning content handling in stream processing
This commit is contained in:
parent
a37d6e86df
commit
a15d10ea1e
2 changed files with 11 additions and 14 deletions
|
@ -1778,31 +1778,27 @@ class Coder:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
text = ""
|
text = ""
|
||||||
|
dump(chunk)
|
||||||
try:
|
try:
|
||||||
reasoning_content = chunk.choices[0].delta.reasoning_content
|
reasoning_content = chunk.choices[0].delta.reasoning_content
|
||||||
if reasoning_content:
|
|
||||||
if not self.got_reasoning_content:
|
|
||||||
text += f"<{self.reasoning_tag_name}>\n\n"
|
|
||||||
text += reasoning_content
|
|
||||||
self.got_reasoning_content = True
|
|
||||||
received_content = True
|
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
try:
|
try:
|
||||||
reasoning_content = chunk.choices[0].delta.reasoning
|
reasoning_content = chunk.choices[0].delta.reasoning
|
||||||
|
except AttributeError:
|
||||||
|
reasoning_content = None
|
||||||
|
|
||||||
if reasoning_content:
|
if reasoning_content:
|
||||||
if not self.got_reasoning_content:
|
if not self.got_reasoning_content:
|
||||||
text += f"<{self.reasoning_tag_name}>\n\n"
|
text += f"<{REASONING_TAG}>\n\n"
|
||||||
text += reasoning_content
|
text += reasoning_content
|
||||||
self.got_reasoning_content = True
|
self.got_reasoning_content = True
|
||||||
received_content = True
|
received_content = True
|
||||||
except AttributeError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
content = chunk.choices[0].delta.content
|
content = chunk.choices[0].delta.content
|
||||||
if content:
|
if content:
|
||||||
if self.got_reasoning_content and not self.ended_reasoning_content:
|
if self.got_reasoning_content and not self.ended_reasoning_content:
|
||||||
text += f"\n\n</{REASONING_TAG}>\n\n"
|
text += f"\n\n</{self.reasoning_tag_name}>\n\n"
|
||||||
self.ended_reasoning_content = True
|
self.ended_reasoning_content = True
|
||||||
|
|
||||||
text += content
|
text += content
|
||||||
|
|
|
@ -547,6 +547,7 @@
|
||||||
examples_as_sys_msg: true
|
examples_as_sys_msg: true
|
||||||
extra_params:
|
extra_params:
|
||||||
max_tokens: 8192
|
max_tokens: 8192
|
||||||
|
include_reasoning: true
|
||||||
caches_by_default: true
|
caches_by_default: true
|
||||||
use_temperature: false
|
use_temperature: false
|
||||||
editor_model_name: openrouter/deepseek/deepseek-chat
|
editor_model_name: openrouter/deepseek/deepseek-chat
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue