Revert "Revert "Fixes flows without input_keys not being runnable" (#731)"

This reverts commit 352e74cbc7, reversing
changes made to 3f531a1157.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-08-08 15:12:37 -03:00
commit b8d8ed8283
8 changed files with 113 additions and 83 deletions

View file

@ -155,7 +155,7 @@ async def stream_build(flow_id: str):
)
else:
input_keys_response = {
"input_keys": {},
"input_keys": None,
"memory_keys": [],
"handle_keys": [],
}

View file

@ -117,7 +117,7 @@ class ChatManager:
self, client_id: str, payload: Dict, langchain_object: Any
):
# Process the graph data and chat message
chat_inputs = payload.pop("inputs", "")
chat_inputs = payload.pop("inputs", {})
chat_inputs = ChatMessage(message=chat_inputs)
self.chat_history.add_message(client_id, chat_inputs)

View file

@ -21,9 +21,9 @@ async def process_graph(
# Generate result and thought
try:
if not chat_inputs.message:
if chat_inputs.message is None:
logger.debug("No message provided")
raise ValueError("No message provided")
chat_inputs.message = {}
logger.debug("Generating result and thought")
result, intermediate_steps = await get_result_and_steps(

View file

@ -171,11 +171,7 @@ def initialize_pinecone(class_object: Type[Pinecone], params: dict):
def initialize_chroma(class_object: Type[Chroma], params: dict):
"""Initialize a ChromaDB object from the params"""
if ( # type: ignore
"chroma_server_host" in params
or "chroma_server_http_port" in params
or "chroma_server_ssl_enabled" in params
or "chroma_server_grpc_port" in params
or "chroma_server_cors_allow_origins" in params
"chroma_server_host" in params or "chroma_server_http_port" in params
):
import chromadb # type: ignore
@ -186,6 +182,14 @@ def initialize_chroma(class_object: Type[Chroma], params: dict):
}
chroma_settings = chromadb.config.Settings(**settings_params)
params["client_settings"] = chroma_settings
else:
# remove all chroma_server_ keys from params
params = {
key: value
for key, value in params.items()
if not key.startswith("chroma_server_")
}
persist = params.pop("persist", False)
if not docs_in_params(params):
params.pop("documents", None)