diff --git a/poetry.lock b/poetry.lock index add7e0732..51dd06f9b 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1565,14 +1565,14 @@ uritemplate = ">=3.0.1,<5" [[package]] name = "google-auth" -version = "2.20.0" +version = "2.21.0" description = "Google Authentication Library" category = "main" optional = false python-versions = ">=3.6" files = [ - {file = "google-auth-2.20.0.tar.gz", hash = "sha256:030af34138909ccde0fbce611afc178f1d65d32fbff281f25738b1fe1c6f3eaa"}, - {file = "google_auth-2.20.0-py2.py3-none-any.whl", hash = "sha256:23b7b0950fcda519bfb6692bf0d5289d2ea49fc143717cc7188458ec620e63fa"}, + {file = "google-auth-2.21.0.tar.gz", hash = "sha256:b28e8048e57727e7cf0e5bd8e7276b212aef476654a09511354aa82753b45c66"}, + {file = "google_auth-2.21.0-py2.py3-none-any.whl", hash = "sha256:da3f18d074fa0f5a7061d99b9af8cee3aa6189c987af7c1b07d94566b6b11268"}, ] [package.dependencies] @@ -2523,14 +2523,14 @@ i18n = ["Babel (>=2.7)"] [[package]] name = "joblib" -version = "1.2.0" +version = "1.3.0" description = "Lightweight pipelining with Python functions" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "joblib-1.2.0-py3-none-any.whl", hash = "sha256:091138ed78f800342968c523bdde947e7a305b8594b910a0fea2ab83c3c6d385"}, - {file = "joblib-1.2.0.tar.gz", hash = "sha256:e1cee4a79e4af22881164f218d4311f60074197fb707e082e803b61f6d137018"}, + {file = "joblib-1.3.0-py3-none-any.whl", hash = "sha256:172d56d4c43dd6bcd953bea213018c4084cf754963bbf54b8dae40faea716b98"}, + {file = "joblib-1.3.0.tar.gz", hash = "sha256:0b12a65dc76c530dbd790dd92881f75c40932b4254a7c8e608a868df408ca0a3"}, ] [[package]] @@ -2604,14 +2604,14 @@ testing = ["pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", [[package]] name = "langchain" -version = "0.0.215" +version = "0.0.218" description = "Building applications with LLMs through composability" category = "main" optional = false python-versions = ">=3.8.1,<4.0" files = [ - {file = "langchain-0.0.215-py3-none-any.whl", hash = "sha256:af9587c2eb317a6e33123f8a4ee8ccd8685cfab62359ea4fec52c962d9646acf"}, - {file = "langchain-0.0.215.tar.gz", hash = "sha256:a6b261f3be941eeac2d9b37fbf8996fa4279ef724f064e8c90813046126da85b"}, + {file = "langchain-0.0.218-py3-none-any.whl", hash = "sha256:c78b0bd65791b80ddf132913ce2239d4cb2dca2dde0ce20a77f36af0c12d397c"}, + {file = "langchain-0.0.218.tar.gz", hash = "sha256:85a237d5b3664bf9acc87420c813df245c03ef1a68cc2424eeb0d81e60d7a0b7"}, ] [package.dependencies] @@ -2629,13 +2629,14 @@ SQLAlchemy = ">=1.4,<3" tenacity = ">=8.1.0,<9.0.0" [package.extras] -all = ["O365 (>=2.0.26,<3.0.0)", "aleph-alpha-client (>=2.15.0,<3.0.0)", "anthropic (>=0.2.6,<0.3.0)", "arxiv (>=1.4,<2.0)", "atlassian-python-api (>=3.36.0,<4.0.0)", "awadb (>=0.3.3,<0.4.0)", "azure-ai-formrecognizer (>=3.2.1,<4.0.0)", "azure-ai-vision (>=0.11.1b1,<0.12.0)", "azure-cognitiveservices-speech (>=1.28.0,<2.0.0)", "azure-cosmos (>=4.4.0b1,<5.0.0)", "azure-identity (>=1.12.0,<2.0.0)", "beautifulsoup4 (>=4,<5)", "clarifai (==9.1.0)", "clickhouse-connect (>=0.5.14,<0.6.0)", "cohere (>=3,<4)", "deeplake (>=3.6.2,<4.0.0)", "docarray[hnswlib] (>=0.32.0,<0.33.0)", "duckduckgo-search (>=3.8.3,<4.0.0)", "elasticsearch (>=8,<9)", "faiss-cpu (>=1,<2)", "google-api-python-client (==2.70.0)", "google-auth (>=2.18.1,<3.0.0)", "google-search-results (>=2,<3)", "gptcache (>=0.1.7)", "html2text (>=2020.1.16,<2021.0.0)", "huggingface_hub (>=0,<1)", "jina (>=3.14,<4.0)", "jinja2 (>=3,<4)", "jq (>=1.4.1,<2.0.0)", "lancedb (>=0.1,<0.2)", "langkit (>=0.0.1.dev3,<0.1.0)", "lark (>=1.1.5,<2.0.0)", "lxml (>=4.9.2,<5.0.0)", "manifest-ml (>=0.0.1,<0.0.2)", "momento (>=1.5.0,<2.0.0)", "nebula3-python (>=3.4.0,<4.0.0)", "neo4j (>=5.8.1,<6.0.0)", "networkx (>=2.6.3,<3.0.0)", "nlpcloud (>=1,<2)", "nltk (>=3,<4)", "nomic (>=1.0.43,<2.0.0)", "openai (>=0,<1)", "openlm (>=0.0.5,<0.0.6)", "opensearch-py (>=2.0.0,<3.0.0)", "pdfminer-six (>=20221105,<20221106)", "pexpect (>=4.8.0,<5.0.0)", "pgvector (>=0.1.6,<0.2.0)", "pinecone-client (>=2,<3)", "pinecone-text (>=0.4.2,<0.5.0)", "psycopg2-binary (>=2.9.5,<3.0.0)", "pymongo (>=4.3.3,<5.0.0)", "pyowm (>=3.3.0,<4.0.0)", "pypdf (>=3.4.0,<4.0.0)", "pytesseract (>=0.3.10,<0.4.0)", "pyvespa (>=0.33.0,<0.34.0)", "qdrant-client (>=1.1.2,<2.0.0)", "redis (>=4,<5)", "requests-toolbelt (>=1.0.0,<2.0.0)", "sentence-transformers (>=2,<3)", "singlestoredb (>=0.7.1,<0.8.0)", "spacy (>=3,<4)", "steamship (>=2.16.9,<3.0.0)", "tensorflow-text (>=2.11.0,<3.0.0)", "tigrisdb (>=1.0.0b6,<2.0.0)", "tiktoken (>=0.3.2,<0.4.0)", "torch (>=1,<3)", "transformers (>=4,<5)", "weaviate-client (>=3,<4)", "wikipedia (>=1,<2)", "wolframalpha (==5.0.0)"] +all = ["O365 (>=2.0.26,<3.0.0)", "aleph-alpha-client (>=2.15.0,<3.0.0)", "anthropic (>=0.2.6,<0.3.0)", "arxiv (>=1.4,<2.0)", "atlassian-python-api (>=3.36.0,<4.0.0)", "awadb (>=0.3.3,<0.4.0)", "azure-ai-formrecognizer (>=3.2.1,<4.0.0)", "azure-ai-vision (>=0.11.1b1,<0.12.0)", "azure-cognitiveservices-speech (>=1.28.0,<2.0.0)", "azure-cosmos (>=4.4.0b1,<5.0.0)", "azure-identity (>=1.12.0,<2.0.0)", "beautifulsoup4 (>=4,<5)", "clarifai (==9.1.0)", "clickhouse-connect (>=0.5.14,<0.6.0)", "cohere (>=3,<4)", "deeplake (>=3.6.2,<4.0.0)", "docarray[hnswlib] (>=0.32.0,<0.33.0)", "duckduckgo-search (>=3.8.3,<4.0.0)", "elasticsearch (>=8,<9)", "esprima (>=4.0.1,<5.0.0)", "faiss-cpu (>=1,<2)", "google-api-python-client (==2.70.0)", "google-auth (>=2.18.1,<3.0.0)", "google-search-results (>=2,<3)", "gptcache (>=0.1.7)", "html2text (>=2020.1.16,<2021.0.0)", "huggingface_hub (>=0,<1)", "jina (>=3.14,<4.0)", "jinja2 (>=3,<4)", "jq (>=1.4.1,<2.0.0)", "lancedb (>=0.1,<0.2)", "langkit (>=0.0.1.dev3,<0.1.0)", "lark (>=1.1.5,<2.0.0)", "lxml (>=4.9.2,<5.0.0)", "manifest-ml (>=0.0.1,<0.0.2)", "momento (>=1.5.0,<2.0.0)", "nebula3-python (>=3.4.0,<4.0.0)", "neo4j (>=5.8.1,<6.0.0)", "networkx (>=2.6.3,<3.0.0)", "nlpcloud (>=1,<2)", "nltk (>=3,<4)", "nomic (>=1.0.43,<2.0.0)", "openai (>=0,<1)", "openlm (>=0.0.5,<0.0.6)", "opensearch-py (>=2.0.0,<3.0.0)", "pdfminer-six (>=20221105,<20221106)", "pexpect (>=4.8.0,<5.0.0)", "pgvector (>=0.1.6,<0.2.0)", "pinecone-client (>=2,<3)", "pinecone-text (>=0.4.2,<0.5.0)", "psycopg2-binary (>=2.9.5,<3.0.0)", "pymongo (>=4.3.3,<5.0.0)", "pyowm (>=3.3.0,<4.0.0)", "pypdf (>=3.4.0,<4.0.0)", "pytesseract (>=0.3.10,<0.4.0)", "pyvespa (>=0.33.0,<0.34.0)", "qdrant-client (>=1.1.2,<2.0.0)", "redis (>=4,<5)", "requests-toolbelt (>=1.0.0,<2.0.0)", "sentence-transformers (>=2,<3)", "singlestoredb (>=0.7.1,<0.8.0)", "spacy (>=3,<4)", "steamship (>=2.16.9,<3.0.0)", "tensorflow-text (>=2.11.0,<3.0.0)", "tigrisdb (>=1.0.0b6,<2.0.0)", "tiktoken (>=0.3.2,<0.4.0)", "torch (>=1,<3)", "transformers (>=4,<5)", "weaviate-client (>=3,<4)", "wikipedia (>=1,<2)", "wolframalpha (==5.0.0)"] azure = ["azure-ai-formrecognizer (>=3.2.1,<4.0.0)", "azure-ai-vision (>=0.11.1b1,<0.12.0)", "azure-cognitiveservices-speech (>=1.28.0,<2.0.0)", "azure-core (>=1.26.4,<2.0.0)", "azure-cosmos (>=4.4.0b1,<5.0.0)", "azure-identity (>=1.12.0,<2.0.0)", "azure-search-documents (==11.4.0a20230509004)", "openai (>=0,<1)"] clarifai = ["clarifai (==9.1.0)"] cohere = ["cohere (>=3,<4)"] docarray = ["docarray[hnswlib] (>=0.32.0,<0.33.0)"] embeddings = ["sentence-transformers (>=2,<3)"] -extended-testing = ["atlassian-python-api (>=3.36.0,<4.0.0)", "beautifulsoup4 (>=4,<5)", "bibtexparser (>=1.4.0,<2.0.0)", "chardet (>=5.1.0,<6.0.0)", "gql (>=3.4.1,<4.0.0)", "html2text (>=2020.1.16,<2021.0.0)", "jq (>=1.4.1,<2.0.0)", "lxml (>=4.9.2,<5.0.0)", "openai (>=0,<1)", "pandas (>=2.0.1,<3.0.0)", "pdfminer-six (>=20221105,<20221106)", "pgvector (>=0.1.6,<0.2.0)", "psychicapi (>=0.5,<0.6)", "py-trello (>=0.19.0,<0.20.0)", "pymupdf (>=1.22.3,<2.0.0)", "pypdf (>=3.4.0,<4.0.0)", "pypdfium2 (>=4.10.0,<5.0.0)", "pyspark (>=3.4.0,<4.0.0)", "requests-toolbelt (>=1.0.0,<2.0.0)", "scikit-learn (>=1.2.2,<2.0.0)", "streamlit (>=1.18.0,<2.0.0)", "telethon (>=1.28.5,<2.0.0)", "tqdm (>=4.48.0)", "zep-python (>=0.31)"] +extended-testing = ["atlassian-python-api (>=3.36.0,<4.0.0)", "beautifulsoup4 (>=4,<5)", "bibtexparser (>=1.4.0,<2.0.0)", "chardet (>=5.1.0,<6.0.0)", "esprima (>=4.0.1,<5.0.0)", "gql (>=3.4.1,<4.0.0)", "html2text (>=2020.1.16,<2021.0.0)", "jq (>=1.4.1,<2.0.0)", "lxml (>=4.9.2,<5.0.0)", "openai (>=0,<1)", "pandas (>=2.0.1,<3.0.0)", "pdfminer-six (>=20221105,<20221106)", "pgvector (>=0.1.6,<0.2.0)", "psychicapi (>=0.8.0,<0.9.0)", "py-trello (>=0.19.0,<0.20.0)", "pymupdf (>=1.22.3,<2.0.0)", "pypdf (>=3.4.0,<4.0.0)", "pypdfium2 (>=4.10.0,<5.0.0)", "pyspark (>=3.4.0,<4.0.0)", "requests-toolbelt (>=1.0.0,<2.0.0)", "scikit-learn (>=1.2.2,<2.0.0)", "streamlit (>=1.18.0,<2.0.0)", "telethon (>=1.28.5,<2.0.0)", "tqdm (>=4.48.0)", "zep-python (>=0.31)"] +javascript = ["esprima (>=4.0.1,<5.0.0)"] llms = ["anthropic (>=0.2.6,<0.3.0)", "clarifai (==9.1.0)", "cohere (>=3,<4)", "huggingface_hub (>=0,<1)", "manifest-ml (>=0.0.1,<0.0.2)", "nlpcloud (>=1,<2)", "openai (>=0,<1)", "openllm (>=0.1.6)", "openlm (>=0.0.5,<0.0.6)", "torch (>=1,<3)", "transformers (>=4,<5)"] openai = ["openai (>=0,<1)", "tiktoken (>=0.3.2,<0.4.0)"] qdrant = ["qdrant-client (>=1.1.2,<2.0.0)"] @@ -4778,14 +4779,14 @@ diagrams = ["jinja2", "railroad-diagrams"] [[package]] name = "pypdf" -version = "3.11.0" +version = "3.11.1" description = "A pure-python PDF library capable of splitting, merging, cropping, and transforming PDF files" category = "main" optional = false python-versions = ">=3.6" files = [ - {file = "pypdf-3.11.0-py3-none-any.whl", hash = "sha256:4f1fd2c1ee05e381e05447152d9e993016666647578fcdd7cf15739d13536861"}, - {file = "pypdf-3.11.0.tar.gz", hash = "sha256:2f5b9b28763234427cd6e525795e583aae7e36a79bdadd48ba8ab5277c12182a"}, + {file = "pypdf-3.11.1-py3-none-any.whl", hash = "sha256:2afc8914355a784fb184f60ae82fe10f9b992aa0733b705f0746966e470f98bd"}, + {file = "pypdf-3.11.1.tar.gz", hash = "sha256:198c4d0231525d0b730cbbd11a5fc7d9a2e410dfc8ae2928c8de000b7ef149c5"}, ] [package.dependencies] @@ -5065,14 +5066,14 @@ files = [ [[package]] name = "pywin32-ctypes" -version = "0.2.1" +version = "0.2.2" description = "A (partial) reimplementation of pywin32 using ctypes/cffi" category = "main" optional = false python-versions = ">=3.6" files = [ - {file = "pywin32-ctypes-0.2.1.tar.gz", hash = "sha256:934a2def1e5cbc472b2b6bf80680c0f03cd87df65dfd58bfd1846969de095b03"}, - {file = "pywin32_ctypes-0.2.1-py3-none-any.whl", hash = "sha256:b9a53ef754c894a525469933ab2a447c74ec1ea6b9d2ef446f40ec50d3dcec9f"}, + {file = "pywin32-ctypes-0.2.2.tar.gz", hash = "sha256:3426e063bdd5fd4df74a14fa3cf80a0b42845a87e1d1e81f6549f9daec593a60"}, + {file = "pywin32_ctypes-0.2.2-py3-none-any.whl", hash = "sha256:bf490a1a709baf35d688fe0ecf980ed4de11d2b3e37b51e5442587a75d9957e7"}, ] [[package]] diff --git a/pyproject.toml b/pyproject.toml index 07df52cb2..4b4a281c2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "langflow" -version = "0.2.2" +version = "0.2.6" description = "A Python package with a built-in web application" authors = ["Logspace "] maintainers = [ @@ -30,7 +30,7 @@ google-search-results = "^2.4.1" google-api-python-client = "^2.79.0" typer = "^0.9.0" gunicorn = "^20.1.0" -langchain = "^0.0.215" +langchain = "^0.0.218" openai = "^0.27.8" types-pyyaml = "^6.0.12.8" pandas = "^1.5.3" diff --git a/src/backend/langflow/__main__.py b/src/backend/langflow/__main__.py index a3841ec93..9980a5d2f 100644 --- a/src/backend/langflow/__main__.py +++ b/src/backend/langflow/__main__.py @@ -1,6 +1,5 @@ import sys import time -from fastapi import FastAPI import httpx from multiprocess import Process, cpu_count # type: ignore import platform @@ -11,9 +10,7 @@ from rich.panel import Panel from rich import box from rich import print as rprint import typer -from fastapi.staticfiles import StaticFiles -from fastapi.responses import FileResponse -from langflow.main import create_app +from langflow.main import setup_app from langflow.settings import settings from langflow.utils.logger import configure, logger import webbrowser @@ -144,15 +141,9 @@ def serve( remove_api_keys=remove_api_keys, cache=cache, ) - # get the directory of the current file - if not path: - frontend_path = Path(__file__).parent - static_files_dir = frontend_path / "frontend" - else: - static_files_dir = Path(path) - - app = create_app() - setup_static_files(app, static_files_dir) + # create path object if path is provided + static_files_dir: Optional[Path] = Path(path) if path else None + app = setup_app(static_files_dir=static_files_dir) # check if port is being used if is_port_in_use(port, host): port = get_free_port(port) @@ -200,29 +191,6 @@ def run_on_windows(host, port, log_level, options, app): run_langflow(host, port, log_level, options, app) -def setup_static_files(app: FastAPI, static_files_dir: Path): - """ - Setup the static files directory. - - Args: - app (FastAPI): FastAPI app. - path (str): Path to the static files directory. - """ - app.mount( - "/", - StaticFiles(directory=static_files_dir, html=True), - name="static", - ) - - @app.exception_handler(404) - async def custom_404_handler(request, __): - path = static_files_dir / "index.html" - - if not path.exists(): - raise RuntimeError(f"File at path {path} does not exist.") - return FileResponse(path) - - def is_port_in_use(port, host="localhost"): """ Check if a port is in use. diff --git a/src/backend/langflow/api/v1/chat.py b/src/backend/langflow/api/v1/chat.py index be9d6802c..fd0232189 100644 --- a/src/backend/langflow/api/v1/chat.py +++ b/src/backend/langflow/api/v1/chat.py @@ -1,12 +1,6 @@ -from fastapi import ( - APIRouter, - HTTPException, - WebSocket, - WebSocketException, - status, -) +from fastapi import APIRouter, HTTPException, WebSocket, WebSocketException, status from fastapi.responses import StreamingResponse -from langflow.api.v1.schemas import BuiltResponse, InitResponse, StreamData +from langflow.api.v1.schemas import BuildStatus, BuiltResponse, InitResponse, StreamData from langflow.chat.manager import ChatManager from langflow.graph.graph.base import Graph @@ -32,15 +26,29 @@ async def chat(client_id: str, websocket: WebSocket): await websocket.close(code=status.WS_1011_INTERNAL_ERROR, reason=str(exc)) -@router.post("/build/init", response_model=InitResponse, status_code=201) -async def init_build(graph_data: dict): +@router.post("/build/init/{flow_id}", response_model=InitResponse, status_code=201) +async def init_build(graph_data: dict, flow_id: str): """Initialize the build by storing graph data and returning a unique session ID.""" try: - flow_id = graph_data.get("id") if flow_id is None: raise ValueError("No ID provided") - flow_data_store[flow_id] = graph_data + # Check if already building + if ( + flow_id in flow_data_store + and flow_data_store[flow_id]["status"] == BuildStatus.IN_PROGRESS + ): + return InitResponse(flowId=flow_id) + + # Delete from cache if already exists + if flow_id in chat_manager.in_memory_cache: + with chat_manager.in_memory_cache._lock: + chat_manager.in_memory_cache.delete(flow_id) + logger.debug(f"Deleted flow {flow_id} from cache") + flow_data_store[flow_id] = { + "graph_data": graph_data, + "status": BuildStatus.IN_PROGRESS, + } return InitResponse(flowId=flow_id) except Exception as exc: @@ -52,8 +60,9 @@ async def init_build(graph_data: dict): async def build_status(flow_id: str): """Check the flow_id is in the flow_data_store.""" try: - built = flow_id in flow_data_store and not isinstance( - flow_data_store[flow_id], dict + built = ( + flow_id in flow_data_store + and flow_data_store[flow_id]["status"] == BuildStatus.SUCCESS ) return BuiltResponse( @@ -77,6 +86,11 @@ async def stream_build(flow_id: str): yield str(StreamData(event="error", data={"error": error_message})) return + if flow_data_store[flow_id].get("status") == BuildStatus.IN_PROGRESS: + error_message = "Already building" + yield str(StreamData(event="error", data={"error": error_message})) + return + graph_data = flow_data_store[flow_id].get("data") if not graph_data: @@ -110,6 +124,7 @@ async def stream_build(flow_id: str): except Exception as exc: params = str(exc) valid = False + flow_data_store[flow_id]["status"] = BuildStatus.FAILURE response = { "valid": valid, @@ -121,8 +136,10 @@ async def stream_build(flow_id: str): yield str(StreamData(event="message", data=response)) chat_manager.set_cache(flow_id, graph.build()) + flow_data_store[flow_id]["status"] = BuildStatus.SUCCESS except Exception as exc: logger.error("Error while building the flow: %s", exc) + flow_data_store[flow_id]["status"] = BuildStatus.FAILURE yield str(StreamData(event="error", data={"error": str(exc)})) finally: yield str(StreamData(event="message", data=final_response)) diff --git a/src/backend/langflow/api/v1/schemas.py b/src/backend/langflow/api/v1/schemas.py index ed5bf8b3b..2cf62a504 100644 --- a/src/backend/langflow/api/v1/schemas.py +++ b/src/backend/langflow/api/v1/schemas.py @@ -1,3 +1,4 @@ +from enum import Enum from pathlib import Path from typing import Any, Dict, List, Optional, Union from langflow.database.models.flow import FlowCreate, FlowRead @@ -5,6 +6,14 @@ from pydantic import BaseModel, Field, validator import json +class BuildStatus(Enum): + """Status of the build.""" + + SUCCESS = "success" + FAILURE = "failure" + IN_PROGRESS = "in_progress" + + class GraphData(BaseModel): """Data inside the exported flow.""" diff --git a/src/backend/langflow/chat/config.py b/src/backend/langflow/chat/config.py new file mode 100644 index 000000000..274f4d5bd --- /dev/null +++ b/src/backend/langflow/chat/config.py @@ -0,0 +1,2 @@ +class ChatConfig: + streaming: bool = True diff --git a/src/backend/langflow/config.yaml b/src/backend/langflow/config.yaml index 0205cbb31..14d81308a 100644 --- a/src/backend/langflow/config.yaml +++ b/src/backend/langflow/config.yaml @@ -1,142 +1,250 @@ ---- agents: - - ZeroShotAgent - - JsonAgent - - CSVAgent - - AgentInitializer - - VectorStoreAgent - - VectorStoreRouterAgent - - SQLAgent + ZeroShotAgent: + documentation: "https://python.langchain.com/docs/modules/agents/how_to/custom_mrkl_agent" + JsonAgent: + documentation: "https://python.langchain.com/docs/modules/agents/toolkits/openapi" + CSVAgent: + documentation: "https://python.langchain.com/docs/modules/agents/toolkits/csv" + AgentInitializer: + documentation: "https://python.langchain.com/docs/modules/agents/agent_types/" + VectorStoreAgent: + documentation: "" + VectorStoreRouterAgent: + documentation: "" + SQLAgent: + documentation: "" chains: - - LLMChain - - LLMMathChain - - LLMCheckerChain - - ConversationChain - - SeriesCharacterChain - - MidJourneyPromptChain - - TimeTravelGuideChain - - SQLDatabaseChain - - RetrievalQA - - RetrievalQAWithSourcesChain - - ConversationalRetrievalChain - - CombineDocsChain + LLMChain: + documentation: "https://python.langchain.com/docs/modules/chains/foundational/llm_chain" + LLMMathChain: + documentation: "https://python.langchain.com/docs/modules/chains/additional/llm_math" + LLMCheckerChain: + documentation: "https://python.langchain.com/docs/modules/chains/additional/llm_checker" + ConversationChain: + documentation: "" + SeriesCharacterChain: + documentation: "" + MidJourneyPromptChain: + documentation: "" + TimeTravelGuideChain: + documentation: "" + SQLDatabaseChain: + documentation: "" + RetrievalQA: + documentation: "https://python.langchain.com/docs/modules/chains/popular/vector_db_qa" + RetrievalQAWithSourcesChain: + documentation: "" + ConversationalRetrievalChain: + documentation: "https://python.langchain.com/docs/modules/chains/popular/chat_vector_db" + CombineDocsChain: + documentation: "" documentloaders: - - AirbyteJSONLoader - - CoNLLULoader - - CSVLoader - - UnstructuredEmailLoader - - EverNoteLoader - - FacebookChatLoader - - GutenbergLoader - - BSHTMLLoader - - UnstructuredHTMLLoader - # - UnstructuredImageLoader # Issue with Python 3.11 (https://github.com/Unstructured-IO/unstructured-inference/issues/83) - - UnstructuredMarkdownLoader - - PyPDFLoader - - UnstructuredPowerPointLoader - - SRTLoader - - TelegramChatLoader - - TextLoader - - UnstructuredWordDocumentLoader - - WebBaseLoader - - AZLyricsLoader - - CollegeConfidentialLoader - - HNLoader - - IFixitLoader - - IMSDbLoader - - GitbookLoader - - ReadTheDocsLoader - - SlackDirectoryLoader - - NotionDirectoryLoader - - DirectoryLoader - - GitLoader + AirbyteJSONLoader: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/airbyte_json" + CoNLLULoader: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/conll-u" + CSVLoader: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/csv" + UnstructuredEmailLoader: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/email" + EverNoteLoader: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/evernote" + FacebookChatLoader: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/facebook_chat" + GutenbergLoader: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/gutenberg" + BSHTMLLoader: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_loaders/how_to/html" + UnstructuredHTMLLoader: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_loaders/how_to/html" + UnstructuredMarkdownLoader: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_loaders/how_to/markdown" + PyPDFLoader: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_loaders/how_to/pdf" + UnstructuredPowerPointLoader: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/microsoft_powerpoint" + SRTLoader: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/subtitle" + TelegramChatLoader: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/telegram" + TextLoader: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_loaders/" + UnstructuredWordDocumentLoader: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/microsoft_word" + WebBaseLoader: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/web_base" + AZLyricsLoader: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/azlyrics" + CollegeConfidentialLoader: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/college_confidential" + HNLoader: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/hacker_news" + IFixitLoader: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/ifixit" + IMSDbLoader: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/imsdb" + GitbookLoader: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/gitbook" + ReadTheDocsLoader: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/readthedocs_documentation" + SlackDirectoryLoader: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/slack" + NotionDirectoryLoader: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/notion" + DirectoryLoader: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_loaders/how_to/file_directory" + GitLoader: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/git" embeddings: - - OpenAIEmbeddings - - HuggingFaceEmbeddings - - CohereEmbeddings + OpenAIEmbeddings: + documentation: "https://python.langchain.com/docs/modules/data_connection/text_embedding/integrations/openai" + HuggingFaceEmbeddings: + documentation: "https://python.langchain.com/docs/modules/data_connection/text_embedding/integrations/sentence_transformers" + CohereEmbeddings: + documentation: "https://python.langchain.com/docs/modules/data_connection/text_embedding/integrations/cohere" llms: - - OpenAI - # - AzureOpenAI - # - AzureChatOpenAI - - ChatOpenAI - - LlamaCpp - - CTransformers - - Cohere - - Anthropic - - ChatAnthropic - - HuggingFaceHub + OpenAI: + documentation: "https://python.langchain.com/docs/modules/model_io/models/llms/integrations/openai" + ChatOpenAI: + documentation: "https://python.langchain.com/docs/modules/model_io/models/chat/integrations/openai" + LlamaCpp: + documentation: "https://python.langchain.com/docs/modules/model_io/models/llms/integrations/llamacpp" + CTransformers: + documentation: "https://python.langchain.com/docs/modules/model_io/models/llms/integrations/ctransformers" + Cohere: + documentation: "https://python.langchain.com/docs/modules/model_io/models/llms/integrations/cohere" + Anthropic: + documentation: "" + ChatAnthropic: + documentation: "https://python.langchain.com/docs/modules/model_io/models/chat/integrations/anthropic" + HuggingFaceHub: + documentation: "https://python.langchain.com/docs/modules/model_io/models/llms/integrations/huggingface_hub" memories: - - ConversationBufferMemory - - ConversationSummaryMemory - - ConversationKGMemory - - PostgresChatMessageHistory + PostgresChatMessageHistory: + documentation: "https://python.langchain.com/docs/modules/memory/how_to/agent_with_memory_in_db" + ConversationBufferMemory: + documentation: "https://python.langchain.com/docs/modules/memory/how_to/buffer" + ConversationSummaryMemory: + documentation: "https://python.langchain.com/docs/modules/memory/how_to/summary" + ConversationKGMemory: + documentation: "https://python.langchain.com/docs/modules/memory/how_to/kg" + ConversationBufferWindowMemory: + documentation: "https://python.langchain.com/docs/modules/memory/how_to/buffer_window" + VectorStoreRetrieverMemory: + documentation: "https://python.langchain.com/docs/modules/memory/how_to/vectorstore_retriever_memory" + prompts: - - PromptTemplate - - FewShotPromptTemplate - - ZeroShotPrompt + PromptTemplate: + documentation: "https://python.langchain.com/docs/modules/model_io/prompts/prompt_templates/" + ZeroShotPrompt: + documentation: "https://python.langchain.com/docs/modules/agents/how_to/custom_mrkl_agent" textsplitters: - - CharacterTextSplitter - - RecursiveCharacterTextSplitter - # - LatexTextSplitter - # - PythonCodeTextSplitter + CharacterTextSplitter: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_transformers/text_splitters/character_text_splitter" + RecursiveCharacterTextSplitter: + documentation: "https://python.langchain.com/docs/modules/data_connection/document_transformers/text_splitters/recursive_text_splitter" toolkits: - - OpenAPIToolkit - - JsonToolkit - - VectorStoreInfo - - VectorStoreRouterToolkit - - VectorStoreToolkit + OpenAPIToolkit: + documentation: "" + JsonToolkit: + documentation: "" + VectorStoreInfo: + documentation: "" + VectorStoreRouterToolkit: + documentation: "" + VectorStoreToolkit: + documentation: "" tools: - - Search - - PAL-MATH - - Calculator - - Serper Search - - Tool - - PythonFunctionTool - - PythonFunction - - JsonSpec - - News API - - TMDB API - - Podcast API - - QuerySQLDataBaseTool - - InfoSQLDatabaseTool - - ListSQLDatabaseTool - # - QueryCheckerTool - - BingSearchRun - - GoogleSearchRun - - GoogleSearchResults - - GoogleSerperRun - - JsonListKeysTool - - JsonGetValueTool - - PythonREPLTool - - PythonAstREPLTool - - RequestsGetTool - - RequestsPostTool - - RequestsPatchTool - - RequestsPutTool - - RequestsDeleteTool - - WikipediaQueryRun - - WolframAlphaQueryRun + Search: + documentation: "" + PAL-MATH: + documentation: "" + Calculator: + documentation: "" + Serper Search: + documentation: "" + Tool: + documentation: "" + PythonFunctionTool: + documentation: "" + PythonFunction: + documentation: "" + JsonSpec: + documentation: "" + News API: + documentation: "" + TMDB API: + documentation: "" + Podcast API: + documentation: "" + QuerySQLDataBaseTool: + documentation: "" + InfoSQLDatabaseTool: + documentation: "" + ListSQLDatabaseTool: + documentation: "" + BingSearchRun: + documentation: "" + GoogleSearchRun: + documentation: "" + GoogleSearchResults: + documentation: "" + GoogleSerperRun: + documentation: "" + JsonListKeysTool: + documentation: "" + JsonGetValueTool: + documentation: "" + PythonREPLTool: + documentation: "" + PythonAstREPLTool: + documentation: "" + RequestsGetTool: + documentation: "" + RequestsPostTool: + documentation: "" + RequestsPatchTool: + documentation: "" + RequestsPutTool: + documentation: "" + RequestsDeleteTool: + documentation: "" + WikipediaQueryRun: + documentation: "" + WolframAlphaQueryRun: + documentation: "" utilities: - - BingSearchAPIWrapper - - GoogleSearchAPIWrapper - - GoogleSerperAPIWrapper - - SearxResults - - SearxSearchWrapper - - SerpAPIWrapper - - WikipediaAPIWrapper - - WolframAlphaAPIWrapper - # - ZapierNLAWrapper - - SQLDatabase + BingSearchAPIWrapper: + documentation: "" + GoogleSearchAPIWrapper: + documentation: "" + GoogleSerperAPIWrapper: + documentation: "" + SearxResults: + documentation: "" + SearxSearchWrapper: + documentation: "" + SerpAPIWrapper: + documentation: "" + WikipediaAPIWrapper: + documentation: "" + WolframAlphaAPIWrapper: + documentation: "" vectorstores: - - Chroma - - Qdrant - - Weaviate - - FAISS - - Pinecone - - SupabaseVectorStore - - MongoDBAtlasVectorSearch + Chroma: + documentation: "https://python.langchain.com/docs/modules/data_connection/vectorstores/integrations/chroma" + Qdrant: + documentation: "https://python.langchain.com/docs/modules/data_connection/vectorstores/integrations/qdrant" + Weaviate: + documentation: "https://python.langchain.com/docs/modules/data_connection/vectorstores/integrations/weaviate" + FAISS: + documentation: "https://python.langchain.com/docs/modules/data_connection/vectorstores/integrations/faiss" + Pinecone: + documentation: "https://python.langchain.com/docs/modules/data_connection/vectorstores/integrations/pinecone" + SupabaseVectorStore: + documentation: "https://python.langchain.com/docs/modules/data_connection/vectorstores/integrations/supabase" + MongoDBAtlasVectorSearch: + documentation: "https://python.langchain.com/docs/modules/data_connection/vectorstores/integrations/mongodb_atlas_vector_search" wrappers: - - RequestsWrapper - # - ChatPromptTemplate - # - SystemMessagePromptTemplate - # - HumanMessagePromptTemplate + RequestsWrapper: + documentation: "" diff --git a/src/backend/langflow/interface/base.py b/src/backend/langflow/interface/base.py index df0c2c50c..6e1522dd2 100644 --- a/src/backend/langflow/interface/base.py +++ b/src/backend/langflow/interface/base.py @@ -8,6 +8,7 @@ from langflow.template.field.base import TemplateField from langflow.template.frontend_node.base import FrontendNode from langflow.template.template.base import Template from langflow.utils.logger import logger +from langflow.settings import settings # Assuming necessary imports for Field, Template, and FrontendNode classes @@ -15,12 +16,29 @@ from langflow.utils.logger import logger class LangChainTypeCreator(BaseModel, ABC): type_name: str type_dict: Optional[Dict] = None + name_docs_dict: Optional[Dict[str, str]] = None @property def frontend_node_class(self) -> Type[FrontendNode]: """The class type of the FrontendNode created in frontend_node.""" return FrontendNode + @property + def docs_map(self) -> Dict[str, str]: + """A dict with the name of the component as key and the documentation link as value.""" + if self.name_docs_dict is None: + try: + type_settings = getattr(settings, self.type_name) + self.name_docs_dict = { + name: value_dict["documentation"] + for name, value_dict in type_settings.items() + } + except AttributeError as exc: + logger.error(exc) + + self.name_docs_dict = {} + return self.name_docs_dict + @property @abstractmethod def type_to_loader_dict(self) -> Dict: @@ -83,7 +101,7 @@ class LangChainTypeCreator(BaseModel, ABC): signature.add_extra_fields() signature.add_extra_base_classes() - + signature.set_documentation(self.docs_map.get(name, "")) return signature diff --git a/src/backend/langflow/interface/initialize/loading.py b/src/backend/langflow/interface/initialize/loading.py index 41867085e..ea9af8d63 100644 --- a/src/backend/langflow/interface/initialize/loading.py +++ b/src/backend/langflow/interface/initialize/loading.py @@ -1,11 +1,12 @@ import json -from typing import Any, Callable, Dict, Sequence +from typing import Any, Callable, Dict, Sequence, Type from langchain.agents import ZeroShotAgent from langchain.agents import agent as agent_module from langchain.agents.agent import AgentExecutor from langchain.agents.agent_toolkits.base import BaseToolkit from langchain.agents.tools import BaseTool + from langflow.interface.initialize.vector_store import vecstore_initializer from pydantic import ValidationError @@ -16,6 +17,10 @@ from langflow.interface.toolkits.base import toolkits_creator from langflow.interface.chains.base import chain_creator from langflow.interface.utils import load_file_into_dict from langflow.utils import validate +from langchain.chains.base import Chain +from langchain.vectorstores.base import VectorStore +from langchain.document_loaders.base import BaseLoader +from langchain.prompts.base import BasePromptTemplate def instantiate_class(node_type: str, base_type: str, params: Dict) -> Any: @@ -43,8 +48,8 @@ def convert_params_to_sets(params): def convert_kwargs(params): # if *kwargs are passed as a string, convert to dict - # first find any key that has kwargs in it - kwargs_keys = [key for key in params.keys() if "kwargs" in key] + # first find any key that has kwargs or config in it + kwargs_keys = [key for key in params.keys() if "kwargs" in key or "config" in key] for key in kwargs_keys: if isinstance(params[key], str): params[key] = json.loads(params[key]) @@ -72,11 +77,17 @@ def instantiate_based_on_type(class_object, base_type, node_type, params): return instantiate_utility(node_type, class_object, params) elif base_type == "chains": return instantiate_chains(node_type, class_object, params) + elif base_type == "llms": + return instantiate_llm(node_type, class_object, params) else: return class_object(**params) -def instantiate_chains(node_type, class_object, params): +def instantiate_llm(node_type, class_object, params: Dict): + return class_object(**params) + + +def instantiate_chains(node_type, class_object: Type[Chain], params: Dict): if "retriever" in params and hasattr(params["retriever"], "as_retriever"): params["retriever"] = params["retriever"].as_retriever() if node_type in chain_creator.from_method_nodes: @@ -88,11 +99,11 @@ def instantiate_chains(node_type, class_object, params): return class_object(**params) -def instantiate_agent(class_object, params): +def instantiate_agent(class_object: Type[agent_module.Agent], params: Dict): return load_agent_executor(class_object, params) -def instantiate_prompt(node_type, class_object, params): +def instantiate_prompt(node_type, class_object: Type[BasePromptTemplate], params: Dict): if node_type == "ZeroShotPrompt": if "tools" not in params: params["tools"] = [] @@ -100,7 +111,7 @@ def instantiate_prompt(node_type, class_object, params): return class_object(**params) -def instantiate_tool(node_type, class_object, params): +def instantiate_tool(node_type, class_object: Type[BaseTool], params: Dict): if node_type == "JsonSpec": params["dict_"] = load_file_into_dict(params.pop("path")) return class_object(**params) @@ -118,7 +129,7 @@ def instantiate_tool(node_type, class_object, params): return class_object(**params) -def instantiate_toolkit(node_type, class_object, params): +def instantiate_toolkit(node_type, class_object: Type[BaseToolkit], params: Dict): loaded_toolkit = class_object(**params) # Commenting this out for now to use toolkits as normal tools # if toolkits_creator.has_create_function(node_type): @@ -128,7 +139,7 @@ def instantiate_toolkit(node_type, class_object, params): return loaded_toolkit -def instantiate_embedding(class_object, params): +def instantiate_embedding(class_object, params: Dict): params.pop("model", None) params.pop("headers", None) try: @@ -142,7 +153,7 @@ def instantiate_embedding(class_object, params): return class_object(**params) -def instantiate_vectorstore(class_object, params): +def instantiate_vectorstore(class_object: Type[VectorStore], params: Dict): search_kwargs = params.pop("search_kwargs", {}) if initializer := vecstore_initializer.get(class_object.__name__): vecstore = initializer(class_object, params) @@ -158,7 +169,7 @@ def instantiate_vectorstore(class_object, params): return vecstore -def instantiate_documentloader(class_object, params): +def instantiate_documentloader(class_object: Type[BaseLoader], params: Dict): if "file_filter" in params: # file_filter will be a string but we need a function # that will be used to filter the files using file_filter @@ -171,35 +182,55 @@ def instantiate_documentloader(class_object, params): extension.strip() in x for extension in extensions ) metadata = params.pop("metadata", None) + if metadata and isinstance(metadata, str): + try: + metadata = json.loads(metadata) + except json.JSONDecodeError as exc: + raise ValueError( + "The metadata you provided is not a valid JSON string." + ) from exc docs = class_object(**params).load() + # Now if metadata is an empty dict, we will not add it to the documents if metadata: - if isinstance(metadata, str): - try: - metadata = json.loads(metadata) - except json.JSONDecodeError as exc: - raise ValueError( - "The metadata you provided is not a valid JSON string." - ) from exc - for doc in docs: - doc.metadata = metadata + # If the document already has metadata, we will not overwrite it + if not doc.metadata: + doc.metadata = metadata + else: + doc.metadata.update(metadata) return docs -def instantiate_textsplitter(class_object, params): +def instantiate_textsplitter( + class_object, + params: Dict, +): try: documents = params.pop("documents") - except KeyError as e: + except KeyError as exc: raise ValueError( "The source you provided did not load correctly or was empty." "Try changing the chunk_size of the Text Splitter." - ) from e - text_splitter = class_object(**params) + ) from exc + + if ( + "separator_type" in params and params["separator_type"] == "Text" + ) or "separator_type" not in params: + params.pop("separator_type", None) + text_splitter = class_object(**params) + else: + from langchain.text_splitter import Language + + language = params.pop("separator_type", None) + params["language"] = Language(language) + params.pop("separators", None) + + text_splitter = class_object.from_language(**params) return text_splitter.split_documents(documents) -def instantiate_utility(node_type, class_object, params): +def instantiate_utility(node_type, class_object, params: Dict): if node_type == "SQLDatabase": return class_object.from_uri(params.pop("uri")) return class_object(**params) diff --git a/src/backend/langflow/interface/utils.py b/src/backend/langflow/interface/utils.py index 8d45aa1b1..ff89e92bf 100644 --- a/src/backend/langflow/interface/utils.py +++ b/src/backend/langflow/interface/utils.py @@ -4,10 +4,12 @@ import os from io import BytesIO import re + import yaml from langchain.base_language import BaseLanguageModel from PIL.Image import Image from langflow.utils.logger import logger +from langflow.chat.config import ChatConfig def load_file_into_dict(file_path: str) -> dict: @@ -49,9 +51,9 @@ def try_setting_streaming_options(langchain_object, websocket): if isinstance(llm, BaseLanguageModel): if hasattr(llm, "streaming") and isinstance(llm.streaming, bool): - llm.streaming = True + llm.streaming = ChatConfig.streaming elif hasattr(llm, "stream") and isinstance(llm.stream, bool): - llm.stream = True + llm.stream = ChatConfig.streaming return langchain_object diff --git a/src/backend/langflow/main.py b/src/backend/langflow/main.py index 2a1293f2e..e937931d6 100644 --- a/src/backend/langflow/main.py +++ b/src/backend/langflow/main.py @@ -1,5 +1,9 @@ +from pathlib import Path +from typing import Optional from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware +from fastapi.responses import FileResponse +from fastapi.staticfiles import StaticFiles from langflow.api import router from langflow.database.base import create_db_and_tables @@ -33,6 +37,42 @@ def create_app(): return app +def setup_static_files(app: FastAPI, static_files_dir: Path): + """ + Setup the static files directory. + Args: + app (FastAPI): FastAPI app. + path (str): Path to the static files directory. + """ + app.mount( + "/", + StaticFiles(directory=static_files_dir, html=True), + name="static", + ) + + @app.exception_handler(404) + async def custom_404_handler(request, __): + path = static_files_dir / "index.html" + + if not path.exists(): + raise RuntimeError(f"File at path {path} does not exist.") + return FileResponse(path) + + +# app = create_app() +# setup_static_files(app, static_files_dir) +def setup_app(static_files_dir: Optional[Path]) -> 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" + + app = create_app() + setup_static_files(app, static_files_dir) + return app + + app = create_app() diff --git a/src/backend/langflow/settings.py b/src/backend/langflow/settings.py index e3644e84c..f153ba706 100644 --- a/src/backend/langflow/settings.py +++ b/src/backend/langflow/settings.py @@ -1,24 +1,23 @@ import os -from typing import List import yaml from pydantic import BaseSettings, root_validator class Settings(BaseSettings): - chains: List[str] = [] - agents: List[str] = [] - prompts: List[str] = [] - llms: List[str] = [] - tools: List[str] = [] - memories: List[str] = [] - embeddings: List[str] = [] - vectorstores: List[str] = [] - documentloaders: List[str] = [] - wrappers: List[str] = [] - toolkits: List[str] = [] - textsplitters: List[str] = [] - utilities: List[str] = [] + chains: dict = {} + agents: dict = {} + prompts: dict = {} + llms: dict = {} + tools: dict = {} + memories: dict = {} + embeddings: dict = {} + vectorstores: dict = {} + documentloaders: dict = {} + wrappers: dict = {} + toolkits: dict = {} + textsplitters: dict = {} + utilities: dict = {} dev: bool = False database_url: str = "sqlite:///./langflow.db" cache: str = "InMemoryCache" @@ -38,16 +37,16 @@ class Settings(BaseSettings): def update_from_yaml(self, file_path: str, dev: bool = False): new_settings = load_settings_from_yaml(file_path) - self.chains = new_settings.chains or [] - self.agents = new_settings.agents or [] - self.prompts = new_settings.prompts or [] - self.llms = new_settings.llms or [] - self.tools = new_settings.tools or [] - self.memories = new_settings.memories or [] - self.wrappers = new_settings.wrappers or [] - self.toolkits = new_settings.toolkits or [] - self.textsplitters = new_settings.textsplitters or [] - self.utilities = new_settings.utilities or [] + self.chains = new_settings.chains or {} + self.agents = new_settings.agents or {} + self.prompts = new_settings.prompts or {} + self.llms = new_settings.llms or {} + self.tools = new_settings.tools or {} + self.memories = new_settings.memories or {} + self.wrappers = new_settings.wrappers or {} + self.toolkits = new_settings.toolkits or {} + self.textsplitters = new_settings.textsplitters or {} + self.utilities = new_settings.utilities or {} self.dev = dev def update_settings(self, **kwargs): diff --git a/src/backend/langflow/template/field/base.py b/src/backend/langflow/template/field/base.py index a9c18ff63..fdfdca562 100644 --- a/src/backend/langflow/template/field/base.py +++ b/src/backend/langflow/template/field/base.py @@ -21,6 +21,7 @@ class TemplateFieldCreator(BaseModel, ABC): name: str = "" display_name: Optional[str] = None advanced: bool = False + info: Optional[str] = "" def to_dict(self): result = self.dict() diff --git a/src/backend/langflow/template/frontend_node/base.py b/src/backend/langflow/template/frontend_node/base.py index 4801da086..751ecb709 100644 --- a/src/backend/langflow/template/frontend_node/base.py +++ b/src/backend/langflow/template/frontend_node/base.py @@ -15,14 +15,21 @@ class FrontendNode(BaseModel): base_classes: List[str] name: str = "" display_name: str = "" + documentation: str = "" + + def set_documentation(self, documentation: str) -> None: + """Sets the documentation of the frontend node.""" + self.documentation = documentation def to_dict(self) -> dict: + """Returns a dict representation of the frontend node.""" return { self.name: { "template": self.template.to_dict(self.format_field), "description": self.description, "base_classes": self.base_classes, "display_name": self.display_name or self.name, + "documentation": self.documentation, }, } diff --git a/src/backend/langflow/template/frontend_node/constants.py b/src/backend/langflow/template/frontend_node/constants.py index 20b8a0c61..90cdbf280 100644 --- a/src/backend/langflow/template/frontend_node/constants.py +++ b/src/backend/langflow/template/frontend_node/constants.py @@ -32,3 +32,29 @@ You are a good listener and you can talk about anything. HUMAN_PROMPT = "{input}" QA_CHAIN_TYPES = ["stuff", "map_reduce", "map_rerank", "refine"] + +CTRANSFORMERS_DEFAULT_CONFIG = { + "top_k": 40, + "top_p": 0.95, + "temperature": 0.8, + "repetition_penalty": 1.1, + "last_n_tokens": 64, + "seed": -1, + "max_new_tokens": 256, + "stop": None, + "stream": False, + "reset": True, + "batch_size": 8, + "threads": -1, + "context_length": -1, + "gpu_layers": 0, +} + +# This variable is used to tell the user +# that it can be changed to use other APIs +# like Prem and LocalAI +OPENAI_API_BASE_INFO = """ +The base URL of the OpenAI API. Defaults to https://api.openai.com/v1. + +You can change this to use other APIs like JinaChat, LocalAI and Prem. +""" diff --git a/src/backend/langflow/template/frontend_node/llms.py b/src/backend/langflow/template/frontend_node/llms.py index 272e42c7f..703dbacc6 100644 --- a/src/backend/langflow/template/frontend_node/llms.py +++ b/src/backend/langflow/template/frontend_node/llms.py @@ -1,7 +1,10 @@ +import json from typing import Optional from langflow.template.field.base import TemplateField from langflow.template.frontend_node.base import FrontendNode +from langflow.template.frontend_node.constants import CTRANSFORMERS_DEFAULT_CONFIG +from langflow.template.frontend_node.constants import OPENAI_API_BASE_INFO class LLMFrontendNode(FrontendNode): @@ -15,6 +18,9 @@ class LLMFrontendNode(FrontendNode): if "key" not in field.name.lower() and "token" not in field.name.lower(): field.password = False + if field.name == "openai_api_base": + field.info = OPENAI_API_BASE_INFO + @staticmethod def format_azure_field(field: TemplateField): if field.name == "model_name": @@ -31,6 +37,13 @@ class LLMFrontendNode(FrontendNode): field.show = True field.advanced = not field.required + @staticmethod + def format_ctransformers_field(field: TemplateField): + if field.name == "config": + field.show = True + field.advanced = True + field.value = json.dumps(CTRANSFORMERS_DEFAULT_CONFIG, indent=2) + @staticmethod def format_field(field: TemplateField, name: Optional[str] = None) -> None: display_names_dict = { @@ -38,6 +51,7 @@ class LLMFrontendNode(FrontendNode): } FrontendNode.format_field(field, name) LLMFrontendNode.format_openai_field(field) + LLMFrontendNode.format_ctransformers_field(field) if name and "azure" in name.lower(): LLMFrontendNode.format_azure_field(field) if name and "llama" in name.lower(): diff --git a/src/backend/langflow/template/frontend_node/textsplitters.py b/src/backend/langflow/template/frontend_node/textsplitters.py index 03880379d..65a2be6f6 100644 --- a/src/backend/langflow/template/frontend_node/textsplitters.py +++ b/src/backend/langflow/template/frontend_node/textsplitters.py @@ -1,5 +1,6 @@ from langflow.template.field.base import TemplateField from langflow.template.frontend_node.base import FrontendNode +from langchain.text_splitter import Language class TextSplittersFrontendNode(FrontendNode): @@ -17,6 +18,24 @@ class TextSplittersFrontendNode(FrontendNode): name = "separator" elif self.template.type_name == "RecursiveCharacterTextSplitter": name = "separators" + # Add a field for type of separator + # which will have Text or any value from the + # Language enum + options = [x.value for x in Language] + ["Text"] + options.sort() + self.template.add_field( + TemplateField( + field_type="str", + required=True, + show=True, + name="separator_type", + advanced=False, + is_list=True, + options=options, + value="Text", + display_name="Separator Type", + ) + ) self.template.add_field( TemplateField( field_type="str", diff --git a/src/backend/langflow/template/frontend_node/vectorstores.py b/src/backend/langflow/template/frontend_node/vectorstores.py index 01b6bfe53..58cfcdc34 100644 --- a/src/backend/langflow/template/frontend_node/vectorstores.py +++ b/src/backend/langflow/template/frontend_node/vectorstores.py @@ -200,7 +200,7 @@ class VectorStoreFrontendNode(FrontendNode): self.template.add_field(field) def add_extra_base_classes(self) -> None: - self.base_classes.append("BaseRetriever") + self.base_classes.extend(("BaseRetriever", "VectorStoreRetriever")) @staticmethod def format_field(field: TemplateField, name: Optional[str] = None) -> None: diff --git a/src/frontend/package-lock.json b/src/frontend/package-lock.json index 673f56f10..0edd88d0d 100644 --- a/src/frontend/package-lock.json +++ b/src/frontend/package-lock.json @@ -1212,15 +1212,15 @@ "integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==" }, "node_modules/@mui/system": { - "version": "5.13.5", - "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.13.5.tgz", - "integrity": "sha512-n0gzUxoZ2ZHZgnExkh2Htvo9uW2oakofgPRQrDoa/GQOWyRD0NH9MDszBwOb6AAoXZb+OV5TE7I4LeZ/dzgHYA==", + "version": "5.13.6", + "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.13.6.tgz", + "integrity": "sha512-G3Xr28uLqU3DyF6r2LQkHGw/ku4P0AHzlKVe7FGXOPl7X1u+hoe2xxj8Vdiq/69II/mh9OP21i38yBWgWb7WgQ==", "dependencies": { - "@babel/runtime": "^7.21.0", + "@babel/runtime": "^7.22.5", "@mui/private-theming": "^5.13.1", "@mui/styled-engine": "^5.13.2", "@mui/types": "^7.2.4", - "@mui/utils": "^5.13.1", + "@mui/utils": "^5.13.6", "clsx": "^1.2.1", "csstype": "^3.1.2", "prop-types": "^15.8.1" @@ -1280,11 +1280,11 @@ } }, "node_modules/@mui/utils": { - "version": "5.13.1", - "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.13.1.tgz", - "integrity": "sha512-6lXdWwmlUbEU2jUI8blw38Kt+3ly7xkmV9ljzY4Q20WhsJMWiNry9CX8M+TaP/HbtuyR8XKsdMgQW7h7MM3n3A==", + "version": "5.13.6", + "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.13.6.tgz", + "integrity": "sha512-ggNlxl5NPSbp+kNcQLmSig6WVB0Id+4gOxhx644987v4fsji+CSXc+MFYLocFB/x4oHtzCUlSzbVHlJfP/fXoQ==", "dependencies": { - "@babel/runtime": "^7.21.0", + "@babel/runtime": "^7.22.5", "@types/prop-types": "^15.7.5", "@types/react-is": "^18.2.0", "prop-types": "^15.8.1", @@ -3444,7 +3444,7 @@ "version": "16.18.12", "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.12.tgz", "integrity": "sha512-vzLe5NaNMjIE3mcddFVGlAXN1LEWueUsMsOJWaT6wWMJGyljHAWHznqfnKUQWGzu7TLPrGvWdNAsvQYW+C0xtw==", - "devOptional": true + "dev": true }, "node_modules/@types/parse-json": { "version": "4.0.0", @@ -3714,9 +3714,9 @@ } }, "node_modules/aria-query": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.2.1.tgz", - "integrity": "sha512-7uFg4b+lETFgdaJyETnILsXgnnzVnkHcgRbwbPwevm5x/LmUlt3MjczMRe1zg824iBgXZNRPTBftNYyRSKLp2g==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", + "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", "dev": true, "dependencies": { "dequal": "^2.0.3" @@ -5010,9 +5010,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.438", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.438.tgz", - "integrity": "sha512-x94U0FhphEsHsOloCvlsujHCvoir0ZQ73ZAs/QN4PLx98uNvyEU79F75rq1db75Bx/atvuh7KPeuxelh+xfYJw==" + "version": "1.4.440", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.440.tgz", + "integrity": "sha512-r6dCgNpRhPwiWlxbHzZQ/d9swfPaEJGi8ekqRBwQYaR3WmA5VkqQfBWSDDjuJU1ntO+W9tHx8OHV/96Q8e0dVw==" }, "node_modules/emoji-regex": { "version": "8.0.0", @@ -5504,6 +5504,7 @@ "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, "hasInstallScript": true, "optional": true, "os": [ @@ -6745,9 +6746,9 @@ } }, "node_modules/katex": { - "version": "0.16.7", - "resolved": "https://registry.npmjs.org/katex/-/katex-0.16.7.tgz", - "integrity": "sha512-Xk9C6oGKRwJTfqfIbtr0Kes9OSv6IFsuhFGc7tW4urlpMJtuh+7YhzU6YEG9n8gmWKcMAFzkp7nr+r69kV0zrA==", + "version": "0.16.8", + "resolved": "https://registry.npmjs.org/katex/-/katex-0.16.8.tgz", + "integrity": "sha512-ftuDnJbcbOckGY11OO+zg3OofESlbR5DRl2cmN8HeWeeFIV7wTXvAOx8kEjZjobhA+9wh2fbKeO6cdcA9Mnovg==", "funding": [ "https://opencollective.com/katex", "https://github.com/sponsors/katex" diff --git a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx index 4347b88ca..ccc18a5fa 100644 --- a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx @@ -25,6 +25,7 @@ import { nodeColors } from "../../../../utils"; import ShadTooltip from "../../../../components/ShadTooltipComponent"; import { PopUpContext } from "../../../../contexts/popUpContext"; import ToggleShadComponent from "../../../../components/toggleShadComponent"; +import { Info } from "lucide-react"; export default function ParameterComponent({ left, @@ -36,9 +37,11 @@ export default function ParameterComponent({ type, name = "", required = false, + info = "", }: ParameterComponentType) { const ref = useRef(null); const refHtml = useRef(null); + const infoHtml = useRef(null); const updateNodeInternals = useUpdateNodeInternals(); const [position, setPosition] = useState(0); const { closePopUp } = useContext(PopUpContext); @@ -79,6 +82,18 @@ export default function ParameterComponent({ }); }; + useEffect(() => { + infoHtml.current = ( +
+ {info.split("\n").map((line, i) => ( +

+ {line} +

+ ))} +
+ ); + }, [info]); + useEffect(() => { const groupedObj = groupByFamily(myData, tooltipTitle); @@ -126,9 +141,22 @@ export default function ParameterComponent({ className="w-full flex flex-wrap justify-between items-center bg-muted dark:bg-gray-800 dark:text-white mt-1 px-5 py-2" > <> -
+
{title} {required ? " *" : ""} +
+ {info !== "" && ( + + + + )} +
{left && (type === "str" || diff --git a/src/frontend/src/CustomNodes/GenericNode/index.tsx b/src/frontend/src/CustomNodes/GenericNode/index.tsx index 1668b1d4e..aaa8030b5 100644 --- a/src/frontend/src/CustomNodes/GenericNode/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/index.tsx @@ -6,16 +6,7 @@ import { } from "../../utils"; import ParameterComponent from "./components/parameterComponent"; import { typesContext } from "../../contexts/typesContext"; -import { - useContext, - useState, - useEffect, - useRef, - ForwardRefExoticComponent, - ComponentType, - SVGProps, - ReactNode, -} from "react"; +import { useContext, useState, useEffect, useRef } from "react"; import { NodeDataType } from "../../types/flow"; import { alertContext } from "../../contexts/alertContext"; import { PopUpContext } from "../../contexts/popUpContext"; @@ -23,10 +14,8 @@ import NodeModal from "../../modals/NodeModal"; import Tooltip from "../../components/TooltipComponent"; import { NodeToolbar } from "reactflow"; import NodeToolbarComponent from "../../pages/FlowPage/components/nodeToolbarComponent"; - import ShadTooltip from "../../components/ShadTooltipComponent"; import { useSSE } from "../../contexts/SSEContext"; -import { ReactElement } from "react-markdown/lib/react-markdown"; export default function GenericNode({ data, @@ -46,6 +35,7 @@ export default function GenericNode({ const [validationStatus, setValidationStatus] = useState(null); // State for outline color const { sseData, isBuilding } = useSSE(); + const refHtml = useRef(null); // useEffect(() => { // if (reactFlowInstance) { @@ -103,11 +93,8 @@ export default function GenericNode({ color: nodeColors[types[data.type]] ?? nodeColors.unknown, }} /> -
- +
+
{data.node.display_name}
@@ -214,6 +201,7 @@ export default function GenericNode({ ? toTitleCase(data.node.template[t].name) : toTitleCase(t) } + info={data.node.template[t].info} name={t} tooltipTitle={data.node.template[t].type} required={data.node.template[t].required} diff --git a/src/frontend/src/components/ShadTooltipComponent/index.tsx b/src/frontend/src/components/ShadTooltipComponent/index.tsx index 44ffac075..aa31b534b 100644 --- a/src/frontend/src/components/ShadTooltipComponent/index.tsx +++ b/src/frontend/src/components/ShadTooltipComponent/index.tsx @@ -1,3 +1,4 @@ +import { ShadTooltipProps } from "../../types/components"; import { Tooltip, TooltipContent, @@ -5,18 +6,19 @@ import { TooltipTrigger, } from "../ui/tooltip"; -const ShadTooltip = (props) => { +const ShadTooltip = ({ + delayDuration = 500, + side, + content, + children, +}: ShadTooltipProps) => { return ( - - {props.children} + + {children} - - {props.content} + + {content} diff --git a/src/frontend/src/components/dropdownComponent/index.tsx b/src/frontend/src/components/dropdownComponent/index.tsx index 522078629..e252e1b21 100644 --- a/src/frontend/src/components/dropdownComponent/index.tsx +++ b/src/frontend/src/components/dropdownComponent/index.tsx @@ -1,9 +1,11 @@ import { Listbox, Transition } from "@headlessui/react"; -import { Fragment, useEffect, useState } from "react"; +import { Fragment, useContext, useEffect, useState } from "react"; import { DropDownComponentType } from "../../types/components"; import { classNames } from "../../utils"; import { INPUT_STYLE } from "../../constants"; import { ChevronsUpDown, Check } from "lucide-react"; +import { PopUpContext } from "../../contexts/popUpContext"; +import { TabsContext } from "../../contexts/tabsContext"; export default function Dropdown({ value, @@ -12,12 +14,15 @@ export default function Dropdown({ editNode = false, numberOfOptions = 0, }: DropDownComponentType) { + const { closePopUp } = useContext(PopUpContext); + let [internalValue, setInternalValue] = useState( value === "" || !value ? "Choose an option" : value ); + useEffect(() => { setInternalValue(value === "" || !value ? "Choose an option" : value); - }, [value]); + }, [closePopUp]); return ( <> diff --git a/src/frontend/src/components/floatComponent/index.tsx b/src/frontend/src/components/floatComponent/index.tsx index 2fc80962b..a7b382c31 100644 --- a/src/frontend/src/components/floatComponent/index.tsx +++ b/src/frontend/src/components/floatComponent/index.tsx @@ -2,6 +2,7 @@ import { useContext, useEffect, useState } from "react"; import { FloatComponentType } from "../../types/components"; import { TabsContext } from "../../contexts/tabsContext"; import { INPUT_STYLE } from "../../constants"; +import { PopUpContext } from "../../contexts/popUpContext"; export default function FloatComponent({ value, @@ -12,6 +13,7 @@ export default function FloatComponent({ }: FloatComponentType) { const [myValue, setMyValue] = useState(value ?? ""); const { setDisableCopyPaste } = useContext(TabsContext); + const { closePopUp } = useContext(PopUpContext); const step = 0.1; const min = 0; @@ -26,7 +28,7 @@ export default function FloatComponent({ useEffect(() => { setMyValue(value); - }, [value]); + }, [closePopUp]); return (
{ if (disabled) { setInputList([""]); onChange([""]); } }, [disabled, onChange]); + + useEffect(() => { + setInputList(value); + }, [closePopUp]); + return (
{ let newInputList = _.cloneDeep(old); newInputList[idx] = e.target.value; + onChange(newInputList); return newInputList; }); - onChange(inputList); }} /> {idx === inputList.length - 1 ? ( diff --git a/src/frontend/src/components/intComponent/index.tsx b/src/frontend/src/components/intComponent/index.tsx index 1c1bc9872..7ed484b3b 100644 --- a/src/frontend/src/components/intComponent/index.tsx +++ b/src/frontend/src/components/intComponent/index.tsx @@ -3,6 +3,7 @@ import { FloatComponentType } from "../../types/components"; import { TabsContext } from "../../contexts/tabsContext"; import { classNames } from "../../utils"; import { INPUT_STYLE } from "../../constants"; +import { PopUpContext } from "../../contexts/popUpContext"; export default function IntComponent({ value, @@ -14,6 +15,7 @@ export default function IntComponent({ const [myValue, setMyValue] = useState(value ?? ""); const { setDisableCopyPaste } = useContext(TabsContext); const min = 0; + const { closePopUp } = useContext(PopUpContext); useEffect(() => { if (disabled) { @@ -24,7 +26,7 @@ export default function IntComponent({ useEffect(() => { setMyValue(value); - }, [value]); + }, [closePopUp]); return (
{ edge.className = ""; edge.style = { stroke: "#555555" }; }); } - function updateDisplay_name(node:NodeType,template:APIClassType) { - node.data.node.display_name = template["display_name"]?template["display_name"]:node.data.type; + + function updateDisplay_name(node: NodeType, template: APIClassType) { + node.data.node.display_name = template["display_name"] || node.data.type; + } + + function updateNodeDocumentation(node: NodeType, template: APIClassType) { + node.data.node.documentation = template["documentation"]; } function processFlowNodes(flow) { - if(!flow.data || !flow.data.nodes) return; - flow.data.nodes.forEach((node:NodeType) => { + if (!flow.data || !flow.data.nodes) return; + flow.data.nodes.forEach((node: NodeType) => { const template = templates[node.data.type]; if (!template) { setErrorData({ title: `Unknown node type: ${node.data.type}` }); return; } if (Object.keys(template["template"]).length > 0) { - updateDisplay_name(node,template); + updateDisplay_name(node, template); updateNodeBaseClasses(node, template); updateNodeEdges(flow, node, template); updateNodeDescription(node, template); updateNodeTemplate(node, template); + updateNodeDocumentation(node, template); } }); } - function updateNodeBaseClasses(node:NodeType,template:APIClassType) { + function updateNodeBaseClasses(node: NodeType, template: APIClassType) { node.data.node.base_classes = template["base_classes"]; } - function updateNodeEdges(flow:FlowType, node:NodeType,template:APIClassType) { + function updateNodeEdges( + flow: FlowType, + node: NodeType, + template: APIClassType + ) { flow.data.edges.forEach((edge) => { if (edge.source === node.id) { edge.sourceHandle = edge.sourceHandle @@ -236,11 +246,11 @@ export function TabsProvider({ children }: { children: ReactNode }) { }); } - function updateNodeDescription(node:NodeType,template:APIClassType) { + function updateNodeDescription(node: NodeType, template: APIClassType) { node.data.node.description = template["description"]; } - function updateNodeTemplate(node:NodeType,template:APIClassType) { + function updateNodeTemplate(node: NodeType, template: APIClassType) { node.data.node.template = updateTemplate( template["template"] as unknown as APITemplateType, node.data.node.template as APITemplateType @@ -404,7 +414,7 @@ export function TabsProvider({ children }: { children: ReactNode }) { y: insidePosition.y + n.position.y - minimumY, }, data: { - ...n.data, + ..._.cloneDeep(n.data), id: newId, }, }; diff --git a/src/frontend/src/controllers/API/index.ts b/src/frontend/src/controllers/API/index.ts index 2651a0058..cfae748d8 100644 --- a/src/frontend/src/controllers/API/index.ts +++ b/src/frontend/src/controllers/API/index.ts @@ -311,7 +311,7 @@ export async function getBuildStatus( export async function postBuildInit( flow: FlowType ): Promise> { - return await axios.post(`/api/v1/build/init`, flow); + return await axios.post(`/api/v1/build/init/${flow.id}`, flow); } // fetch(`/upload/${id}`, { diff --git a/src/frontend/src/modals/ApiModal/index.tsx b/src/frontend/src/modals/ApiModal/index.tsx index 8b373c4e2..d6fff5d9f 100644 --- a/src/frontend/src/modals/ApiModal/index.tsx +++ b/src/frontend/src/modals/ApiModal/index.tsx @@ -103,7 +103,9 @@ export default function ApiModal({ flow }: { flow: FlowType }) {
{tabs.map((tab, index) => ( - {tab.name} + + {tab.name} + ))}
diff --git a/src/frontend/src/modals/EditNodeModal/index.tsx b/src/frontend/src/modals/EditNodeModal/index.tsx index fa7563bfb..e2f9c7bca 100644 --- a/src/frontend/src/modals/EditNodeModal/index.tsx +++ b/src/frontend/src/modals/EditNodeModal/index.tsx @@ -79,7 +79,7 @@ export default function EditNodeModal({ data }: { data: NodeDataType }) { } return ( - + diff --git a/src/frontend/src/pages/FlowPage/components/extraSidebarComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/extraSidebarComponent/index.tsx index b4f380164..5da2d8e28 100644 --- a/src/frontend/src/pages/FlowPage/components/extraSidebarComponent/index.tsx +++ b/src/frontend/src/pages/FlowPage/components/extraSidebarComponent/index.tsx @@ -62,7 +62,7 @@ export default function ExtraSidebar() { return (
- + - + - + - + - {nodeLength > 0 && ( - - - - )} + } + }} + > + + + + + + + {/* -