diff --git a/poetry.lock b/poetry.lock index 0760411e8..7c08dfd02 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1294,14 +1294,14 @@ files = [ [[package]] name = "exceptiongroup" -version = "1.1.1" +version = "1.1.2" description = "Backport of PEP 654 (exception groups)" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "exceptiongroup-1.1.1-py3-none-any.whl", hash = "sha256:232c37c63e4f682982c8b6459f33a8981039e5fb8756b2074364e5055c498c9e"}, - {file = "exceptiongroup-1.1.1.tar.gz", hash = "sha256:d484c3090ba2889ae2928419117447a14daf3c1231d5e30d0aae34f354f01785"}, + {file = "exceptiongroup-1.1.2-py3-none-any.whl", hash = "sha256:e346e69d186172ca7cf029c8c1d16235aa0e04035e5750b4b95039e65204328f"}, + {file = "exceptiongroup-1.1.2.tar.gz", hash = "sha256:12c3e887d6485d16943a309616de20ae5582633e0a2eda17f4e10fd61c1e8af5"}, ] [package.extras] @@ -1374,19 +1374,20 @@ importlib-resources = {version = ">=5.0", markers = "python_version < \"3.10\""} [[package]] name = "fastapi" -version = "0.98.0" +version = "0.99.1" description = "FastAPI framework, high performance, easy to learn, fast to code, ready for production" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "fastapi-0.98.0-py3-none-any.whl", hash = "sha256:f4165fb1fe3610c52cb1b8282c1480de9c34bc270f56a965aa93a884c350d605"}, - {file = "fastapi-0.98.0.tar.gz", hash = "sha256:0d3c18886f652038262b5898fec6b09f4ca92ee23e9d9b1d1d24e429f84bf27b"}, + {file = "fastapi-0.99.1-py3-none-any.whl", hash = "sha256:976df7bab51ac7beda9f68c4513b8c4490b5c1135c72aafd0a5ee4023ec5282e"}, + {file = "fastapi-0.99.1.tar.gz", hash = "sha256:ac78f717cd80d657bd183f94d33b9bda84aa376a46a9dab513586b8eef1dc6fc"}, ] [package.dependencies] pydantic = ">=1.7.4,<1.8 || >1.8,<1.8.1 || >1.8.1,<2.0.0" starlette = ">=0.27.0,<0.28.0" +typing-extensions = ">=4.5.0" [package.extras] all = ["email-validator (>=1.1.1)", "httpx (>=0.23.0)", "itsdangerous (>=1.1.0)", "jinja2 (>=2.11.2)", "orjson (>=3.2.1)", "python-multipart (>=0.0.5)", "pyyaml (>=5.3.1)", "ujson (>=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0)", "uvicorn[standard] (>=0.12.0)"] @@ -5218,14 +5219,14 @@ diagrams = ["jinja2", "railroad-diagrams"] [[package]] name = "pypdf" -version = "3.11.1" +version = "3.12.0" 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.1-py3-none-any.whl", hash = "sha256:2afc8914355a784fb184f60ae82fe10f9b992aa0733b705f0746966e470f98bd"}, - {file = "pypdf-3.11.1.tar.gz", hash = "sha256:198c4d0231525d0b730cbbd11a5fc7d9a2e410dfc8ae2928c8de000b7ef149c5"}, + {file = "pypdf-3.12.0-py3-none-any.whl", hash = "sha256:826ad4681660394d7a5742fe8380168cf13058e27b826b7f5b798e994cb77b38"}, + {file = "pypdf-3.12.0.tar.gz", hash = "sha256:cebac920db0698369f49c389018858a5436862bf3c45b64b10c55c008878db95"}, ] [package.dependencies] @@ -7830,4 +7831,4 @@ deploy = ["langchain-serve"] [metadata] lock-version = "2.0" python-versions = ">=3.9,<3.11" -content-hash = "3b615d7e85c445b293174b2cb1d395e375edce224c0da51e03c3767c4892e662" +content-hash = "814dc6b89b345e3ea08c7b7dc1fb29e3f8484070e3ad67030eb67566b33f12b0" diff --git a/pyproject.toml b/pyproject.toml index a9df0a27a..d02b284cd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "langflow" -version = "0.2.10" +version = "0.2.11" description = "A Python package with a built-in web application" authors = ["Logspace "] maintainers = [ @@ -23,7 +23,7 @@ langflow = "langflow.__main__:main" [tool.poetry.dependencies] python = ">=3.9,<3.11" -fastapi = "^0.98.0" +fastapi = "^0.99.0" uvicorn = "^0.22.0" beautifulsoup4 = "^4.12.2" google-search-results = "^2.4.1" diff --git a/src/backend/langflow/api/v1/chat.py b/src/backend/langflow/api/v1/chat.py index bf1b52058..e47c31694 100644 --- a/src/backend/langflow/api/v1/chat.py +++ b/src/backend/langflow/api/v1/chat.py @@ -113,6 +113,14 @@ async def stream_build(flow_id: str): number_of_nodes = len(graph.nodes) flow_data_store[flow_id]["status"] = BuildStatus.IN_PROGRESS + # To deal with the ZeroShotAgent case + # we need to build the root node first + # and then the rest of the graph + # This is a big problem because certain nodes require + # params that are not connected to it. + # We should consider connecting the tools to the ZeroShotPrompt + graph.build() + for i, vertex in enumerate(graph.generator_build(), 1): try: log_dict = { diff --git a/src/frontend/src/components/chatComponent/chatMessage/index.tsx b/src/frontend/src/components/chatComponent/chatMessage/index.tsx index 53445e13f..55badac86 100644 --- a/src/frontend/src/components/chatComponent/chatMessage/index.tsx +++ b/src/frontend/src/components/chatComponent/chatMessage/index.tsx @@ -28,7 +28,7 @@ export default function ChatMessage({ chat }: { chat: ChatMessageType }) {
setHidden((prev) => !prev)} style={{ backgroundColor: nodeColors["thought"] }} - className="inline-block w-full cursor-pointer px-5 pb-3 pt-3 text-start" + className=" inline-block w-full cursor-pointer px-5 pb-3 pt-3 text-start" dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(convert.toHtml(chat.thought)), }} diff --git a/src/frontend/src/components/codeAreaComponent/index.tsx b/src/frontend/src/components/codeAreaComponent/index.tsx index ea6f93798..dab3d9699 100644 --- a/src/frontend/src/components/codeAreaComponent/index.tsx +++ b/src/frontend/src/components/codeAreaComponent/index.tsx @@ -3,7 +3,12 @@ import { PopUpContext } from "../../contexts/popUpContext"; import CodeAreaModal from "../../modals/codeAreaModal"; import TextAreaModal from "../../modals/textAreaModal"; import { TextAreaComponentType } from "../../types/components"; -import { INPUT_STYLE } from "../../constants"; +import { + INPUT_DIALOG, + INPUT_DISABLE, + INPUT_EDIT_NODE, + INPUT_STYLE, +} from "../../constants"; import { ExternalLink } from "lucide-react"; export default function CodeAreaComponent({ @@ -48,11 +53,8 @@ export default function CodeAreaComponent({ }} className={ editNode - ? "form-input block w-full cursor-pointer truncate rounded-md border border-ring bg-transparent pb-0.5 pt-0.5 text-sm text-ring shadow-sm placeholder:text-center sm:text-sm" + - INPUT_STYLE - : "block w-full truncate rounded-md border border-ring px-3 py-2 text-ring shadow-sm placeholder:text-muted-foreground sm:text-sm" + - INPUT_STYLE + - (disabled ? " bg-input" : "") + ? INPUT_EDIT_NODE + INPUT_DIALOG + : INPUT_STYLE + INPUT_DIALOG + (disabled ? INPUT_DISABLE : "") } > {myValue !== "" ? myValue : "Type something..."} diff --git a/src/frontend/src/components/dropdownComponent/index.tsx b/src/frontend/src/components/dropdownComponent/index.tsx index 4e8c06781..27d355cd2 100644 --- a/src/frontend/src/components/dropdownComponent/index.tsx +++ b/src/frontend/src/components/dropdownComponent/index.tsx @@ -2,7 +2,7 @@ import { Listbox, Transition } from "@headlessui/react"; import { Fragment, useContext, useEffect, useState } from "react"; import { DropDownComponentType } from "../../types/components"; import { classNames } from "../../utils"; -import { INPUT_STYLE } from "../../constants"; +import { INPUT_EDIT_NODE, INPUT_STYLE } from "../../constants"; import { ChevronsUpDown, Check } from "lucide-react"; import { PopUpContext } from "../../contexts/popUpContext"; import { TabsContext } from "../../contexts/tabsContext"; @@ -40,10 +40,8 @@ export default function Dropdown({ diff --git a/src/frontend/src/components/floatComponent/index.tsx b/src/frontend/src/components/floatComponent/index.tsx index 4b80a365f..b725c7490 100644 --- a/src/frontend/src/components/floatComponent/index.tsx +++ b/src/frontend/src/components/floatComponent/index.tsx @@ -1,7 +1,7 @@ import { useContext, useEffect, useState } from "react"; import { FloatComponentType } from "../../types/components"; import { TabsContext } from "../../contexts/tabsContext"; -import { INPUT_STYLE } from "../../constants"; +import { INPUT_DISABLE, INPUT_EDIT_NODE, INPUT_STYLE } from "../../constants"; import { PopUpContext } from "../../contexts/popUpContext"; export default function FloatComponent({ @@ -58,11 +58,8 @@ export default function FloatComponent({ value={myValue} className={ editNode - ? "form-input block w-full rounded-md border border-border pb-0.5 pt-0.5 text-center shadow-sm placeholder:text-center placeholder:text-muted-foreground focus:placeholder-transparent sm:text-sm" + - INPUT_STYLE - : "form-input block w-full rounded-md border-border bg-background shadow-sm ring-offset-input placeholder:text-muted-foreground focus:placeholder-transparent sm:text-sm" + - INPUT_STYLE + - (disabled ? " bg-input" : "") + ? INPUT_EDIT_NODE + : INPUT_STYLE + (disabled ? INPUT_DISABLE : "") } placeholder={ editNode ? "Number 0 to 1" : "Type a number from zero to one" diff --git a/src/frontend/src/components/inputComponent/index.tsx b/src/frontend/src/components/inputComponent/index.tsx index 125f260ac..b8db68274 100644 --- a/src/frontend/src/components/inputComponent/index.tsx +++ b/src/frontend/src/components/inputComponent/index.tsx @@ -3,7 +3,7 @@ import { InputComponentType } from "../../types/components"; import { classNames } from "../../utils"; import { TabsContext } from "../../contexts/tabsContext"; import { PopUpContext } from "../../contexts/popUpContext"; -import { INPUT_STYLE } from "../../constants"; +import { INPUT_DISABLE, INPUT_EDIT_NODE, INPUT_STYLE } from "../../constants"; export default function InputComponent({ value, @@ -46,13 +46,10 @@ export default function InputComponent({ if (disableCopyPaste) setDisableCopyPaste(false); }} className={classNames( - "form-input block w-full rounded-md border-ring bg-background pr-12 shadow-sm placeholder:text-muted-foreground focus:placeholder-transparent sm:text-sm", - disabled ? " bg-input" : "", + " pr-12 ", + disabled ? INPUT_DISABLE : "", password && !pwdVisible && myValue !== "" ? "password" : "", - editNode - ? "form-input block w-full rounded-md border border-ring pb-0.5 pt-0.5 text-center shadow-sm sm:text-sm" + - INPUT_STYLE - : "ring-offset-input" + INPUT_STYLE, + editNode ? INPUT_EDIT_NODE : INPUT_STYLE, password && editNode ? "pr-8" : "pr-3" )} placeholder={password && editNode ? "Key" : "Type something..."} diff --git a/src/frontend/src/components/inputFileComponent/index.tsx b/src/frontend/src/components/inputFileComponent/index.tsx index c63c846a3..30e3d729e 100644 --- a/src/frontend/src/components/inputFileComponent/index.tsx +++ b/src/frontend/src/components/inputFileComponent/index.tsx @@ -2,7 +2,7 @@ import { useContext, useEffect, useState } from "react"; import { alertContext } from "../../contexts/alertContext"; import { FileComponentType } from "../../types/components"; import { TabsContext } from "../../contexts/tabsContext"; -import { INPUT_STYLE } from "../../constants"; +import { INPUT_DISABLE, INPUT_EDIT_NODE, INPUT_STYLE } from "../../constants"; import { FileSearch2 } from "lucide-react"; import { uploadFile } from "../../controllers/API"; @@ -103,11 +103,8 @@ export default function InputFileComponent({ onClick={handleButtonClick} className={ editNode - ? "form-input block w-full truncate rounded-md border border-ring pb-0.5 pt-0.5 text-ring shadow-sm placeholder:text-center sm:text-sm" + - INPUT_STYLE - : "block w-full truncate rounded-md border border-ring px-3 py-2 text-ring shadow-sm sm:text-sm" + - INPUT_STYLE + - (disabled ? " bg-input" : "") + ? INPUT_EDIT_NODE + INPUT_STYLE + : INPUT_STYLE + (disabled ? INPUT_DISABLE : "") } > {myValue !== "" ? myValue : "No file"} diff --git a/src/frontend/src/components/inputListComponent/index.tsx b/src/frontend/src/components/inputListComponent/index.tsx index 02e0430df..8e2321f1f 100644 --- a/src/frontend/src/components/inputListComponent/index.tsx +++ b/src/frontend/src/components/inputListComponent/index.tsx @@ -3,7 +3,7 @@ import { InputListComponentType } from "../../types/components"; import { TabsContext } from "../../contexts/tabsContext"; import _ from "lodash"; -import { INPUT_STYLE } from "../../constants"; +import { INPUT_DISABLE, INPUT_EDIT_NODE, INPUT_STYLE } from "../../constants"; import { X, Plus } from "lucide-react"; import { PopUpContext } from "../../contexts/popUpContext"; @@ -35,60 +35,57 @@ export default function InputListComponent({ "flex flex-col gap-3" } > - {inputList.map((i, idx) => ( -
- { - setInputList((old) => { - let newInputList = _.cloneDeep(old); - newInputList[idx] = e.target.value; - onChange(newInputList); - return newInputList; - }); - }} - /> - {idx === inputList.length - 1 ? ( - - ) : ( - - )} -
- ))} + /> + {idx === inputList.length - 1 ? ( + + ) : ( + + )} +
+ ); + })} ); } diff --git a/src/frontend/src/components/intComponent/index.tsx b/src/frontend/src/components/intComponent/index.tsx index 4d1a7a079..b4b863622 100644 --- a/src/frontend/src/components/intComponent/index.tsx +++ b/src/frontend/src/components/intComponent/index.tsx @@ -2,7 +2,7 @@ import { useContext, useEffect, useState } from "react"; import { FloatComponentType } from "../../types/components"; import { TabsContext } from "../../contexts/tabsContext"; import { classNames } from "../../utils"; -import { INPUT_STYLE } from "../../constants"; +import { INPUT_DISABLE, INPUT_EDIT_NODE, INPUT_STYLE } from "../../constants"; import { PopUpContext } from "../../contexts/popUpContext"; export default function IntComponent({ @@ -72,11 +72,8 @@ export default function IntComponent({ value={myValue} className={ editNode - ? "form-input block w-full rounded-md border pb-0.5 pt-0.5 text-center shadow-sm placeholder:text-center placeholder:text-muted-foreground focus:placeholder-transparent sm:text-sm" + - INPUT_STYLE - : "form-input block w-full rounded-md bg-background shadow-sm ring-offset-background placeholder:text-muted-foreground focus:placeholder-transparent sm:text-sm" + - INPUT_STYLE + - (disabled ? " bg-input" : "") + ? INPUT_EDIT_NODE + : INPUT_STYLE + (disabled ? INPUT_DISABLE : "") } placeholder={editNode ? "Integer number" : "Type an integer number"} onChange={(e) => { diff --git a/src/frontend/src/components/promptComponent/index.tsx b/src/frontend/src/components/promptComponent/index.tsx index 09d22d568..16a06b71d 100644 --- a/src/frontend/src/components/promptComponent/index.tsx +++ b/src/frontend/src/components/promptComponent/index.tsx @@ -3,7 +3,12 @@ import { PopUpContext } from "../../contexts/popUpContext"; import { TextAreaComponentType } from "../../types/components"; import GenericModal from "../../modals/genericModal"; import { TypeModal } from "../../utils"; -import { INPUT_STYLE } from "../../constants"; +import { + INPUT_DIALOG, + INPUT_DISABLE, + INPUT_EDIT_NODE, + INPUT_STYLE, +} from "../../constants"; import { ExternalLink } from "lucide-react"; export default function PromptAreaComponent({ @@ -49,10 +54,8 @@ export default function PromptAreaComponent({ }} className={ editNode - ? "cursor-pointer truncate placeholder:text-center text-ring border-1 block w-full pt-0.5 pb-0.5 form-input text-sm rounded-md border-ring shadow-sm sm:text-sm" + - INPUT_STYLE - : "block w-full truncate rounded-md border border-ring px-3 py-2 text-ring shadow-sm sm:text-sm" + - (disabled ? " bg-input" : "") + ? INPUT_EDIT_NODE + INPUT_DIALOG + : (disabled ? INPUT_DISABLE : "") + INPUT_STYLE + INPUT_DIALOG } > {myValue !== "" ? myValue : "Type your prompt here"} diff --git a/src/frontend/src/components/textAreaComponent/index.tsx b/src/frontend/src/components/textAreaComponent/index.tsx index 906e7093d..66bcf72bd 100644 --- a/src/frontend/src/components/textAreaComponent/index.tsx +++ b/src/frontend/src/components/textAreaComponent/index.tsx @@ -3,7 +3,12 @@ import { PopUpContext } from "../../contexts/popUpContext"; import { TextAreaComponentType } from "../../types/components"; import GenericModal from "../../modals/genericModal"; import { TypeModal } from "../../utils"; -import { INPUT_STYLE } from "../../constants"; +import { + INPUT_DIALOG, + INPUT_DISABLE, + INPUT_EDIT_NODE, + INPUT_STYLE, +} from "../../constants"; import { ExternalLink } from "lucide-react"; export default function TextAreaComponent({ @@ -52,10 +57,8 @@ export default function TextAreaComponent({ }} className={ editNode - ? "form-input block w-full cursor-pointer truncate rounded-md border border-ring bg-transparent pb-0.5 pt-0.5 text-ring shadow-sm placeholder:text-center sm:text-sm" + - INPUT_STYLE - : "block w-full truncate rounded-md border border-ring px-3 py-2 text-ring shadow-sm sm:text-sm" + - (disabled ? " bg-input" : "") + ? INPUT_EDIT_NODE + INPUT_DIALOG + : INPUT_DIALOG + "px-3 py-2" + (disabled ? INPUT_DISABLE : "") } > {myValue !== "" ? myValue : "Type something..."} diff --git a/src/frontend/src/constants.tsx b/src/frontend/src/constants.tsx index e855cdaa2..08b03787a 100644 --- a/src/frontend/src/constants.tsx +++ b/src/frontend/src/constants.tsx @@ -167,12 +167,36 @@ export const EXPORT_CODE_DIALOG = "Generate the code to integrate your flow into an external application."; /** - * The base text for subtitle of code dialog + * The base input for clickable ones + * @constant + */ +export const INPUT_DIALOG = " text-ring cursor-pointer bg-transparent"; + +/** + * The base input style * @constant */ export const INPUT_STYLE = - " focus:tw-ring-none border-border focus-visible:outline-none focus:ring-ring focus:ring-1 bg-background focus:outline-none"; + " bg-background block border-ring focus:placeholder-transparent focus:ring-ring focus:tw-ring-none form-input px-3 placeholder:text-muted-foreground rounded-md shadow-sm sm:text-sm truncate w-full "; +/** + * The base input on edit node + * @constant + */ +export const INPUT_EDIT_NODE = + " placeholder:text-center pt-0.5 pb-0.5 text-center " + INPUT_STYLE; + +/** + * The base search input style + * @constant + */ +export const INPUT_SEARCH = INPUT_STYLE + " pr-7 mx-2 "; + +/** + * The base disable input style + * @constant + */ +export const INPUT_DISABLE = " bg-input "; /** * The base text for subtitle of code dialog * @constant diff --git a/src/frontend/src/pages/FlowPage/components/extraSidebarComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/extraSidebarComponent/index.tsx index 66867a0d1..fc8b62767 100644 --- a/src/frontend/src/pages/FlowPage/components/extraSidebarComponent/index.tsx +++ b/src/frontend/src/pages/FlowPage/components/extraSidebarComponent/index.tsx @@ -15,7 +15,7 @@ import ExportModal from "../../../../modals/exportModal"; import ApiModal from "../../../../modals/ApiModal"; import { TabsContext } from "../../../../contexts/tabsContext"; import { alertContext } from "../../../../contexts/alertContext"; -import { INPUT_STYLE } from "../../../../constants"; +import { INPUT_SEARCH, INPUT_STYLE } from "../../../../constants"; import { Separator } from "../../../../components/ui/separator"; import { Menu } from "lucide-react"; @@ -124,10 +124,7 @@ export default function ExtraSidebar() { name="search" id="search" placeholder="Search" - className={ - INPUT_STYLE + - "w-full rounded-md border border border-input bg-transparent px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50" - } + className={INPUT_SEARCH} onChange={(e) => { handleSearchInput(e.target.value); setSearch(e.target.value); @@ -183,7 +180,7 @@ export default function ExtraSidebar() { ); }} > -
+
{data[d][t].display_name}