From 605f7cecb2b2af44f57573e16f464e24f54310ae Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 5 Jul 2023 20:06:27 -0300 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=90=9B=20fix(chat.py):=20handle=20cas?= =?UTF-8?q?e=20when=20artifacts=20is=20empty=20to=20prevent=20potential=20?= =?UTF-8?q?error=20The=20code=20now=20handles=20the=20case=20when=20the=20?= =?UTF-8?q?`artifacts`=20variable=20is=20empty=20by=20setting=20`input=5Fk?= =?UTF-8?q?eys=5Fresponse`=20to=20an=20empty=20dictionary.=20This=20preven?= =?UTF-8?q?ts=20potential=20errors=20that=20could=20occur=20when=20trying?= =?UTF-8?q?=20to=20build=20the=20`input=5Fkeys=5Fresponse`=20object.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/api/v1/chat.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/backend/langflow/api/v1/chat.py b/src/backend/langflow/api/v1/chat.py index 2423d1431..164dd2dd5 100644 --- a/src/backend/langflow/api/v1/chat.py +++ b/src/backend/langflow/api/v1/chat.py @@ -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 From f84cd4026aa1a0651b7bbdf338599b23a1b08cd3 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 5 Jul 2023 20:09:11 -0300 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=90=9B=20fix(validate.py):=20set=20th?= =?UTF-8?q?e=20value=20of=20the=20template=20field=20to=20an=20empty=20str?= =?UTF-8?q?ing=20The=20value=20of=20the=20template=20field=20is=20now=20se?= =?UTF-8?q?t=20to=20an=20empty=20string=20to=20ensure=20consistency=20and?= =?UTF-8?q?=20avoid=20potential=20issues=20with=20undefined=20values.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/api/v1/validate.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/backend/langflow/api/v1/validate.py b/src/backend/langflow/api/v1/validate.py index aa3748785..2a5bdd673 100644 --- a/src/backend/langflow/api/v1/validate.py +++ b/src/backend/langflow/api/v1/validate.py @@ -73,12 +73,14 @@ def add_new_variables_to_template(input_variables, prompt_request): advanced=False, multiline=True, input_types=["Document", "BaseOutputParser"], + value="", # Set the value to empty string ) if variable in prompt_request.frontend_node.template: # Set the new field with the old value template_field.value = prompt_request.frontend_node.template[variable][ "value" ] + prompt_request.frontend_node.template[variable] = template_field.to_dict() # Check if variable is not already in the list before appending From a8900c429d594197de1295b0c76c7f4636329dd4 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 5 Jul 2023 20:35:39 -0300 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=94=A7=20chore(base.py):=20improve=20?= =?UTF-8?q?the=20representation=20of=20the=20built=20object=20in=20the=20V?= =?UTF-8?q?ertex=20class=20The=20representation=20of=20the=20built=20objec?= =?UTF-8?q?t=20in=20the=20Vertex=20class=20has=20been=20improved=20to=20pr?= =?UTF-8?q?ovide=20more=20meaningful=20information.=20Instead=20of=20retur?= =?UTF-8?q?ning=20the=20actual=20object=20representation,=20it=20now=20ret?= =?UTF-8?q?urns=20"Built=20successfully"=20if=20the=20object=20has=20been?= =?UTF-8?q?=20built,=20or=20"Not=20built=20yet"=20if=20the=20object=20has?= =?UTF-8?q?=20not=20been=20built=20yet.=20This=20change=20enhances=20the?= =?UTF-8?q?=20clarity=20and=20readability=20of=20the=20code.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/graph/vertex/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/langflow/graph/vertex/base.py b/src/backend/langflow/graph/vertex/base.py index ab3abec46..67fd4e005 100644 --- a/src/backend/langflow/graph/vertex/base.py +++ b/src/backend/langflow/graph/vertex/base.py @@ -226,4 +226,4 @@ class Vertex: return id(self) def _built_object_repr(self): - return repr(self._built_object) + return "Built sucessfully" if self._built_object else "Not built yet"