diff --git a/src/frontend/src/CustomNodes/GenericNode/index.tsx b/src/frontend/src/CustomNodes/GenericNode/index.tsx index 64665bf73..572210728 100644 --- a/src/frontend/src/CustomNodes/GenericNode/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/index.tsx @@ -11,7 +11,13 @@ import { ExclamationCircleIcon, } from "@heroicons/react/24/solid"; -import { classNames, nodeColors, nodeIcons, toNormalCase, toTitleCase } from "../../utils"; +import { + classNames, + nodeColors, + nodeIcons, + toNormalCase, + toTitleCase, +} from "../../utils"; import ParameterComponent from "./components/parameterComponent"; import { typesContext } from "../../contexts/typesContext"; import { useContext, useState, useEffect, useRef, Fragment } from "react"; @@ -106,7 +112,7 @@ export default function GenericNode({ }} /> -
{data.type}
+
{data.type}
void; value: string; @@ -121,40 +121,41 @@ export default function PromptAreaModal({ switch (myModalType) { case 1: setModalOpen(false); - break; + break; case 2: checkPrompt(myValue) - .then((apiReturn) => { - if (apiReturn.data) { - let inputVariables = - apiReturn.data.input_variables; - if (inputVariables.length === 0) { + .then((apiReturn) => { + if (apiReturn.data) { + let inputVariables = + apiReturn.data.input_variables; + if (inputVariables.length === 0) { + setErrorData({ + title: + "The template you are attempting to use does not contain any variables for data entry.", + }); + } else { + setSuccessData({ + title: "Prompt is ready", + }); + setModalOpen(false); + setValue(myValue); + } + } else { setErrorData({ title: - "The template you are attempting to use does not contain any variables for data entry.", + "Something went wrong, please try again", }); - } else { - setSuccessData({ - title: "Prompt is ready", - }); - setModalOpen(false); - setValue(myValue); } - } else { - setErrorData({ - title: "Something went wrong, please try again", + }) + .catch((error) => { + return setErrorData({ + title: + "There is something wrong with this prompt, please review it", + list: [error.response.data.detail], }); - } - }) - .catch((error) => { - return setErrorData({ - title: - "There is something wrong with this prompt, please review it", - list: [error.response.data.detail], }); - }); - break; - + break; + default: break; } diff --git a/src/frontend/src/pages/FlowPage/components/extraSidebarComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/extraSidebarComponent/index.tsx index 41f98f299..1a9e721f7 100644 --- a/src/frontend/src/pages/FlowPage/components/extraSidebarComponent/index.tsx +++ b/src/frontend/src/pages/FlowPage/components/extraSidebarComponent/index.tsx @@ -34,7 +34,7 @@ export default function ExtraSidebar() { {Object.keys(data[d]) .sort() .map((t: string, k) => ( - 21 ? t : ''} placement="right"> + 21 ? t : ""} placement="right">
) { export enum TypeModal { TEXT = 1, - PROMPT = 2 + PROMPT = 2, } export const textColors = { @@ -499,33 +499,38 @@ export const programmingLanguages: languageMap = { }; export function toTitleCase(str: string) { - let result = str - .split("_") - .map((word, index) => { - if (index === 0) { + let result = str + .split("_") + .map((word, index) => { + if (index === 0) { + return checkUpperWords( + word[0].toUpperCase() + word.slice(1).toLowerCase() + ); + } + return checkUpperWords(word.toLowerCase()); + }) + .join(" "); - return checkUpperWords(word[0].toUpperCase() + word.slice(1).toLowerCase()); - } - return checkUpperWords(word.toLowerCase()); - }) - .join(" "); - - return result - .split("-") - .map((word, index) => { - if (index === 0) { - return checkUpperWords(word[0].toUpperCase() + word.slice(1).toLowerCase()); - } - return checkUpperWords(word.toLowerCase()); - }) - .join(" "); + return result + .split("-") + .map((word, index) => { + if (index === 0) { + return checkUpperWords( + word[0].toUpperCase() + word.slice(1).toLowerCase() + ); + } + return checkUpperWords(word.toLowerCase()); + }) + .join(" "); } export const upperCaseWords: string[] = ["llm", "uri"]; export function checkUpperWords(str: string) { - const words = str.split(' ').map((word) => { - return upperCaseWords.includes(word.toLowerCase()) ? word.toUpperCase() : word[0].toUpperCase() + word.slice(1).toLowerCase(); + const words = str.split(" ").map((word) => { + return upperCaseWords.includes(word.toLowerCase()) + ? word.toUpperCase() + : word[0].toUpperCase() + word.slice(1).toLowerCase(); }); - return words.join(' '); -} \ No newline at end of file + return words.join(" "); +}