Merge branch 'zustand/io/migration' into cz/new-tests

This commit is contained in:
cristhianzl 2024-04-01 21:29:38 -03:00
commit fe743fd0fa
11 changed files with 1328 additions and 1330 deletions

View file

View file

@ -2,7 +2,7 @@ import Admonition from '@theme/Admonition';
# Outputs
### ChatOutput
## Chat Output
This component is designed to send a message to the chat.
@ -22,7 +22,7 @@ This component is designed to send a message to the chat.
</p>
</Admonition>
### TextOutput
## Text Output
This component is designed to display text data to the user. It's particularly useful for scenarios where you don't want to send the text data to the chat, but still want to display it.

200
poetry.lock generated
View file

@ -2666,21 +2666,6 @@ protobuf = ">=3.19.5,<3.20.0 || >3.20.0,<3.20.1 || >3.20.1,<4.21.1 || >4.21.1,<4
[package.extras]
grpc = ["grpcio (>=1.44.0,<2.0.0.dev0)"]
[[package]]
name = "gotrue"
version = "2.4.2"
description = "Python Client Library for Supabase Auth"
optional = false
python-versions = "<4.0,>=3.8"
files = [
{file = "gotrue-2.4.2-py3-none-any.whl", hash = "sha256:64cd40933d1f0a5d5cc4f4bd93bc51d730b94812447b6600f774790a4901e455"},
{file = "gotrue-2.4.2.tar.gz", hash = "sha256:e100745161f1c58dd05b9c1ef8bcd4cd78cdfb38d8d2c253ade63143a3dc6aeb"},
]
[package.dependencies]
httpx = ">=0.23,<0.28"
pydantic = ">=1.10,<3"
[[package]]
name = "greenlet"
version = "3.0.3"
@ -3908,60 +3893,53 @@ name = "langflow-base"
version = "0.0.13"
description = "A Python package with a built-in web application"
optional = false
python-versions = ">=3.10,<3.12"
files = []
develop = true
python-versions = "<3.12,>=3.10"
files = [
{file = "langflow_base-0.0.13-py3-none-any.whl", hash = "sha256:86a8cd4f4dac68a1c00b4fe434cd5df1ef4af939295a1a5516e4cc14aaf79e7a"},
{file = "langflow_base-0.0.13.tar.gz", hash = "sha256:b7ee7d93e29c20bdb2a1431498d5715ed2a8fbfe9ca5d7d49926a9a10937e8c2"},
]
[package.dependencies]
alembic = "^1.13.0"
alembic = ">=1.13.0,<2.0.0"
bcrypt = "4.0.1"
cachetools = "^5.3.1"
chromadb = "^0.4.24"
docstring-parser = "^0.15"
duckdb = "^0.9.2"
fastapi = "^0.109.0"
gunicorn = "^21.2.0"
httpx = "^0.25"
jq = {version = "^1.7.0", markers = "sys_platform != \"win32\""}
langchain = "~0.1.0"
langchain-anthropic = "^0.1.4"
langchain-astradb = "^0.1.0"
cachetools = ">=5.3.1,<6.0.0"
chromadb = ">=0.4.24,<0.5.0"
docstring-parser = ">=0.15,<0.16"
duckdb = ">=0.9.2,<0.10.0"
fastapi = ">=0.109.0,<0.110.0"
gunicorn = ">=21.2.0,<22.0.0"
httpx = ">=0.25,<0.26"
jq = {version = ">=1.7.0,<2.0.0", markers = "sys_platform != \"win32\""}
langchain = ">=0.1.0,<0.2.0"
langchain-anthropic = ">=0.1.4,<0.2.0"
langchain-astradb = ">=0.1.0,<0.2.0"
langchain-experimental = "*"
loguru = "^0.7.1"
multiprocess = "^0.70.14"
opentelemetry-api = "^1.23.0"
opentelemetry-exporter-otlp = "^1.23.0"
opentelemetry-instrumentation-asgi = "^0.44b0"
opentelemetry-instrumentation-fastapi = "^0.44b0"
opentelemetry-instrumentation-httpx = "^0.44b0"
opentelemetry-sdk = "^1.23.0"
loguru = ">=0.7.1,<0.8.0"
multiprocess = ">=0.70.14,<0.71.0"
opentelemetry-api = ">=1.23.0,<2.0.0"
opentelemetry-exporter-otlp = ">=1.23.0,<2.0.0"
opentelemetry-instrumentation-asgi = ">=0.44b0,<0.45"
opentelemetry-instrumentation-fastapi = ">=0.44b0,<0.45"
opentelemetry-instrumentation-httpx = ">=0.44b0,<0.45"
opentelemetry-sdk = ">=1.23.0,<2.0.0"
orjson = "3.9.15"
pandas = "2.2.0"
passlib = "^1.7.4"
pillow = "^10.2.0"
platformdirs = "^4.2.0"
pydantic = "^2.5.0"
pydantic-settings = "^2.1.0"
pypdf = "^4.1.0"
python-docx = "^1.1.0"
python-jose = "^3.3.0"
python-multipart = "^0.0.7"
python-socketio = "^5.11.0"
rich = "^13.7.0"
sqlmodel = "^0.0.14"
typer = "^0.9.0"
uvicorn = "^0.27.0"
passlib = ">=1.7.4,<2.0.0"
pillow = ">=10.2.0,<11.0.0"
platformdirs = ">=4.2.0,<5.0.0"
pydantic = ">=2.5.0,<3.0.0"
pydantic-settings = ">=2.1.0,<3.0.0"
pypdf = ">=4.1.0,<5.0.0"
python-docx = ">=1.1.0,<2.0.0"
python-jose = ">=3.3.0,<4.0.0"
python-multipart = ">=0.0.7,<0.0.8"
python-socketio = ">=5.11.0,<6.0.0"
rich = ">=13.7.0,<14.0.0"
sqlmodel = ">=0.0.14,<0.0.15"
typer = ">=0.9.0,<0.10.0"
uvicorn = ">=0.27.0,<0.28.0"
websockets = "*"
[package.extras]
all = []
deploy = []
local = []
[package.source]
type = "directory"
url = "src/backend/base"
[[package]]
name = "langfuse"
version = "2.21.1"
@ -6150,23 +6128,6 @@ docs = ["sphinx (>=1.7.1)"]
redis = ["redis"]
tests = ["pytest (>=5.4.1)", "pytest-cov (>=2.8.1)", "pytest-mypy (>=0.8.0)", "pytest-timeout (>=2.1.0)", "redis", "sphinx (>=6.0.0)", "types-redis"]
[[package]]
name = "postgrest"
version = "0.16.2"
description = "PostgREST client for Python. This library provides an ORM interface to PostgREST."
optional = false
python-versions = "<4.0,>=3.8"
files = [
{file = "postgrest-0.16.2-py3-none-any.whl", hash = "sha256:cf89106d0877ac2c7b070ad136f78350eb89dbdd998cd83d6852010e0bcdb878"},
{file = "postgrest-0.16.2.tar.gz", hash = "sha256:6c5c8e53cdcede8b6654ddfc7505e5af0c41ce56c6935f7b1d05545bb899d8b8"},
]
[package.dependencies]
deprecation = ">=2.1.0,<3.0.0"
httpx = ">=0.24,<0.28"
pydantic = ">=1.9,<3.0"
strenum = ">=0.4.9,<0.5.0"
[[package]]
name = "posthog"
version = "3.5.0"
@ -7762,22 +7723,6 @@ files = [
[package.extras]
full = ["numpy"]
[[package]]
name = "realtime"
version = "1.0.3"
description = ""
optional = false
python-versions = "<4.0,>=3.8"
files = [
{file = "realtime-1.0.3-py3-none-any.whl", hash = "sha256:809b99a1c09390a4580ca2d37d84c85dffacb1804f80c6f5a4491d312c20e6e3"},
{file = "realtime-1.0.3.tar.gz", hash = "sha256:1a39b5dcdb345b4cc7fd43bc035feb38ca915c9248962f20d264625bc8eb2c4e"},
]
[package.dependencies]
python-dateutil = ">=2.8.1,<3.0.0"
typing-extensions = ">=4.2.0,<5.0.0"
websockets = ">=11,<13"
[[package]]
name = "red-black-tree-mod"
version = "1.20"
@ -8506,38 +8451,6 @@ anyio = ">=3.4.0,<5"
[package.extras]
full = ["httpx (>=0.22.0)", "itsdangerous", "jinja2", "python-multipart (>=0.0.7)", "pyyaml"]
[[package]]
name = "storage3"
version = "0.7.4"
description = "Supabase Storage client for Python."
optional = false
python-versions = "<4.0,>=3.8"
files = [
{file = "storage3-0.7.4-py3-none-any.whl", hash = "sha256:0b8e8839b10a64063796ce55a41462c7ffd6842e0ada74f25f5dcf37e1d1bade"},
{file = "storage3-0.7.4.tar.gz", hash = "sha256:61fcbf836f566405981722abb7d56caa57025b261e7a316e73316701abf0c040"},
]
[package.dependencies]
httpx = ">=0.24,<0.28"
python-dateutil = ">=2.8.2,<3.0.0"
typing-extensions = ">=4.2.0,<5.0.0"
[[package]]
name = "strenum"
version = "0.4.15"
description = "An Enum that inherits from str."
optional = false
python-versions = "*"
files = [
{file = "StrEnum-0.4.15-py3-none-any.whl", hash = "sha256:a30cda4af7cc6b5bf52c8055bc4bf4b2b6b14a93b574626da33df53cf7740659"},
{file = "StrEnum-0.4.15.tar.gz", hash = "sha256:878fb5ab705442070e4dd1929bb5e2249511c0bcf2b0eeacf3bcd80875c82eff"},
]
[package.extras]
docs = ["myst-parser[linkify]", "sphinx", "sphinx-rtd-theme"]
release = ["twine"]
test = ["pylint", "pytest", "pytest-black", "pytest-cov", "pytest-pylint"]
[[package]]
name = "striprtf"
version = "0.0.26"
@ -8549,39 +8462,6 @@ files = [
{file = "striprtf-0.0.26.tar.gz", hash = "sha256:fdb2bba7ac440072d1c41eab50d8d74ae88f60a8b6575c6e2c7805dc462093aa"},
]
[[package]]
name = "supabase"
version = "2.4.1"
description = "Supabase client for Python."
optional = false
python-versions = "<4.0,>=3.8"
files = [
{file = "supabase-2.4.1-py3-none-any.whl", hash = "sha256:8b95744ce4ad24245ec23c090f273dfc9c2d9a53e3a80186959903947dbe1ed6"},
{file = "supabase-2.4.1.tar.gz", hash = "sha256:a7dec0586f8931f378a45b2ffb28d8e37b3719f979c17f541b0156019144e645"},
]
[package.dependencies]
gotrue = ">=1.3,<3.0"
httpx = ">=0.24,<0.28"
postgrest = ">=0.10.8,<0.17.0"
realtime = ">=1.0.0,<2.0.0"
storage3 = ">=0.5.3,<0.8.0"
supafunc = ">=0.3.1,<0.5.0"
[[package]]
name = "supafunc"
version = "0.4.5"
description = "Library for Supabase Functions"
optional = false
python-versions = "<4.0,>=3.8"
files = [
{file = "supafunc-0.4.5-py3-none-any.whl", hash = "sha256:2208045f8f5c797924666f6a332efad75ad368f8030b2e4ceb9d2bf63f329373"},
{file = "supafunc-0.4.5.tar.gz", hash = "sha256:a6466d78bdcaa58b7f0303793643103baae8106a87acd5d01e196179a9d0d024"},
]
[package.dependencies]
httpx = ">=0.24,<0.28"
[[package]]
name = "sympy"
version = "1.12"
@ -10283,4 +10163,4 @@ local = ["ctransformers", "llama-cpp-python", "sentence-transformers"]
[metadata]
lock-version = "2.0"
python-versions = ">=3.10,<3.12"
content-hash = "b66acb0ed04e62c9f311828307ac1503bc7a19912753c217d4ea6237f474543a"
content-hash = "b1b40cf39cc544faf5ca6ad04a2be009df7d8d343d86c1e9d7c02d21b2cad431"

View file

@ -28,8 +28,8 @@ enable = true
[tool.poetry.dependencies]
python = ">=3.10,<3.12"
langflow-base = { path = "./src/backend/base", develop = true }
# langflow-base = { path = "./src/backend/base", develop = true }
langflow-base = "0.0.13"
beautifulsoup4 = "^4.12.2"
google-search-results = "^2.4.1"
google-api-python-client = "^2.118.0"
@ -50,7 +50,6 @@ faiss-cpu = "^1.7.4"
types-cachetools = "^5.3.0.5"
pinecone-client = "^3.0.3"
pymongo = "^4.6.0"
supabase = "^2.3.0"
certifi = "^2023.11.17"
psycopg = "^3.1.9"
psycopg-binary = "^3.1.9"
@ -61,7 +60,7 @@ flower = { version = "^2.0.0", optional = true }
metaphor-python = "^0.1.11"
zep-python = "*"
pywin32 = { version = "^306", markers = "sys_platform == 'win32'" }
langfuse = "^2.9.0"
langfuse = "*"
metal-sdk = "^2.5.0"
markupsafe = "^2.1.3"
extract-msg = "^0.47.0"

View file

@ -1955,13 +1955,13 @@ test = ["Cython (>=0.29.24,<0.30.0)"]
[[package]]
name = "httpx"
version = "0.25.2"
version = "0.27.0"
description = "The next generation HTTP client."
optional = false
python-versions = ">=3.8"
files = [
{file = "httpx-0.25.2-py3-none-any.whl", hash = "sha256:a05d3d052d9b2dfce0e3896636467f8a5342fb2b902c819428e1ac65413ca118"},
{file = "httpx-0.25.2.tar.gz", hash = "sha256:8b8fcaa0c8ea7b05edd69a094e63a2094c4efcb48129fb757361bc423c0ad9e8"},
{file = "httpx-0.27.0-py3-none-any.whl", hash = "sha256:71d5465162c13681bff01ad59b2cc68dd838ea1f10e51574bac27103f00c91a5"},
{file = "httpx-0.27.0.tar.gz", hash = "sha256:a0cb88a46f32dc874e04ee956e4c2764aba2aa228f650b06788ba6bda2962ab5"},
]
[package.dependencies]
@ -6083,4 +6083,4 @@ local = []
[metadata]
lock-version = "2.0"
python-versions = ">=3.10,<3.12"
content-hash = "95ecb4112719931edb680b2749b1302f99c76ae15fe6d4be0eed972d73df8aa1"
content-hash = "5a06c86bfbf2cc209bcb3f202bd749af1c8146aa08c10fd69152c170f890866d"

View file

@ -28,7 +28,7 @@ langflow-base = "langflow.__main__:main"
[tool.poetry.dependencies]
python = ">=3.10,<3.12"
fastapi = "^0.109.0"
httpx = "^0.25"
httpx = "*"
uvicorn = "^0.27.0"
gunicorn = "^21.2.0"
langchain = "~0.1.0"

View file

@ -205,10 +205,7 @@ export default function CodeTabsComponent({
<div className="api-modal-according-display">
<div
className={classNames(
"h-[70vh] w-full rounded-lg bg-muted",
1 == 1
? "overflow-scroll overflow-x-hidden custom-scroll"
: "overflow-hidden"
"h-[70vh] w-full rounded-lg bg-muted overflow-y-auto overflow-x-hidden custom-scroll"
)}
>
{data?.map((node: any, i) => (

View file

@ -50,14 +50,9 @@ const ApiModal = forwardRef(
const tweaksList = useRef<string[]>([]);
const [getTweak, setTweak] = useState<tweakType>([]);
const flowState = useFlowStore((state) => state.flowState);
const pythonApiCode = getPythonApiCode(
flow,
autoLogin,
tweak.current,
flowState
);
const curl_code = getCurlCode(flow, autoLogin, tweak.current, flowState);
const pythonCode = getPythonCode(flow, tweak.current, flowState);
const pythonApiCode = getPythonApiCode(flow, autoLogin, tweak.current);
const curl_code = getCurlCode(flow, autoLogin, tweak.current);
const pythonCode = getPythonCode(flow, tweak.current);
const widgetCode = getWidgetCode(flow, autoLogin, flowState);
const tweaksCode = buildTweaks(flow);
const codesArray = [
@ -168,14 +163,9 @@ const ApiModal = forwardRef(
tweak.current.push(newTweak);
}
const pythonApiCode = getPythonApiCode(
flow,
autoLogin,
tweak.current,
flowState
);
const curl_code = getCurlCode(flow, autoLogin, tweak.current, flowState);
const pythonCode = getPythonCode(flow, tweak.current, flowState);
const pythonApiCode = getPythonApiCode(flow, autoLogin, tweak.current);
const curl_code = getCurlCode(flow, autoLogin, tweak.current);
const pythonCode = getPythonCode(flow, tweak.current);
const widgetCode = getWidgetCode(flow, autoLogin, flowState);
tabs![0].code = curl_code;

View file

@ -59,13 +59,11 @@ export default function IOModal({
if (!chatInput && !chatOutput) {
if (inputs.length > 0) {
return inputs[0];
}
else {
} else {
return outputs[0];
}
}
else {
return undefined
} else {
return undefined;
}
}
@ -116,12 +114,12 @@ export default function IOModal({
}
useEffect(() => {
if(selectedTab!==2) setSelectedTab(inputs.length > 0 ? 1 : outputs.length > 0 ? 2 : 0);
}, [allNodes]);
setSelectedTab(inputs.length > 0 ? 1 : outputs.length > 0 ? 2 : 0);
}, [allNodes.length]);
useEffect(() => {
setSelectedViewField(startView());
},[open])
}, [open]);
return (
<BaseModal
@ -144,7 +142,7 @@ export default function IOModal({
</BaseModal.Header>
<BaseModal.Content>
<div className="flex h-full flex-col ">
<div className="flex-max-width mt-2 h-full">
<div className="flex-max-width h-full">
{selectedTab !== 0 && (
<div
className={cn(
@ -320,12 +318,14 @@ export default function IOModal({
)}
>
<div className="font-xl flex items-center justify-center gap-3 font-semibold">
{(haveChat && <button onClick={() => setSelectedViewField(undefined)}>
<IconComponent
name={"ArrowLeft"}
className="h-6 w-6"
></IconComponent>
</button>)}
{haveChat && (
<button onClick={() => setSelectedViewField(undefined)}>
<IconComponent
name={"ArrowLeft"}
className="h-6 w-6"
></IconComponent>
</button>
)}
{
nodes.find((node) => node.id === selectedViewField.id)
?.data.node.display_name
@ -376,8 +376,8 @@ export default function IOModal({
</div>
</div>
</BaseModal.Content>
<BaseModal.Footer>
{!haveChat && (
{!haveChat ? (
<BaseModal.Footer>
<div className="flex w-full justify-end pt-2">
<Button
variant={"outline"}
@ -396,8 +396,10 @@ export default function IOModal({
Run Flow
</Button>
</div>
)}
</BaseModal.Footer>
</BaseModal.Footer>
) : (
<></>
)}
</BaseModal>
);
}

View file

@ -456,21 +456,12 @@ export function getWidgetCode(
const inputs = buildInputs();
let chat_input_field = getChatInputField(flowState);
return `<script src="https://cdn.jsdelivr.net/gh/logspace-ai/langflow-embedded-chat@main/dist/build/static/js/bundle.min.js"></script>
return `<script src="https://cdn.jsdelivr.net/gh/logspace-ai/langflow-embedded-chat@1.0_alpha/dist/build/static/js/bundle.min.js"></script>
<!-- chat_inputs: Stringified JSON with all the input keys and its values. The value of the key that is defined
as chat_input_field will be overwritten by the chat message.
chat_input_field: Input key that you want the chat to send the user message with. -->
<langflow-chat
window_title="${flowName}"
flow_id="${flowId}"
${
flowState
? `chat_inputs='${inputs}'
chat_input_field="${chat_input_field}"
`
: ""
}host_url="http://localhost:7860"${
host_url="http://localhost:7860"${
!isAuth
? `
api_key="..."`