diff --git a/src/frontend/src/CustomNodes/GenericNode/components/OutputComponent/index.tsx b/src/frontend/src/CustomNodes/GenericNode/components/OutputComponent/index.tsx index 1ff965ab5..1ec2a456a 100644 --- a/src/frontend/src/CustomNodes/GenericNode/components/OutputComponent/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/components/OutputComponent/index.tsx @@ -40,12 +40,12 @@ export default function OutputComponent({ if (types.length < 2) { return displayProxy( - {name}, + {name}, ); } return ( -
+
- + {promptOpen ? template?.split("\n")?.map((line, index) => { - const regex = /{([^}]+)}/g; - let match; - let parts: Array = []; - let lastIndex = 0; - while ((match = regex.exec(line)) !== null) { - // Push text up to the match - if (match.index !== lastIndex) { - parts.push(line.substring(lastIndex, match.index)); - } - // Push div with matched text - if (chat.message[match[1]]) { - parts.push( - - {chat.message[match[1]]} - , - ); - } + const regex = /{([^}]+)}/g; + let match; + let parts: Array = []; + let lastIndex = 0; + while ((match = regex.exec(line)) !== null) { + // Push text up to the match + if (match.index !== lastIndex) { + parts.push(line.substring(lastIndex, match.index)); + } + // Push div with matched text + if (chat.message[match[1]]) { + parts.push( + + {chat.message[match[1]]} + , + ); + } - // Update last index - lastIndex = regex.lastIndex; - } - // Push text after the last match - if (lastIndex !== line.length) { - parts.push(line.substring(lastIndex)); - } - return

{parts}

; - }) - : (chatMessage === "" ? EMPTY_INPUT_SEND_MESSAGE : chatMessage) - } + // Update last index + lastIndex = regex.lastIndex; + } + // Push text after the last match + if (lastIndex !== line.length) { + parts.push(line.substring(lastIndex)); + } + return

{parts}

; + }) + : chatMessage === "" + ? EMPTY_INPUT_SEND_MESSAGE + : chatMessage}
) : (
- {(chatMessage === "" ? EMPTY_INPUT_SEND_MESSAGE : chatMessage)} + {chatMessage === "" ? EMPTY_INPUT_SEND_MESSAGE : chatMessage} {chat.files && (
diff --git a/src/frontend/src/modals/textModal/index.tsx b/src/frontend/src/modals/textModal/index.tsx index bd78c678c..b79bf1fd1 100644 --- a/src/frontend/src/modals/textModal/index.tsx +++ b/src/frontend/src/modals/textModal/index.tsx @@ -32,7 +32,7 @@ export default function TextModal({ {children} - View Text + View Text
- +
diff --git a/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx index 22828005a..c3632cf6d 100644 --- a/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx +++ b/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx @@ -194,8 +194,8 @@ export default function Page({ function handleGroup(e: KeyboardEvent) { if (selectionMenuVisible) { - e.preventDefault(); - (e as unknown as Event).stopImmediatePropagation(); + e.preventDefault(); + (e as unknown as Event).stopImmediatePropagation(); handleGroupNode(); } } diff --git a/src/frontend/src/pages/FlowPage/components/SelectionMenuComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/SelectionMenuComponent/index.tsx index c5e7d9ad0..912a03e18 100644 --- a/src/frontend/src/pages/FlowPage/components/SelectionMenuComponent/index.tsx +++ b/src/frontend/src/pages/FlowPage/components/SelectionMenuComponent/index.tsx @@ -1,10 +1,10 @@ import { useEffect, useState } from "react"; +import { useHotkeys } from "react-hotkeys-hook"; import { NodeToolbar } from "reactflow"; import { Button } from "../../../../components/ui/button"; import { GradientGroup } from "../../../../icons/GradientSparkles"; import useFlowStore from "../../../../stores/flowStore"; import { validateSelection } from "../../../../utils/reactflowUtils"; -import { useHotkeys } from "react-hotkeys-hook"; export default function SelectionMenu({ onClick, nodes, diff --git a/src/frontend/src/stores/flowStore.ts b/src/frontend/src/stores/flowStore.ts index c2b84ae5a..d7f6a7e26 100644 --- a/src/frontend/src/stores/flowStore.ts +++ b/src/frontend/src/stores/flowStore.ts @@ -528,7 +528,6 @@ const useFlowStore = create((set, get) => ({ (id) => newFlowBuildStatus[id]?.status !== BuildStatus.BUILT, ); - if (verticesToUpdate) { useFlowStore.getState().updateBuildStatus(verticesToUpdate, status); } @@ -628,7 +627,6 @@ const useFlowStore = create((set, get) => ({ }); }, updateBuildStatus: (nodeIdList: string[], status: BuildStatus) => { - const newFlowBuildStatus = { ...get().flowBuildStatus }; nodeIdList.forEach((id) => { newFlowBuildStatus[id] = { diff --git a/src/frontend/src/stores/flowsManagerStore.ts b/src/frontend/src/stores/flowsManagerStore.ts index b58f27a42..a804710ac 100644 --- a/src/frontend/src/stores/flowsManagerStore.ts +++ b/src/frontend/src/stores/flowsManagerStore.ts @@ -262,17 +262,18 @@ const useFlowsManagerStore = create((set, get) => ({ // Return the id return id; - } catch (error:any) { - if(error.response?.data?.detail){ + } catch (error: any) { + if (error.response?.data?.detail) { useAlertStore.getState().setErrorData({ title: "Could not load flows from database", list: [error.response?.data?.detail], }); - } - else{ + } else { useAlertStore.getState().setErrorData({ title: "Could not load flows from database", - list: [error.message?? "An unexpected error occurred, please try again"], + list: [ + error.message ?? "An unexpected error occurred, please try again", + ], }); } throw error; // Re-throw the error so the caller can handle it if needed diff --git a/src/frontend/src/types/zustand/flow/index.ts b/src/frontend/src/types/zustand/flow/index.ts index 6583e4a96..c74cff320 100644 --- a/src/frontend/src/types/zustand/flow/index.ts +++ b/src/frontend/src/types/zustand/flow/index.ts @@ -124,7 +124,7 @@ export type FlowStoreType = { input_value, files, silent, - setLockChat + setLockChat, }: { setLockChat: (lock: boolean) => void; startNodeId?: string; diff --git a/src/frontend/src/utils/buildUtils.ts b/src/frontend/src/utils/buildUtils.ts index f072ceb24..71bf4618c 100644 --- a/src/frontend/src/utils/buildUtils.ts +++ b/src/frontend/src/utils/buildUtils.ts @@ -140,7 +140,7 @@ export async function buildVertices({ onValidateNodes(verticesOrderResponse.verticesToRun); } catch (e) { useFlowStore.getState().setIsBuilding(false); - setLockChat(false) + setLockChat(false); return; } } diff --git a/src/frontend/src/utils/reactflowUtils.ts b/src/frontend/src/utils/reactflowUtils.ts index c42925225..7aa6a6ff1 100644 --- a/src/frontend/src/utils/reactflowUtils.ts +++ b/src/frontend/src/utils/reactflowUtils.ts @@ -1452,7 +1452,7 @@ export const createNewFlow = ( id: "", is_component: flow?.is_component ?? false, folder_id: folderId, - endpoint_name:flow?.endpoint_name ?? undefined, + endpoint_name: flow?.endpoint_name ?? undefined, }; };