Fix new line bug in chat mode for agents (#23267)
This commit is contained in:
parent
f93509b114
commit
42017d82ba
|
@ -264,9 +264,7 @@ class Agent:
|
|||
"""
|
||||
prompt = self.format_prompt(task, chat_mode=True)
|
||||
result = self.generate_one(prompt, stop=["Human:", "====="])
|
||||
self.chat_history = prompt + result
|
||||
if not self.chat_history.endswith("\n"):
|
||||
self.chat_history += "\n"
|
||||
self.chat_history = prompt + result.strip() + "\n"
|
||||
explanation, code = clean_code_for_chat(result)
|
||||
|
||||
print(f"==Explanation from the agent==\n{explanation}")
|
||||
|
|
Loading…
Reference in New Issue