🔧 chore(chat.py): reset chat history when building a flow to ensure a clean state
The chat history is now reset when building a flow to ensure that the chat starts with a clean state. This helps prevent any potential issues or conflicts that may arise from previous chat interactions.
This commit is contained in:
parent
a0919cb649
commit
c9bb88933b
1 changed files with 2 additions and 0 deletions
|
|
@ -128,6 +128,8 @@ async def stream_build(flow_id: str):
|
|||
yield str(StreamData(event="message", data=input_keys_response))
|
||||
|
||||
chat_manager.set_cache(flow_id, langchain_object)
|
||||
# We need to reset the chat history
|
||||
chat_manager.chat_history.empty_history(flow_id)
|
||||
except Exception as exc:
|
||||
logger.error("Error while building the flow: %s", exc)
|
||||
yield str(StreamData(event="error", data={"error": str(exc)}))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue