Merge branch 'zustand/io/migration' of personal:logspace-ai/langflow into zustand/io/migration
This commit is contained in:
commit
d86ca92b7d
31 changed files with 149 additions and 128 deletions
|
|
@ -9,7 +9,7 @@ class DirectoryComponent(CustomComponent):
|
||||||
display_name = "Directory"
|
display_name = "Directory"
|
||||||
description = "Recursively load files from a directory."
|
description = "Recursively load files from a directory."
|
||||||
icon = "folder"
|
icon = "folder"
|
||||||
|
|
||||||
def build_config(self) -> Dict[str, Any]:
|
def build_config(self) -> Dict[str, Any]:
|
||||||
return {
|
return {
|
||||||
"path": {"display_name": "Path"},
|
"path": {"display_name": "Path"},
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ class FileComponent(CustomComponent):
|
||||||
display_name = "File"
|
display_name = "File"
|
||||||
description = "A generic file loader."
|
description = "A generic file loader."
|
||||||
icon = "file-text"
|
icon = "file-text"
|
||||||
|
|
||||||
def build_config(self) -> Dict[str, Any]:
|
def build_config(self) -> Dict[str, Any]:
|
||||||
return {
|
return {
|
||||||
"paths": {
|
"paths": {
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ class URLComponent(CustomComponent):
|
||||||
display_name = "URL"
|
display_name = "URL"
|
||||||
description = "Fetch content from one or more URLs."
|
description = "Fetch content from one or more URLs."
|
||||||
icon = "layout-template"
|
icon = "layout-template"
|
||||||
|
|
||||||
def build_config(self) -> Dict[str, Any]:
|
def build_config(self) -> Dict[str, Any]:
|
||||||
return {
|
return {
|
||||||
"urls": {"display_name": "URL"},
|
"urls": {"display_name": "URL"},
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
from langflow.interface.custom.custom_component import CustomComponent
|
from langflow.interface.custom.custom_component import CustomComponent
|
||||||
from langflow.field_typing import Text
|
from langflow.field_typing import Text
|
||||||
|
|
||||||
|
|
||||||
class CombineTextComponent(CustomComponent):
|
class CombineTextComponent(CustomComponent):
|
||||||
display_name = "Combine Text"
|
display_name = "Combine Text"
|
||||||
description = "Concatenate two text sources into a single text chunk using a specified delimiter."
|
description = "Concatenate two text sources into a single text chunk using a specified delimiter."
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ from langflow.schema import Record
|
||||||
class RecordsToTextComponent(CustomComponent):
|
class RecordsToTextComponent(CustomComponent):
|
||||||
display_name = "Records To Text"
|
display_name = "Records To Text"
|
||||||
description = "Convert Records into plain text following a specified template."
|
description = "Convert Records into plain text following a specified template."
|
||||||
|
|
||||||
|
|
||||||
def build_config(self):
|
def build_config(self):
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,29 @@
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": ["eslint:recommended", "plugin:node/recommended"],
|
||||||
"eslint:recommended",
|
"parserOptions": {
|
||||||
"plugin:node/recommended"
|
"ecmaVersion": 2018
|
||||||
],
|
},
|
||||||
"parserOptions": {
|
"rules": {
|
||||||
"ecmaVersion": 2018
|
"no-console": "warn",
|
||||||
},
|
"no-self-assign": "warn",
|
||||||
"rules": {
|
"no-self-compare": "warn",
|
||||||
"no-console": "warn",
|
"complexity": ["error", { "max": 15 }],
|
||||||
"no-self-assign": "warn",
|
"indent": ["error", 2, { "SwitchCase": 1 }],
|
||||||
"no-self-compare":"warn",
|
"no-dupe-keys": "error",
|
||||||
"complexity": ["error", { "max": 15 }],
|
"no-invalid-regexp": "error",
|
||||||
"indent": ["error", 2, { "SwitchCase": 1 }],
|
"no-undef": "error",
|
||||||
"no-dupe-keys": "error",
|
"no-return-assign": "error",
|
||||||
"no-invalid-regexp": "error",
|
"no-redeclare": "error",
|
||||||
"no-undef": "error",
|
"no-empty": "error",
|
||||||
"no-return-assign": "error",
|
"no-await-in-loop": "error",
|
||||||
"no-redeclare": "error",
|
"node/exports-style": ["error", "module.exports"],
|
||||||
"no-empty": "error",
|
"node/file-extension-in-import": ["error", "always"],
|
||||||
"no-await-in-loop": "error",
|
"node/prefer-global/buffer": ["error", "always"],
|
||||||
"node/exports-style": ["error", "module.exports"],
|
"node/prefer-global/console": ["error", "always"],
|
||||||
"node/file-extension-in-import": ["error", "always"],
|
"node/prefer-global/process": ["error", "always"],
|
||||||
"node/prefer-global/buffer": ["error", "always"],
|
"node/prefer-global/url-search-params": ["error", "always"],
|
||||||
"node/prefer-global/console": ["error", "always"],
|
"node/prefer-global/url": ["error", "always"],
|
||||||
"node/prefer-global/process": ["error", "always"],
|
"node/prefer-promises/dns": "error",
|
||||||
"node/prefer-global/url-search-params": ["error", "always"],
|
"node/prefer-promises/fs": "error"
|
||||||
"node/prefer-global/url": ["error", "always"],
|
}
|
||||||
"node/prefer-promises/dns": "error",
|
}
|
||||||
"node/prefer-promises/fs": "error"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -403,7 +403,9 @@ export default function ParameterComponent({
|
||||||
{title}
|
{title}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
<span className={(info === "" ? "" : "ml-1 ") + " text-status-red pl-1"}>
|
<span
|
||||||
|
className={(info === "" ? "" : "ml-1 ") + " pl-1 text-status-red"}
|
||||||
|
>
|
||||||
{required ? "*" : ""}
|
{required ? "*" : ""}
|
||||||
</span>
|
</span>
|
||||||
<div className="">
|
<div className="">
|
||||||
|
|
|
||||||
|
|
@ -345,29 +345,40 @@ export default function GenericNode({
|
||||||
return (
|
return (
|
||||||
<NodeToolbar>
|
<NodeToolbar>
|
||||||
<NodeToolbarComponent
|
<NodeToolbarComponent
|
||||||
data={data}
|
data={data}
|
||||||
deleteNode={(id) => {
|
deleteNode={(id) => {
|
||||||
takeSnapshot();
|
takeSnapshot();
|
||||||
deleteNode(id);
|
deleteNode(id);
|
||||||
}}
|
}}
|
||||||
setShowNode={(show) => {
|
setShowNode={(show) => {
|
||||||
setNode(data.id, (old) => ({
|
setNode(data.id, (old) => ({
|
||||||
...old,
|
...old,
|
||||||
data: { ...old.data, showNode: show },
|
data: { ...old.data, showNode: show },
|
||||||
}));
|
}));
|
||||||
}}
|
}}
|
||||||
setShowState={setShowNode}
|
setShowState={setShowNode}
|
||||||
numberOfHandles={handles}
|
numberOfHandles={handles}
|
||||||
showNode={showNode}
|
showNode={showNode}
|
||||||
openAdvancedModal={false}
|
openAdvancedModal={false}
|
||||||
onCloseAdvancedModal={() => {}}
|
onCloseAdvancedModal={() => {}}
|
||||||
updateNodeCode={updateNodeCode}
|
updateNodeCode={updateNodeCode}
|
||||||
isOutdated={isOutdated}
|
isOutdated={isOutdated}
|
||||||
selected={selected}
|
selected={selected}
|
||||||
/>
|
/>
|
||||||
</NodeToolbar>
|
</NodeToolbar>
|
||||||
)
|
);
|
||||||
}, [data, deleteNode, takeSnapshot, setNode, setShowNode, handles, showNode, updateNodeCode, isOutdated, selected]);
|
}, [
|
||||||
|
data,
|
||||||
|
deleteNode,
|
||||||
|
takeSnapshot,
|
||||||
|
setNode,
|
||||||
|
setShowNode,
|
||||||
|
handles,
|
||||||
|
showNode,
|
||||||
|
updateNodeCode,
|
||||||
|
isOutdated,
|
||||||
|
selected,
|
||||||
|
]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,12 @@
|
||||||
import { Transition } from "@headlessui/react";
|
import { Transition } from "@headlessui/react";
|
||||||
import { useEffect, useMemo, useRef, useState } from "react";
|
import { useEffect, useMemo, useRef, useState } from "react";
|
||||||
import ApiModal from "../../modals/ApiModal";
|
import ApiModal from "../../modals/ApiModal";
|
||||||
|
import IOModal from "../../modals/IOModal";
|
||||||
import ShareModal from "../../modals/shareModal";
|
import ShareModal from "../../modals/shareModal";
|
||||||
import useFlowStore from "../../stores/flowStore";
|
import useFlowStore from "../../stores/flowStore";
|
||||||
import useFlowsManagerStore from "../../stores/flowsManagerStore";
|
import useFlowsManagerStore from "../../stores/flowsManagerStore";
|
||||||
import { useStoreStore } from "../../stores/storeStore";
|
import { useStoreStore } from "../../stores/storeStore";
|
||||||
import { ChatType } from "../../types/chat";
|
|
||||||
import { classNames } from "../../utils/utils";
|
import { classNames } from "../../utils/utils";
|
||||||
import IOModal from "../../modals/IOModal";
|
|
||||||
import ForwardedIconComponent from "../genericIconComponent";
|
import ForwardedIconComponent from "../genericIconComponent";
|
||||||
import { Separator } from "../ui/separator";
|
import { Separator } from "../ui/separator";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,9 +52,9 @@ export default function Dropdown({
|
||||||
editNode ? "input-edit-node" : "py-2"
|
editNode ? "input-edit-node" : "py-2"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{(value &&
|
{value &&
|
||||||
value !== "" &&
|
value !== "" &&
|
||||||
options.find((option) => option === value))
|
options.find((option) => option === value)
|
||||||
? options.find((option) => option === value)
|
? options.find((option) => option === value)
|
||||||
: "Choose an option..."}
|
: "Choose an option..."}
|
||||||
<ForwardedIconComponent
|
<ForwardedIconComponent
|
||||||
|
|
|
||||||
|
|
@ -43,17 +43,17 @@ export interface ButtonProps
|
||||||
|
|
||||||
function toTitleCase(text: string) {
|
function toTitleCase(text: string) {
|
||||||
return text
|
return text
|
||||||
.split(' ')
|
.split(" ")
|
||||||
.map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
|
.map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
|
||||||
.join(' ');
|
.join(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
||||||
({ className, variant, size, asChild = false,children, ...props }, ref) => {
|
({ className, variant, size, asChild = false, children, ...props }, ref) => {
|
||||||
const Comp = asChild ? Slot : "button";
|
const Comp = asChild ? Slot : "button";
|
||||||
let newChildren = children;
|
let newChildren = children;
|
||||||
if (typeof(children)==="string"){
|
if (typeof children === "string") {
|
||||||
newChildren = toTitleCase(children)
|
newChildren = toTitleCase(children);
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Comp
|
<Comp
|
||||||
|
|
@ -61,7 +61,6 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
||||||
ref={ref}
|
ref={ref}
|
||||||
children={newChildren}
|
children={newChildren}
|
||||||
{...props}
|
{...props}
|
||||||
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,4 +18,4 @@ export enum BuildStatus {
|
||||||
export enum InputOutput {
|
export enum InputOutput {
|
||||||
INPUT = "input",
|
INPUT = "input",
|
||||||
OUTPUT = "output",
|
OUTPUT = "output",
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ import "./style/index.css";
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import "./style/applies.css";
|
import "./style/applies.css";
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import "./style/classes.css";
|
|
||||||
import { StrictMode } from "react";
|
import { StrictMode } from "react";
|
||||||
|
import "./style/classes.css";
|
||||||
|
|
||||||
const root = ReactDOM.createRoot(
|
const root = ReactDOM.createRoot(
|
||||||
document.getElementById("root") as HTMLElement
|
document.getElementById("root") as HTMLElement
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import { Button } from "../../../../../../components/ui/button";
|
import { Button } from "../../../../../../components/ui/button";
|
||||||
|
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
import IconComponent from "../../../../../../components/genericIconComponent";
|
||||||
import { BASE_URL_API } from "../../../../../../constants/constants";
|
import { BASE_URL_API } from "../../../../../../constants/constants";
|
||||||
import { uploadFile } from "../../../../../../controllers/API";
|
import { uploadFile } from "../../../../../../controllers/API";
|
||||||
import useFlowsManagerStore from "../../../../../../stores/flowsManagerStore";
|
import useFlowsManagerStore from "../../../../../../stores/flowsManagerStore";
|
||||||
import { IOFileInputProps } from "../../../../../../types/components";
|
import { IOFileInputProps } from "../../../../../../types/components";
|
||||||
import IconComponent from "../../../../../../components/genericIconComponent";
|
|
||||||
|
|
||||||
export default function IOFileInput({ field, updateValue }: IOFileInputProps) {
|
export default function IOFileInput({ field, updateValue }: IOFileInputProps) {
|
||||||
//component to handle file upload from chatIO
|
//component to handle file upload from chatIO
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import { cloneDeep } from "lodash";
|
import { cloneDeep } from "lodash";
|
||||||
|
import { Textarea } from "../../../../components/ui/textarea";
|
||||||
import { InputOutput } from "../../../../constants/enums";
|
import { InputOutput } from "../../../../constants/enums";
|
||||||
import useFlowStore from "../../../../stores/flowStore";
|
import useFlowStore from "../../../../stores/flowStore";
|
||||||
import { IOFieldViewProps } from "../../../../types/components";
|
import { IOFieldViewProps } from "../../../../types/components";
|
||||||
import IOFileInput from "./components/FileInput";
|
import IOFileInput from "./components/FileInput";
|
||||||
import { Textarea } from "../../../../components/ui/textarea";
|
|
||||||
|
|
||||||
export default function IOFieldView({
|
export default function IOFieldView({
|
||||||
type,
|
type,
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ export default function ChatInput({
|
||||||
}
|
}
|
||||||
}, [lockChat, inputRef]);
|
}, [lockChat, inputRef]);
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (inputRef.current) {
|
if (inputRef.current) {
|
||||||
inputRef.current.style.height = "inherit"; // Reset the height
|
inputRef.current.style.height = "inherit"; // Reset the height
|
||||||
|
|
@ -42,7 +41,8 @@ export default function ChatInput({
|
||||||
event.key === "Enter" &&
|
event.key === "Enter" &&
|
||||||
!lockChat &&
|
!lockChat &&
|
||||||
!saveLoading &&
|
!saveLoading &&
|
||||||
!event.shiftKey && !event.nativeEvent.isComposing
|
!event.shiftKey &&
|
||||||
|
!event.nativeEvent.isComposing
|
||||||
) {
|
) {
|
||||||
sendMessage(repeat);
|
sendMessage(repeat);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,10 @@ import {
|
||||||
ChatOutputType,
|
ChatOutputType,
|
||||||
FlowPoolObjectType,
|
FlowPoolObjectType,
|
||||||
} from "../../../../types/chat";
|
} from "../../../../types/chat";
|
||||||
|
import { chatViewProps } from "../../../../types/components";
|
||||||
import { classNames } from "../../../../utils/utils";
|
import { classNames } from "../../../../utils/utils";
|
||||||
import ChatInput from "./chatInput";
|
import ChatInput from "./chatInput";
|
||||||
import ChatMessage from "./chatMessage";
|
import ChatMessage from "./chatMessage";
|
||||||
import { chatViewProps } from "../../../../types/components";
|
|
||||||
|
|
||||||
export default function ChatView({
|
export default function ChatView({
|
||||||
sendMessage,
|
sendMessage,
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import AccordionComponent from "../../components/AccordionComponent";
|
import AccordionComponent from "../../components/AccordionComponent";
|
||||||
import IOFieldView from "./components/IOFieldView";
|
|
||||||
import ShadTooltip from "../../components/ShadTooltipComponent";
|
import ShadTooltip from "../../components/ShadTooltipComponent";
|
||||||
import IconComponent from "../../components/genericIconComponent";
|
import IconComponent from "../../components/genericIconComponent";
|
||||||
import ChatView from "./components/chatView";
|
|
||||||
import { Badge } from "../../components/ui/badge";
|
import { Badge } from "../../components/ui/badge";
|
||||||
import { Button } from "../../components/ui/button";
|
import { Button } from "../../components/ui/button";
|
||||||
import {
|
import {
|
||||||
|
|
@ -20,11 +18,13 @@ import {
|
||||||
import { InputOutput } from "../../constants/enums";
|
import { InputOutput } from "../../constants/enums";
|
||||||
import useFlowStore from "../../stores/flowStore";
|
import useFlowStore from "../../stores/flowStore";
|
||||||
import useFlowsManagerStore from "../../stores/flowsManagerStore";
|
import useFlowsManagerStore from "../../stores/flowsManagerStore";
|
||||||
|
import { IOModalPropsType } from "../../types/components";
|
||||||
import { NodeType } from "../../types/flow";
|
import { NodeType } from "../../types/flow";
|
||||||
import { updateVerticesOrder } from "../../utils/buildUtils";
|
import { updateVerticesOrder } from "../../utils/buildUtils";
|
||||||
import { cn } from "../../utils/utils";
|
import { cn } from "../../utils/utils";
|
||||||
import BaseModal from "../baseModal";
|
import BaseModal from "../baseModal";
|
||||||
import { IOModalPropsType } from "../../types/components";
|
import IOFieldView from "./components/IOFieldView";
|
||||||
|
import ChatView from "./components/chatView";
|
||||||
|
|
||||||
export default function IOModal({
|
export default function IOModal({
|
||||||
children,
|
children,
|
||||||
|
|
@ -315,7 +315,10 @@ export default function IOModal({
|
||||||
className="h-6 w-6"
|
className="h-6 w-6"
|
||||||
></IconComponent>
|
></IconComponent>
|
||||||
</button>
|
</button>
|
||||||
{selectedViewField.type}
|
{
|
||||||
|
nodes.find((node) => node.id === selectedViewField.id)
|
||||||
|
?.data.node.display_name
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
<div className="h-full w-full">
|
<div className="h-full w-full">
|
||||||
{inputs.some(
|
{inputs.some(
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
import {
|
||||||
|
Card,
|
||||||
|
CardContent,
|
||||||
|
CardDescription,
|
||||||
|
CardTitle,
|
||||||
|
} from "../../../../components/ui/card";
|
||||||
import useFlowsManagerStore from "../../../../stores/flowsManagerStore";
|
import useFlowsManagerStore from "../../../../stores/flowsManagerStore";
|
||||||
import { Card, CardContent, CardDescription, CardTitle } from "../../../../components/ui/card";
|
|
||||||
|
|
||||||
export default function NewFlowCardComponent() {
|
export default function NewFlowCardComponent() {
|
||||||
const addFlow = useFlowsManagerStore((state) => state.addFlow);
|
const addFlow = useFlowsManagerStore((state) => state.addFlow);
|
||||||
|
|
|
||||||
|
|
@ -10,13 +10,19 @@ import { ReactComponent as ChatWithHistory } from "../../../../assets/undraw_mob
|
||||||
import { ReactComponent as Assistant } from "../../../../assets/undraw_team_collaboration_re_ow29.svg";
|
import { ReactComponent as Assistant } from "../../../../assets/undraw_team_collaboration_re_ow29.svg";
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
import { ReactComponent as APIRequest } from "../../../../assets/undraw_real_time_analytics_re_yliv.svg";
|
import { ReactComponent as APIRequest } from "../../../../assets/undraw_real_time_analytics_re_yliv.svg";
|
||||||
|
import {
|
||||||
|
Card,
|
||||||
|
CardContent,
|
||||||
|
CardDescription,
|
||||||
|
CardTitle,
|
||||||
|
} from "../../../../components/ui/card";
|
||||||
import useFlowsManagerStore from "../../../../stores/flowsManagerStore";
|
import useFlowsManagerStore from "../../../../stores/flowsManagerStore";
|
||||||
import { FlowType } from "../../../../types/flow";
|
|
||||||
import { updateIds } from "../../../../utils/reactflowUtils";
|
|
||||||
import { Card, CardContent, CardDescription, CardTitle } from "../../../../components/ui/card";
|
|
||||||
import { UndrawCardComponentProps } from "../../../../types/components";
|
import { UndrawCardComponentProps } from "../../../../types/components";
|
||||||
|
import { updateIds } from "../../../../utils/reactflowUtils";
|
||||||
|
|
||||||
export default function UndrawCardComponent({ flow }: UndrawCardComponentProps): JSX.Element {
|
export default function UndrawCardComponent({
|
||||||
|
flow,
|
||||||
|
}: UndrawCardComponentProps): JSX.Element {
|
||||||
const addFlow = useFlowsManagerStore((state) => state.addFlow);
|
const addFlow = useFlowsManagerStore((state) => state.addFlow);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,13 @@
|
||||||
|
import useFlowsManagerStore from "../../stores/flowsManagerStore";
|
||||||
|
import { newFlowModalPropsType } from "../../types/components";
|
||||||
|
import BaseModal from "../baseModal";
|
||||||
import NewFlowCardComponent from "./components/NewFlowCardComponent";
|
import NewFlowCardComponent from "./components/NewFlowCardComponent";
|
||||||
import UndrawCardComponent from "./components/undrawCards";
|
import UndrawCardComponent from "./components/undrawCards";
|
||||||
import useFlowsManagerStore from "../../stores/flowsManagerStore";
|
|
||||||
import BaseModal from "../baseModal";
|
|
||||||
import { newFlowModalPropsType } from "../../types/components";
|
|
||||||
|
|
||||||
export default function NewFlowModal({ open, setOpen }: newFlowModalPropsType): JSX.Element {
|
export default function NewFlowModal({
|
||||||
|
open,
|
||||||
|
setOpen,
|
||||||
|
}: newFlowModalPropsType): JSX.Element {
|
||||||
const examples = useFlowsManagerStore((state) => state.examples);
|
const examples = useFlowsManagerStore((state) => state.examples);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ import ReactFlow, {
|
||||||
updateEdge,
|
updateEdge,
|
||||||
} from "reactflow";
|
} from "reactflow";
|
||||||
import GenericNode from "../../../../CustomNodes/GenericNode";
|
import GenericNode from "../../../../CustomNodes/GenericNode";
|
||||||
import FlowToolbar from "../../../../components/chatComponent";
|
|
||||||
import {
|
import {
|
||||||
INVALID_SELECTION_ERROR_ALERT,
|
INVALID_SELECTION_ERROR_ALERT,
|
||||||
UPLOAD_ALERT_LIST,
|
UPLOAD_ALERT_LIST,
|
||||||
|
|
@ -58,8 +57,9 @@ export default function Page({
|
||||||
const templates = useTypesStore((state) => state.templates);
|
const templates = useTypesStore((state) => state.templates);
|
||||||
const setFilterEdge = useFlowStore((state) => state.setFilterEdge);
|
const setFilterEdge = useFlowStore((state) => state.setFilterEdge);
|
||||||
const reactFlowWrapper = useRef<HTMLDivElement>(null);
|
const reactFlowWrapper = useRef<HTMLDivElement>(null);
|
||||||
const [showCanvas, setSHowCanvas] = useState(Object.keys(templates).length > 0 &&
|
const [showCanvas, setSHowCanvas] = useState(
|
||||||
Object.keys(types).length > 0)
|
Object.keys(templates).length > 0 && Object.keys(types).length > 0
|
||||||
|
);
|
||||||
|
|
||||||
const reactFlowInstance = useFlowStore((state) => state.reactFlowInstance);
|
const reactFlowInstance = useFlowStore((state) => state.reactFlowInstance);
|
||||||
const setReactFlowInstance = useFlowStore(
|
const setReactFlowInstance = useFlowStore(
|
||||||
|
|
@ -273,8 +273,10 @@ export default function Page({
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setSHowCanvas(Object.keys(templates).length > 0 && Object.keys(types).length > 0)
|
setSHowCanvas(
|
||||||
}, [templates, types])
|
Object.keys(templates).length > 0 && Object.keys(types).length > 0
|
||||||
|
);
|
||||||
|
}, [templates, types]);
|
||||||
|
|
||||||
const onConnectMod = useCallback(
|
const onConnectMod = useCallback(
|
||||||
(params: Connection) => {
|
(params: Connection) => {
|
||||||
|
|
@ -437,7 +439,6 @@ export default function Page({
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
||||||
<div className="h-full w-full" ref={reactFlowWrapper}>
|
<div className="h-full w-full" ref={reactFlowWrapper}>
|
||||||
{showCanvas ? (
|
{showCanvas ? (
|
||||||
<div id="react-flow-id" className="h-full w-full">
|
<div id="react-flow-id" className="h-full w-full">
|
||||||
|
|
@ -491,8 +492,7 @@ export default function Page({
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<></>
|
<></>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { cloneDeep } from "lodash";
|
import { cloneDeep } from "lodash";
|
||||||
import { LinkIcon, SparklesIcon } from "lucide-react";
|
import { LinkIcon, SparklesIcon } from "lucide-react";
|
||||||
import { useEffect, useMemo, useState } from "react";
|
import { useEffect, useMemo, useState } from "react";
|
||||||
import AccordionComponent from "../../../../components/AccordionComponent";
|
|
||||||
import ShadTooltip from "../../../../components/ShadTooltipComponent";
|
import ShadTooltip from "../../../../components/ShadTooltipComponent";
|
||||||
import IconComponent from "../../../../components/genericIconComponent";
|
import IconComponent from "../../../../components/genericIconComponent";
|
||||||
import { Input } from "../../../../components/ui/input";
|
import { Input } from "../../../../components/ui/input";
|
||||||
|
|
|
||||||
|
|
@ -631,22 +631,24 @@ export default function NodeToolbarComponent({
|
||||||
)}
|
)}
|
||||||
{hasCode && (
|
{hasCode && (
|
||||||
<div className="hidden">
|
<div className="hidden">
|
||||||
{openModal&& <CodeAreaComponent
|
{openModal && (
|
||||||
open={openModal}
|
<CodeAreaComponent
|
||||||
setOpen={setOpenModal}
|
open={openModal}
|
||||||
readonly={
|
setOpen={setOpenModal}
|
||||||
data.node?.flow && data.node.template[name].dynamic
|
readonly={
|
||||||
? true
|
data.node?.flow && data.node.template[name].dynamic
|
||||||
: false
|
? true
|
||||||
}
|
: false
|
||||||
dynamic={data.node?.template[name].dynamic ?? false}
|
}
|
||||||
setNodeClass={handleNodeClass}
|
dynamic={data.node?.template[name].dynamic ?? false}
|
||||||
nodeClass={data.node}
|
setNodeClass={handleNodeClass}
|
||||||
disabled={false}
|
nodeClass={data.node}
|
||||||
value={data.node?.template[name].value ?? ""}
|
disabled={false}
|
||||||
onChange={handleOnNewValue}
|
value={data.node?.template[name].value ?? ""}
|
||||||
id={"code-input-node-toolbar-" + name}
|
onChange={handleOnNewValue}
|
||||||
/>}
|
id={"code-input-node-toolbar-" + name}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
|
import FlowToolbar from "../../components/chatComponent";
|
||||||
import Header from "../../components/headerComponent";
|
import Header from "../../components/headerComponent";
|
||||||
import { useDarkStore } from "../../stores/darkStore";
|
import { useDarkStore } from "../../stores/darkStore";
|
||||||
import useFlowsManagerStore from "../../stores/flowsManagerStore";
|
import useFlowsManagerStore from "../../stores/flowsManagerStore";
|
||||||
import Page from "./components/PageComponent";
|
import Page from "./components/PageComponent";
|
||||||
import ExtraSidebar from "./components/extraSidebarComponent";
|
import ExtraSidebar from "./components/extraSidebarComponent";
|
||||||
import FlowToolbar from "../../components/chatComponent";
|
|
||||||
|
|
||||||
export default function FlowPage({ view }: { view?: boolean }): JSX.Element {
|
export default function FlowPage({ view }: { view?: boolean }): JSX.Element {
|
||||||
const setCurrentFlowId = useFlowsManagerStore(
|
const setCurrentFlowId = useFlowsManagerStore(
|
||||||
|
|
@ -23,7 +23,7 @@ export default function FlowPage({ view }: { view?: boolean }): JSX.Element {
|
||||||
<>
|
<>
|
||||||
<Header />
|
<Header />
|
||||||
<div className="flow-page-positioning">
|
<div className="flow-page-positioning">
|
||||||
{currentFlow &&
|
{currentFlow && (
|
||||||
<div className="flex h-full overflow-hidden">
|
<div className="flex h-full overflow-hidden">
|
||||||
{!view && <ExtraSidebar />}
|
{!view && <ExtraSidebar />}
|
||||||
<main className="flex flex-1">
|
<main className="flex flex-1">
|
||||||
|
|
@ -32,10 +32,9 @@ export default function FlowPage({ view }: { view?: boolean }): JSX.Element {
|
||||||
<Page flow={currentFlow} />
|
<Page flow={currentFlow} />
|
||||||
</div>
|
</div>
|
||||||
{!view && <FlowToolbar />}
|
{!view && <FlowToolbar />}
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
}
|
)}
|
||||||
<a
|
<a
|
||||||
target={"_blank"}
|
target={"_blank"}
|
||||||
href="https://logspace.ai/"
|
href="https://logspace.ai/"
|
||||||
|
|
|
||||||
|
|
@ -2,22 +2,19 @@ import { Group, ToyBrick } from "lucide-react";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Outlet, useLocation, useNavigate } from "react-router-dom";
|
import { Outlet, useLocation, useNavigate } from "react-router-dom";
|
||||||
import DropdownButton from "../../components/DropdownButtonComponent";
|
import DropdownButton from "../../components/DropdownButtonComponent";
|
||||||
import NewFlowCardComponent from "../../modals/NewFlowModal/components/NewFlowCardComponent";
|
|
||||||
import IconComponent from "../../components/genericIconComponent";
|
import IconComponent from "../../components/genericIconComponent";
|
||||||
import PageLayout from "../../components/pageLayout";
|
import PageLayout from "../../components/pageLayout";
|
||||||
import SidebarNav from "../../components/sidebarComponent";
|
import SidebarNav from "../../components/sidebarComponent";
|
||||||
import { Button } from "../../components/ui/button";
|
import { Button } from "../../components/ui/button";
|
||||||
import UndrawCardComponent from "../../modals/NewFlowModal/components/undrawCards";
|
|
||||||
import { CONSOLE_ERROR_MSG } from "../../constants/alerts_constants";
|
import { CONSOLE_ERROR_MSG } from "../../constants/alerts_constants";
|
||||||
import {
|
import {
|
||||||
MY_COLLECTION_DESC,
|
MY_COLLECTION_DESC,
|
||||||
USER_PROJECTS_HEADER,
|
USER_PROJECTS_HEADER,
|
||||||
} from "../../constants/constants";
|
} from "../../constants/constants";
|
||||||
import BaseModal from "../../modals/baseModal";
|
import NewFlowModal from "../../modals/NewFlowModal";
|
||||||
import useAlertStore from "../../stores/alertStore";
|
import useAlertStore from "../../stores/alertStore";
|
||||||
import useFlowsManagerStore from "../../stores/flowsManagerStore";
|
import useFlowsManagerStore from "../../stores/flowsManagerStore";
|
||||||
import { downloadFlows } from "../../utils/reactflowUtils";
|
import { downloadFlows } from "../../utils/reactflowUtils";
|
||||||
import NewFlowModal from "../../modals/NewFlowModal";
|
|
||||||
export default function HomePage(): JSX.Element {
|
export default function HomePage(): JSX.Element {
|
||||||
const uploadFlow = useFlowsManagerStore((state) => state.uploadFlow);
|
const uploadFlow = useFlowsManagerStore((state) => state.uploadFlow);
|
||||||
const setCurrentFlowId = useFlowsManagerStore(
|
const setCurrentFlowId = useFlowsManagerStore(
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
|
||||||
},
|
},
|
||||||
getNodePosition: (nodeId: string) => {
|
getNodePosition: (nodeId: string) => {
|
||||||
const node = get().nodes.find((node) => node.id === nodeId);
|
const node = get().nodes.find((node) => node.id === nodeId);
|
||||||
return node?.position||{x:0,y:0};
|
return node?.position || { x: 0, y: 0 };
|
||||||
},
|
},
|
||||||
updateFlowPool: (
|
updateFlowPool: (
|
||||||
nodeId: string,
|
nodeId: string,
|
||||||
|
|
@ -529,9 +529,9 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
|
||||||
onGetOrderSuccess: () => {
|
onGetOrderSuccess: () => {
|
||||||
setNoticeData({ title: "Running components" });
|
setNoticeData({ title: "Running components" });
|
||||||
},
|
},
|
||||||
onBuildComplete: () => {
|
onBuildComplete: (allNodesValid) => {
|
||||||
const nodeId = startNodeId || stopNodeId;
|
const nodeId = startNodeId || stopNodeId;
|
||||||
if (nodeId) {
|
if (nodeId && allNodesValid) {
|
||||||
setSuccessData({
|
setSuccessData({
|
||||||
title: `${
|
title: `${
|
||||||
get().nodes.find((node) => node.id === nodeId)?.data.node
|
get().nodes.find((node) => node.id === nodeId)?.data.node
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { ReactElement, ReactNode, SetStateAction } from "react";
|
import { ReactElement, ReactNode, SetStateAction } from "react";
|
||||||
import { ReactFlowJsonObject, XYPosition } from "reactflow";
|
import { ReactFlowJsonObject } from "reactflow";
|
||||||
import { InputOutput } from "../../constants/enums";
|
import { InputOutput } from "../../constants/enums";
|
||||||
import { APIClassType, APITemplateType, TemplateVariableType } from "../api";
|
import { APIClassType, APITemplateType, TemplateVariableType } from "../api";
|
||||||
import { ChatMessageType } from "../chat";
|
import { ChatMessageType } from "../chat";
|
||||||
|
|
|
||||||
|
|
@ -1170,7 +1170,7 @@ export function downloadNode(NodeFLow: FlowType) {
|
||||||
type: "application/json",
|
type: "application/json",
|
||||||
});
|
});
|
||||||
element.href = URL.createObjectURL(file);
|
element.href = URL.createObjectURL(file);
|
||||||
element.download = `${NodeFLow?.name??"node"}.json`;
|
element.download = `${NodeFLow?.name ?? "node"}.json`;
|
||||||
element.click();
|
element.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import react from "@vitejs/plugin-react-swc";
|
import react from "@vitejs/plugin-react-swc";
|
||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
import svgr from "vite-plugin-svgr";
|
import svgr from "vite-plugin-svgr";
|
||||||
import MillionCompiler from "@million/lint";
|
|
||||||
const apiRoutes = ["^/api/v1/", "/health"];
|
const apiRoutes = ["^/api/v1/", "/health"];
|
||||||
|
|
||||||
// Use environment variable to determine the target.
|
// Use environment variable to determine the target.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue