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

@ -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="..."`