Merge branch 'modalRefactor' into python_custom_node_component

This commit is contained in:
Lucas Oliveira 2023-07-23 19:50:51 -03:00
commit b6ee0ff800
20 changed files with 655 additions and 334 deletions

View file

@ -134,6 +134,7 @@ async def stream_build(flow_id: str):
# to set the input_keys values
artifacts.update(vertex.artifacts)
except Exception as exc:
logger.exception(exc)
params = str(exc)
valid = False
flow_data_store[flow_id]["status"] = BuildStatus.FAILURE

View file

@ -176,6 +176,8 @@ class Vertex:
for node in nodes:
built = node.build()
if isinstance(built, list):
if key not in self.params:
self.params[key] = []
self.params[key].extend(built)
else:
self.params[key].append(built)

View file

@ -64,15 +64,20 @@ def setup_static_files(app: FastAPI, static_files_dir: Path):
return FileResponse(path)
# app = create_app()
# setup_static_files(app, static_files_dir)
def get_static_files_dir():
"""Get the static files directory relative to Langflow's main.py file."""
frontend_path = Path(__file__).parent
return frontend_path / "frontend"
def setup_app(static_files_dir: Optional[Path] = None) -> FastAPI:
"""Setup the FastAPI app."""
# get the directory of the current file
if not static_files_dir:
frontend_path = Path(__file__).parent
static_files_dir = frontend_path / "frontend"
static_files_dir = get_static_files_dir()
if not static_files_dir or not static_files_dir.exists():
raise RuntimeError(f"Static files directory {static_files_dir} does not exist.")
app = create_app()
setup_static_files(app, static_files_dir)
return app

View file

@ -15,6 +15,7 @@ class TextSplittersFrontendNode(FrontendNode):
required=True,
show=True,
name="documents",
is_list=True,
)
)
name = "separator"

View file

@ -259,7 +259,7 @@ class VectorStoreFrontendNode(FrontendNode):
field.required = False
field.show = True
field.advanced = False
field.is_list = True
elif "embedding" in field.name:
# for backwards compatibility
field.name = "embedding"