refactor: Simplify agent input text content construction (#5344)
* refactor: Simplify agent input text content construction * Change HUMAN to Input --------- Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
This commit is contained in:
parent
68c36c415e
commit
243055e1cd
1 changed files with 1 additions and 9 deletions
|
|
@ -25,16 +25,8 @@ class InputDict(TypedDict):
|
|||
|
||||
|
||||
def _build_agent_input_text_content(agent_input_dict: InputDict) -> str:
|
||||
chat_history = agent_input_dict.get("chat_history", [])
|
||||
messages = [
|
||||
f"**{message.type.upper()}**: {message.content}"
|
||||
for message in chat_history
|
||||
if isinstance(message, BaseMessage) and message.content
|
||||
]
|
||||
final_input = agent_input_dict.get("input", "")
|
||||
if messages and final_input not in messages[-1]:
|
||||
messages.append(f"**HUMAN**: {final_input}")
|
||||
return " \n".join(messages)
|
||||
return f"**Input**: {final_input}"
|
||||
|
||||
|
||||
def _calculate_duration(start_time: float) -> int:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue