🐛 fix(chat.py): handle case when artifacts is empty to prevent potential error
The code now handles the case when the `artifacts` variable is empty by setting `input_keys_response` to an empty dictionary. This prevents potential errors that could occur when trying to build the `input_keys_response` object.
This commit is contained in:
parent
100419833f
commit
605f7cecb2
1 changed files with 7 additions and 1 deletions
|
|
@ -160,7 +160,13 @@ async def stream_build(flow_id: str):
|
|||
input_keys_response = build_input_keys_response(
|
||||
langchain_object, artifacts
|
||||
)
|
||||
yield str(StreamData(event="message", data=input_keys_response))
|
||||
else:
|
||||
input_keys_response = {
|
||||
"input_keys": {},
|
||||
"memory_keys": [],
|
||||
"handle_keys": [],
|
||||
}
|
||||
yield str(StreamData(event="message", data=input_keys_response))
|
||||
|
||||
chat_manager.set_cache(flow_id, langchain_object)
|
||||
# We need to reset the chat history
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue