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

This commit is contained in:
cristhianzl 2024-04-03 16:23:24 -03:00
commit ebea3d9649
101 changed files with 5377 additions and 1784 deletions

View file

@ -1,16 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="/favicon.ico" />
<script src="/node_modules/ace-builds/src-min-noconflict/ace.js" type="text/javascript"></script>
<script
src="/node_modules/ace-builds/src-min-noconflict/ace.js"
type="module"
></script>
<title>Langflow</title>
</head>
<body id='body' style="width: 100%; height:100%">
</head>
<body id="body" style="width: 100%; height: 100%">
<noscript>You need to enable JavaScript to run this app.</noscript>
<div style="width: 100vw; height:100vh" id='root'></div>
<div style="width: 100vw; height: 100vh" id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</body>
</html>

View file

@ -969,9 +969,9 @@
}
},
"node_modules/@humanwhocodes/object-schema": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz",
"integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==",
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz",
"integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==",
"dev": true
},
"node_modules/@isaacs/cliui": {
@ -4888,9 +4888,9 @@
}
},
"node_modules/caniuse-lite": {
"version": "1.0.30001600",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001600.tgz",
"integrity": "sha512-+2S9/2JFhYmYaDpZvo0lKkfvuKIglrx68MwOBqMGHhQsNkLjB5xtc/TGoEPs+MxjSyN/72qer2g97nzR641mOQ==",
"version": "1.0.30001603",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001603.tgz",
"integrity": "sha512-iL2iSS0eDILMb9n5yKQoTBim9jMZ0Yrk8g0N9K7UzYyWnfIKzXBZD5ngpM37ZcL/cv0Mli8XtVMRYMQAfFpi5Q==",
"funding": [
{
"type": "opencollective",
@ -5677,9 +5677,9 @@
"integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA=="
},
"node_modules/electron-to-chromium": {
"version": "1.4.722",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.722.tgz",
"integrity": "sha512-5nLE0TWFFpZ80Crhtp4pIp8LXCztjYX41yUcV6b+bKR2PqzjskTMOOlBi1VjBHlvHwS+4gar7kNKOrsbsewEZQ=="
"version": "1.4.723",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.723.tgz",
"integrity": "sha512-rxFVtrMGMFROr4qqU6n95rUi9IlfIm+lIAt+hOToy/9r6CDv0XiEcQdC3VP71y1pE5CFTzKV0RvxOGYCPWWHPw=="
},
"node_modules/emoji-regex": {
"version": "9.2.2",

View file

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

View file

@ -1,10 +1,28 @@
const SvgGoogleGenerativeAI = (props) => (<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" {...props}>
<path d="M16 8.016A8.522 8.522 0 008.016 16h-.032A8.521 8.521 0 000 8.016v-.032A8.521 8.521 0 007.984 0h.032A8.522 8.522 0 0016 7.984v.032z" fill="url(#prefix__paint0_radial_980_20147)"/>
<defs>
<radialGradient id="prefix__paint0_radial_980_20147" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="matrix(16.1326 5.4553 -43.70045 129.2322 1.588 6.503)">
<stop offset=".067" stop-color="#9168C0"/><stop offset=".343" stop-color="#5684D1"/><stop offset=".672" stop-color="#1BA1E3"/>
const SvgGoogleGenerativeAI = (props) => (
<svg
fill="none"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 16 16"
{...props}
>
<path
d="M16 8.016A8.522 8.522 0 008.016 16h-.032A8.521 8.521 0 000 8.016v-.032A8.521 8.521 0 007.984 0h.032A8.522 8.522 0 0016 7.984v.032z"
fill="url(#prefix__paint0_radial_980_20147)"
/>
<defs>
<radialGradient
id="prefix__paint0_radial_980_20147"
cx="0"
cy="0"
r="1"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(16.1326 5.4553 -43.70045 129.2322 1.588 6.503)"
>
<stop offset=".067" stop-color="#9168C0" />
<stop offset=".343" stop-color="#5684D1" />
<stop offset=".672" stop-color="#1BA1E3" />
</radialGradient>
</defs>
</defs>
</svg>
);
export default SvgGoogleGenerativeAI;

View file

@ -28,9 +28,7 @@ import {
LANGFLOW_SUPPORTED_TYPES,
limitScrollFieldsModal,
} from "../../constants/constants";
import useAlertStore from "../../stores/alertStore";
import useFlowStore from "../../stores/flowStore";
import { useGlobalVariablesStore } from "../../stores/globalVariables";
import { NodeDataType } from "../../types/flow";
import {
convertObjToArray,

View file

@ -23,7 +23,9 @@ export default function IOFieldView({
case "TextInput":
return (
<Textarea
className={`w-full custom-scroll ${left ? " min-h-32" : " h-full"}`}
className={`w-full custom-scroll ${
left ? " min-h-32" : " h-full"
}`}
placeholder={"Enter text..."}
value={node.data.node!.template["input_value"].value}
onChange={(e) => {
@ -54,7 +56,9 @@ export default function IOFieldView({
default:
return (
<Textarea
className={`w-full custom-scroll ${left ? " min-h-32" : " h-full"}`}
className={`w-full custom-scroll ${
left ? " min-h-32" : " h-full"
}`}
placeholder={"Enter text..."}
value={node.data.node!.template["input_value"]}
onChange={(e) => {
@ -74,7 +78,9 @@ export default function IOFieldView({
case "TextOutput":
return (
<Textarea
className={`w-full custom-scroll ${left ? " min-h-32" : " h-full"}`}
className={`w-full custom-scroll ${
left ? " min-h-32" : " h-full"
}`}
placeholder={"Empty"}
// update to real value on flowPool
value={
@ -89,7 +95,9 @@ export default function IOFieldView({
default:
return (
<Textarea
className={`w-full custom-scroll ${left ? " min-h-32" : " h-full"}`}
className={`w-full custom-scroll ${
left ? " min-h-32" : " h-full"
}`}
placeholder={"Empty"}
// update to real value on flowPool
value={

View file

@ -9,6 +9,7 @@ import Robot from "../../../../../assets/robot.png";
import SanitizedHTMLWrapper from "../../../../../components/SanitizedHTMLWrapper";
import CodeTabsComponent from "../../../../../components/codeTabsComponent";
import IconComponent from "../../../../../components/genericIconComponent";
import useAlertStore from "../../../../../stores/alertStore";
import useFlowStore from "../../../../../stores/flowStore";
import { chatMessagePropsType } from "../../../../../types/components";
import { classNames, cn } from "../../../../../utils/utils";
@ -33,6 +34,7 @@ export default function ChatMessage({
const [isStreaming, setIsStreaming] = useState(false);
const eventSource = useRef<EventSource | undefined>(undefined);
const updateFlowPool = useFlowStore((state) => state.updateFlowPool);
const setErrorData = useAlertStore((state) => state.setErrorData);
const chatMessageRef = useRef(chatMessage);
// Sync ref with state
@ -53,10 +55,17 @@ export default function ChatMessage({
setChatMessage((prev) => prev + parsedData.chunk);
}
};
eventSource.current.onerror = (event) => {
eventSource.current.onerror = (event: any) => {
setIsStreaming(false);
eventSource.current?.close();
setStreamUrl(undefined);
if (JSON.parse(event.data)?.error) {
setErrorData({
title: "Error on Streaming",
list: [JSON.parse(event.data)?.error],
});
}
updateChat(chat, chatMessageRef.current);
reject(new Error("Streaming failed"));
};
eventSource.current.addEventListener("close", (event) => {

View file

@ -1,6 +1,5 @@
import { useEffect, useRef, useState } from "react";
import IconComponent from "../../../../components/genericIconComponent";
import { NOCHATOUTPUT_NOTICE_ALERT } from "../../../../constants/alerts_constants";
import {
CHAT_FIRST_INITIAL_TEXT,
CHAT_SECOND_INITIAL_TEXT,
@ -124,7 +123,7 @@ export default function ChatView({
message: string,
stream_url?: string
) {
if (message === "") return;
// if (message === "") return;
chat.message = message;
// chat is one of the chatHistory
updateFlowPool(chat.componentId, {

View file

@ -10,6 +10,12 @@ export default function NewFlowModal({
}: newFlowModalPropsType): JSX.Element {
const examples = useFlowsManagerStore((state) => state.examples);
examples.forEach((example) => {
if (example.name === "Blog Writter") {
example.name = "Blog Writer";
}
});
return (
<BaseModal size="three-cards" open={open} setOpen={setOpen}>
<BaseModal.Header description={"Select a template below"}>

View file

@ -143,7 +143,6 @@ export default function ShareModal({
});
});
};
console.log("ShareModal");
const handleUpdateComponent = () => {
handleShareComponent(true);

View file

@ -477,8 +477,8 @@ export default function Page({
<Background className="" />
{!view && (
<Controls
className="[&>button]:bg-muted fill-foreground stroke-foreground text-primary
[&>button]:border-b-border hover:[&>button]:bg-border"
className="fill-foreground stroke-foreground text-primary [&>button]:border-b-border
[&>button]:bg-muted hover:[&>button]:bg-border"
></Controls>
)}
<SelectionMenu

View file

@ -378,7 +378,7 @@ export default function ExtraSidebar(): JSX.Element {
Object.keys(dataFilter[SBSectionName]).length > 0 ? (
<>
<DisclosureComponent
isChild={false}
isChild={false}
openDisc={
getFilterEdge.length !== 0 || search.length !== 0
? true

View file

@ -664,6 +664,9 @@ export function reconnectEdges(groupNode: NodeType, excludedEdges: Edge[]) {
let newEdges = cloneDeep(excludedEdges);
const { nodes, edges } = groupNode.data.node!.flow!.data!;
const lastNode = findLastNode(groupNode.data.node!.flow!.data!);
newEdges = newEdges.filter(
(e) => !(nodes.some((n) => n.id === e.source) && e.source !== lastNode?.id)
);
newEdges.forEach((edge) => {
if (lastNode && edge.source === lastNode.id) {
edge.source = groupNode.id;

View file

@ -21,8 +21,8 @@ import {
ChevronsLeft,
ChevronsRight,
ChevronsUpDown,
Circle,
ChevronsUpDownIcon,
Circle,
CircleDot,
Clipboard,
Code,
@ -252,9 +252,8 @@ export const nodeColors: { [char: string]: string } = {
retrievers: "#e6b25a",
unknown: "#9CA3AF",
custom_components: "#ab11ab",
Records:"#31a3cc",
Record:"#31a3cc",
Records: "#31a3cc",
Record: "#31a3cc",
};
export const nodeNames: { [char: string]: string } = {