Merge branch 'cz/bug/state/zustand' into zustand/io/migration
This commit is contained in:
commit
b8fab10f0b
49 changed files with 7909 additions and 15017 deletions
|
|
@ -57,6 +57,7 @@ export default function ParameterComponent({
|
|||
proxy,
|
||||
showNode,
|
||||
index = "",
|
||||
isMinimized,
|
||||
}: ParameterComponentType): JSX.Element {
|
||||
const ref = useRef<HTMLDivElement>(null);
|
||||
const refHtml = useRef<HTMLDivElement & ReactNode>(null);
|
||||
|
|
@ -287,7 +288,8 @@ export default function ParameterComponent({
|
|||
}
|
||||
className={classNames(
|
||||
left ? "my-12 -ml-0.5 " : " my-12 -mr-0.5 ",
|
||||
"h-3 w-3 rounded-full border-2 bg-background"
|
||||
"h-3 w-3 rounded-full border-2 bg-background",
|
||||
isMinimized ? "mt-0" : ""
|
||||
)}
|
||||
style={{
|
||||
borderColor: color,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { useEffect, useState } from "react";
|
||||
import { NodeToolbar } from "reactflow";
|
||||
import { NodeToolbar, useUpdateNodeInternals } from "reactflow";
|
||||
import ShadTooltip from "../../components/ShadTooltipComponent";
|
||||
import Tooltip from "../../components/TooltipComponent";
|
||||
import IconComponent from "../../components/genericIconComponent";
|
||||
|
|
@ -41,7 +41,9 @@ export default function GenericNode({
|
|||
const [validationStatus, setValidationStatus] =
|
||||
useState<validationStatusType | null>(null);
|
||||
const [handles, setHandles] = useState<boolean[] | []>([]);
|
||||
const [isMinimized, setIsMinimized] = useState<boolean>(false);
|
||||
let numberOfInputs: boolean[] = [];
|
||||
const updateNodeInternals = useUpdateNodeInternals();
|
||||
|
||||
const takeSnapshot = useFlowsManagerStore((state) => state.takeSnapshot);
|
||||
|
||||
|
|
@ -105,6 +107,10 @@ export default function GenericNode({
|
|||
|
||||
const nameEditable = data.node?.flow || data.type === "CustomComponent";
|
||||
|
||||
useEffect(() => {
|
||||
updateNodeInternals(data.id);
|
||||
}, [isMinimized]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<NodeToolbar>
|
||||
|
|
@ -123,6 +129,7 @@ export default function GenericNode({
|
|||
}}
|
||||
numberOfHandles={handles}
|
||||
showNode={showNode}
|
||||
setIsMinimized={setIsMinimized}
|
||||
></NodeToolbarComponent>
|
||||
</NodeToolbar>
|
||||
|
||||
|
|
@ -276,6 +283,7 @@ export default function GenericNode({
|
|||
}
|
||||
proxy={data.node?.template[templateField].proxy}
|
||||
showNode={showNode}
|
||||
isMinimized={isMinimized}
|
||||
/>
|
||||
)
|
||||
)}
|
||||
|
|
@ -302,6 +310,7 @@ export default function GenericNode({
|
|||
type={data.node?.base_classes.join("|")}
|
||||
left={false}
|
||||
showNode={showNode}
|
||||
isMinimized={isMinimized}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
|
@ -506,6 +515,7 @@ export default function GenericNode({
|
|||
}
|
||||
proxy={data.node?.template[templateField].proxy}
|
||||
showNode={showNode}
|
||||
isMinimized={isMinimized}
|
||||
/>
|
||||
) : (
|
||||
<></>
|
||||
|
|
@ -549,6 +559,7 @@ export default function GenericNode({
|
|||
type={data.node?.base_classes.join("|")}
|
||||
left={false}
|
||||
showNode={showNode}
|
||||
isMinimized={isMinimized}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import BuildTrigger from "./buildTrigger";
|
|||
import ChatTrigger from "./chatTrigger";
|
||||
|
||||
import * as _ from "lodash";
|
||||
import { getBuildStatus } from "../../controllers/API";
|
||||
import FormModal from "../../modals/formModal";
|
||||
import useFlowStore from "../../stores/flowStore";
|
||||
import { NodeType } from "../../types/flow";
|
||||
|
|
@ -32,17 +31,6 @@ export default function Chat({ flow }: ChatType): JSX.Element {
|
|||
};
|
||||
}, [isBuilt]);
|
||||
|
||||
useEffect(() => {
|
||||
// Define an async function within the useEffect hook
|
||||
const fetchBuildStatus = async () => {
|
||||
const response = await getBuildStatus(flow.id);
|
||||
setIsBuilt(response.data.built);
|
||||
};
|
||||
|
||||
// Call the async function
|
||||
fetchBuildStatus();
|
||||
}, [flow]);
|
||||
|
||||
const prevNodesRef = useRef<any[] | undefined>();
|
||||
const nodes: NodeType[] = useNodes();
|
||||
useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ import {
|
|||
convertObjToArray,
|
||||
convertValuesToNumbers,
|
||||
hasDuplicateKeys,
|
||||
unselectAllNodes,
|
||||
} from "../../utils/reactflowUtils";
|
||||
import { classNames } from "../../utils/utils";
|
||||
import DictComponent from "../dictComponent";
|
||||
|
|
@ -54,6 +53,7 @@ export default function CodeTabsComponent({
|
|||
const [data, setData] = useState(flow ? flow["data"]!["nodes"] : null);
|
||||
const [openAccordion, setOpenAccordion] = useState<string[]>([]);
|
||||
const dark = useDarkStore((state) => state.dark);
|
||||
const unselectAll = useFlowStore((state) => state.unselectAll);
|
||||
|
||||
const setNodes = useFlowStore((state) => state.setNodes);
|
||||
|
||||
|
|
@ -67,12 +67,7 @@ export default function CodeTabsComponent({
|
|||
|
||||
useEffect(() => {
|
||||
if (tweaks && data) {
|
||||
unselectAllNodes({
|
||||
data,
|
||||
updateNodes: (nodes) => {
|
||||
setNodes(nodes);
|
||||
},
|
||||
});
|
||||
unselectAll();
|
||||
}
|
||||
}, []);
|
||||
|
||||
|
|
@ -593,14 +588,7 @@ export default function CodeTabsComponent({
|
|||
].type === "prompt" ? (
|
||||
<div className="mx-auto">
|
||||
<PromptAreaComponent
|
||||
readonly={
|
||||
node.data.node?.flow &&
|
||||
node.data.node.template[
|
||||
templateField
|
||||
].dynamic
|
||||
? true
|
||||
: false
|
||||
}
|
||||
readonly={true}
|
||||
editNode={true}
|
||||
disabled={false}
|
||||
value={
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
const SvgElasticsearchLogo = (props) => (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth="2"
|
||||
className="icon icon-tabler icon-tabler-brand-elastic"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path stroke="none" d="M0 0h24v24H0z"></path>
|
||||
<path d="M14 2a5 5 0 015 5c0 .712-.232 1.387-.5 2 1.894.042 3.5 1.595 3.5 3.5 0 1.869-1.656 3.4-3.5 3.5.333.625.5 1.125.5 1.5a2.5 2.5 0 01-2.5 2.5c-.787 0-1.542-.432-2-1-.786 1.73-2.476 3-4.5 3a5 5 0 01-4.583-7 3.5 3.5 0 01-.11-6.992h.195a2.5 2.5 0 012-4c.787 0 1.542.432 2 1 .786-1.73 2.476-3 4.5-3zM8.5 9l-3-1"></path>
|
||||
<path d="M9.5 5l-1 4 1 2 5 2 4-4M18.499 16l-3-.5-1-2.5M14.5 19l1-3.5M5.417 15L9.5 11"></path>
|
||||
</svg>
|
||||
);
|
||||
export default SvgElasticsearchLogo;
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-brand-elastic" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||
<path d="M14 2a5 5 0 0 1 5 5c0 .712 -.232 1.387 -.5 2c1.894 .042 3.5 1.595 3.5 3.5c0 1.869 -1.656 3.4 -3.5 3.5c.333 .625 .5 1.125 .5 1.5a2.5 2.5 0 0 1 -2.5 2.5c-.787 0 -1.542 -.432 -2 -1c-.786 1.73 -2.476 3 -4.5 3a5 5 0 0 1 -4.583 -7a3.5 3.5 0 0 1 -.11 -6.992l.195 0a2.5 2.5 0 0 1 2 -4c.787 0 1.542 .432 2 1c.786 -1.73 2.476 -3 4.5 -3z" />
|
||||
<path d="M8.5 9l-3 -1" />
|
||||
<path d="M9.5 5l-1 4l1 2l5 2l4 -4" />
|
||||
<path d="M18.499 16l-3 -.5l-1 -2.5" />
|
||||
<path d="M14.5 19l1 -3.5" />
|
||||
<path d="M5.417 15l4.083 -4" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 810 B |
9
src/frontend/src/icons/ElasticsearchStore/index.tsx
Normal file
9
src/frontend/src/icons/ElasticsearchStore/index.tsx
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import React, { forwardRef } from "react";
|
||||
import SvgElasticsearchLogo from "./ElasticsearchLogo";
|
||||
|
||||
export const ElasticsearchIcon = forwardRef<
|
||||
SVGSVGElement,
|
||||
React.PropsWithChildren<{}>
|
||||
>((props, ref) => {
|
||||
return <SvgElasticsearchLogo ref={ref} {...props} />;
|
||||
});
|
||||
|
|
@ -126,7 +126,8 @@ export default function GenericModal({
|
|||
if (
|
||||
JSON.stringify(apiReturn.data?.frontend_node) !== JSON.stringify({})
|
||||
) {
|
||||
setNodeClass!(apiReturn.data?.frontend_node, inputValue);
|
||||
if (setNodeClass)
|
||||
setNodeClass(apiReturn.data?.frontend_node, inputValue);
|
||||
setModalOpen(closeModal);
|
||||
setIsEdit(false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ export default function NodeToolbarComponent({
|
|||
setShowNode,
|
||||
numberOfHandles,
|
||||
showNode,
|
||||
setIsMinimized,
|
||||
}: nodeToolbarPropsType): JSX.Element {
|
||||
const nodeLength = Object.keys(data.node!.template).filter(
|
||||
(templateField) =>
|
||||
|
|
@ -97,6 +98,10 @@ export default function NodeToolbarComponent({
|
|||
showconfirmShare,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
setIsMinimized(!showNode);
|
||||
}, [showNode]);
|
||||
|
||||
const handleSelectChange = (event) => {
|
||||
switch (event) {
|
||||
case "advanced":
|
||||
|
|
|
|||
|
|
@ -296,6 +296,17 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
|
|||
get().reactFlowInstance?.getViewport() ?? { x: 0, y: 0, zoom: 1 }
|
||||
);
|
||||
},
|
||||
unselectAll: () => {
|
||||
let newNodes = cloneDeep(get().nodes);
|
||||
newNodes.forEach((node) => {
|
||||
node.selected = false;
|
||||
let newEdges = cleanEdges(newNodes, get().edges);
|
||||
set({
|
||||
nodes: newNodes,
|
||||
edges: newEdges,
|
||||
});
|
||||
});
|
||||
},
|
||||
}));
|
||||
|
||||
export default useFlowStore;
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ export type ParameterComponentType = {
|
|||
showNode?: boolean;
|
||||
index?: string;
|
||||
onCloseModal?: (close: boolean) => void;
|
||||
isMinimized?: boolean;
|
||||
};
|
||||
export type InputListComponentType = {
|
||||
value: string[];
|
||||
|
|
@ -479,6 +480,7 @@ export type nodeToolbarPropsType = {
|
|||
setShowNode: (boolean: any) => void;
|
||||
numberOfHandles: boolean[] | [];
|
||||
showNode: boolean;
|
||||
setIsMinimized: (boolean: boolean) => void;
|
||||
};
|
||||
|
||||
export type parsedDataType = {
|
||||
|
|
|
|||
|
|
@ -54,4 +54,5 @@ export type FlowStoreType = {
|
|||
setFilterEdge: (newState) => void;
|
||||
getFilterEdge: any[];
|
||||
onConnect: (connection: Connection) => void;
|
||||
unselectAll: () => void;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@ import { AnthropicIcon } from "../icons/Anthropic";
|
|||
import { BingIcon } from "../icons/Bing";
|
||||
import { ChromaIcon } from "../icons/ChromaIcon";
|
||||
import { CohereIcon } from "../icons/Cohere";
|
||||
import { ElasticsearchIcon } from "../icons/ElasticsearchStore";
|
||||
import { EvernoteIcon } from "../icons/Evernote";
|
||||
import { FBIcon } from "../icons/FacebookMessenger";
|
||||
import { GitBookIcon } from "../icons/GitBook";
|
||||
|
|
@ -256,6 +257,7 @@ export const nodeIconsLucide: iconsType = {
|
|||
OpenAIEmbeddings: OpenAiIcon,
|
||||
Pinecone: PineconeIcon,
|
||||
Qdrant: QDrantIcon,
|
||||
ElasticsearchStore: ElasticsearchIcon,
|
||||
Weaviate: WeaviateIcon,
|
||||
Searx: SearxIcon,
|
||||
SlackDirectoryLoader: SvgSlackIcon,
|
||||
|
|
|
|||
|
|
@ -26,8 +26,7 @@ test("NestedComponent", async ({ page }) => {
|
|||
.getByTestId("vectorstoresPinecone")
|
||||
.first()
|
||||
.dragTo(page.locator('//*[@id="react-flow-id"]'));
|
||||
await page.mouse.up();
|
||||
await page.mouse.down();
|
||||
await page.click('//*[@id="react-flow-id"]');
|
||||
|
||||
await page.getByTestId("more-options-modal").click();
|
||||
await page.getByTestId("edit-button-modal").click();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue