Fix formatting issues in code
This commit is contained in:
parent
7ad111ef2e
commit
fc25261d3c
11 changed files with 41 additions and 30 deletions
|
|
@ -19,8 +19,8 @@ import Router from "./routes";
|
||||||
import useAlertStore from "./stores/alertStore";
|
import useAlertStore from "./stores/alertStore";
|
||||||
import { useDarkStore } from "./stores/darkStore";
|
import { useDarkStore } from "./stores/darkStore";
|
||||||
import useFlowsManagerStore from "./stores/flowsManagerStore";
|
import useFlowsManagerStore from "./stores/flowsManagerStore";
|
||||||
import { useTypesStore } from "./stores/typesStore";
|
|
||||||
import { useStoreStore } from "./stores/storeStore";
|
import { useStoreStore } from "./stores/storeStore";
|
||||||
|
import { useTypesStore } from "./stores/typesStore";
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
const removeFromTempNotificationList = useAlertStore(
|
const removeFromTempNotificationList = useAlertStore(
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import { Button } from "../../components/ui/button";
|
||||||
import Checkmark from "../../components/ui/checkmark";
|
import Checkmark from "../../components/ui/checkmark";
|
||||||
import Loading from "../../components/ui/loading";
|
import Loading from "../../components/ui/loading";
|
||||||
import { Textarea } from "../../components/ui/textarea";
|
import { Textarea } from "../../components/ui/textarea";
|
||||||
|
import Xmark from "../../components/ui/xmark";
|
||||||
import { priorityFields } from "../../constants/constants";
|
import { priorityFields } from "../../constants/constants";
|
||||||
import { BuildStatus } from "../../constants/enums";
|
import { BuildStatus } from "../../constants/enums";
|
||||||
import NodeToolbarComponent from "../../pages/FlowPage/components/nodeToolbarComponent";
|
import NodeToolbarComponent from "../../pages/FlowPage/components/nodeToolbarComponent";
|
||||||
|
|
@ -20,7 +21,6 @@ import { handleKeyDown, scapedJSONStringfy } from "../../utils/reactflowUtils";
|
||||||
import { nodeColors, nodeIconsLucide } from "../../utils/styleUtils";
|
import { nodeColors, nodeIconsLucide } from "../../utils/styleUtils";
|
||||||
import { classNames, cn, getFieldTitle } from "../../utils/utils";
|
import { classNames, cn, getFieldTitle } from "../../utils/utils";
|
||||||
import ParameterComponent from "./components/parameterComponent";
|
import ParameterComponent from "./components/parameterComponent";
|
||||||
import Xmark from "../../components/ui/xmark";
|
|
||||||
|
|
||||||
export default function GenericNode({
|
export default function GenericNode({
|
||||||
data,
|
data,
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ export default function IOInputField({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div className="font-xl flex items-start h-full w-full flex-col gap-4 p-4 font-semibold">
|
<div className="font-xl flex h-full w-full flex-col items-start gap-4 p-4 font-semibold">
|
||||||
{inputType}
|
{inputType}
|
||||||
{handleInputType()}
|
{handleInputType()}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ export default function IOOutputView({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div className="font-xl flex h-full items-start w-full flex-col gap-4 p-4 font-semibold">
|
<div className="font-xl flex h-full w-full flex-col items-start gap-4 p-4 font-semibold">
|
||||||
{outputType}
|
{outputType}
|
||||||
{handleOutputType()}
|
{handleOutputType()}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import { CHAT_FORM_DIALOG_SUBTITLE } from "../../constants/constants";
|
||||||
import BaseModal from "../../modals/baseModal";
|
import BaseModal from "../../modals/baseModal";
|
||||||
import useAlertStore from "../../stores/alertStore";
|
import useAlertStore from "../../stores/alertStore";
|
||||||
import useFlowStore from "../../stores/flowStore";
|
import useFlowStore from "../../stores/flowStore";
|
||||||
import { NodeType } from "../../types/flow";
|
|
||||||
import { validateNodes } from "../../utils/reactflowUtils";
|
import { validateNodes } from "../../utils/reactflowUtils";
|
||||||
import { cn } from "../../utils/utils";
|
import { cn } from "../../utils/utils";
|
||||||
import AccordionComponent from "../AccordionComponent";
|
import AccordionComponent from "../AccordionComponent";
|
||||||
|
|
@ -31,11 +30,10 @@ export default function IOView({ children, open, setOpen }): JSX.Element {
|
||||||
);
|
);
|
||||||
const nodes = useFlowStore((state) => state.nodes).filter(
|
const nodes = useFlowStore((state) => state.nodes).filter(
|
||||||
(node) =>
|
(node) =>
|
||||||
(inputs.some((input) => input.id === node.id) ||
|
inputs.some((input) => input.id === node.id) ||
|
||||||
outputs.some((output) => output.id === node.id))
|
outputs.some((output) => output.id === node.id)
|
||||||
);
|
);
|
||||||
const haveChat =
|
const haveChat = chatInput || chatOutput;
|
||||||
chatInput || chatOutput
|
|
||||||
const [selectedTab, setSelectedTab] = useState(
|
const [selectedTab, setSelectedTab] = useState(
|
||||||
inputs.length > 0 ? 1 : outputs.length > 0 ? 2 : 0
|
inputs.length > 0 ? 1 : outputs.length > 0 ? 2 : 0
|
||||||
);
|
);
|
||||||
|
|
@ -289,11 +287,19 @@ export default function IOView({ children, open, setOpen }): JSX.Element {
|
||||||
</div>
|
</div>
|
||||||
{!haveChat && (
|
{!haveChat && (
|
||||||
<div className="flex w-full justify-end pt-6">
|
<div className="flex w-full justify-end pt-6">
|
||||||
<Button variant={"outline"} className="px-3 flex gap-2" onClick={() => sendMessage(1)}>
|
<Button
|
||||||
|
variant={"outline"}
|
||||||
|
className="flex gap-2 px-3"
|
||||||
|
onClick={() => sendMessage(1)}
|
||||||
|
>
|
||||||
<IconComponent
|
<IconComponent
|
||||||
name={isBuilding ? "Loader2" : "Play"}
|
name={isBuilding ? "Loader2" : "Play"}
|
||||||
className={cn("h-4 w-4", isBuilding ? "animate-spin" : "fill-current text-medium-indigo")}
|
className={cn(
|
||||||
|
"h-4 w-4",
|
||||||
|
isBuilding
|
||||||
|
? "animate-spin"
|
||||||
|
: "fill-current text-medium-indigo"
|
||||||
|
)}
|
||||||
/>
|
/>
|
||||||
Run Flow
|
Run Flow
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,7 @@ import {
|
||||||
SelectValue,
|
SelectValue,
|
||||||
} from "../../components/ui/select";
|
} from "../../components/ui/select";
|
||||||
import { AuthContext } from "../../contexts/authContext";
|
import { AuthContext } from "../../contexts/authContext";
|
||||||
import {
|
import { getStoreComponents, getStoreTags } from "../../controllers/API";
|
||||||
checkHasApiKey,
|
|
||||||
getStoreComponents,
|
|
||||||
getStoreTags,
|
|
||||||
} from "../../controllers/API";
|
|
||||||
import StoreApiKeyModal from "../../modals/StoreApiKeyModal";
|
import StoreApiKeyModal from "../../modals/StoreApiKeyModal";
|
||||||
import useAlertStore from "../../stores/alertStore";
|
import useAlertStore from "../../stores/alertStore";
|
||||||
import useFlowsManagerStore from "../../stores/flowsManagerStore";
|
import useFlowsManagerStore from "../../stores/flowsManagerStore";
|
||||||
|
|
@ -47,9 +43,7 @@ export default function StorePage(): JSX.Element {
|
||||||
const setCurrentFlowId = useFlowsManagerStore(
|
const setCurrentFlowId = useFlowsManagerStore(
|
||||||
(state) => state.setCurrentFlowId
|
(state) => state.setCurrentFlowId
|
||||||
);
|
);
|
||||||
const currentFlowId = useFlowsManagerStore(
|
const currentFlowId = useFlowsManagerStore((state) => state.currentFlowId);
|
||||||
(state) => state.currentFlowId
|
|
||||||
);
|
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [loadingTags, setLoadingTags] = useState(true);
|
const [loadingTags, setLoadingTags] = useState(true);
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ import { FLOW_BUILD_SUCCESS_ALERT } from "../alerts_constants";
|
||||||
// this is our useStore hook that we can use in our components to get parts of the store and call actions
|
// this is our useStore hook that we can use in our components to get parts of the store and call actions
|
||||||
const useFlowStore = create<FlowStoreType>((set, get) => ({
|
const useFlowStore = create<FlowStoreType>((set, get) => ({
|
||||||
flowState: undefined,
|
flowState: undefined,
|
||||||
flowBuildStatus:{},
|
flowBuildStatus: {},
|
||||||
nodes: [],
|
nodes: [],
|
||||||
edges: [],
|
edges: [],
|
||||||
isBuilding: false,
|
isBuilding: false,
|
||||||
|
|
@ -403,7 +403,12 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
|
||||||
nodeId,
|
nodeId,
|
||||||
onBuildComplete: () => {
|
onBuildComplete: () => {
|
||||||
if (nodeId) {
|
if (nodeId) {
|
||||||
setSuccessData({ title: `${get().nodes.find((node) => node.id === nodeId)?.data.node?.display_name} built successfully` });
|
setSuccessData({
|
||||||
|
title: `${
|
||||||
|
get().nodes.find((node) => node.id === nodeId)?.data.node
|
||||||
|
?.display_name
|
||||||
|
} built successfully`,
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
setSuccessData({ title: FLOW_BUILD_SUCCESS_ALERT });
|
setSuccessData({ title: FLOW_BUILD_SUCCESS_ALERT });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { create } from "zustand";
|
import { create } from "zustand";
|
||||||
import { checkHasApiKey, checkHasStore } from "../controllers/API";
|
import { checkHasApiKey, checkHasStore } from "../controllers/API";
|
||||||
import { StoreStoreType } from "../types/zustand/store";
|
import { StoreStoreType } from "../types/zustand/store";
|
||||||
import useAlertStore from "./alertStore";
|
|
||||||
|
|
||||||
export const useStoreStore = create<StoreStoreType>((set) => ({
|
export const useStoreStore = create<StoreStoreType>((set) => ({
|
||||||
hasStore: true,
|
hasStore: true,
|
||||||
|
|
|
||||||
|
|
@ -524,7 +524,11 @@ export type chatMessagePropsType = {
|
||||||
chat: ChatMessageType;
|
chat: ChatMessageType;
|
||||||
lockChat: boolean;
|
lockChat: boolean;
|
||||||
lastMessage: boolean;
|
lastMessage: boolean;
|
||||||
updateChat: (chat: ChatMessageType, message: string, stream_url: string) => void;
|
updateChat: (
|
||||||
|
chat: ChatMessageType,
|
||||||
|
message: string,
|
||||||
|
stream_url: string
|
||||||
|
) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type formModalPropsType = {
|
export type formModalPropsType = {
|
||||||
|
|
|
||||||
|
|
@ -58,12 +58,15 @@ export function normalCaseToSnakeCase(str: string): string {
|
||||||
.join("_");
|
.join("_");
|
||||||
}
|
}
|
||||||
|
|
||||||
export function toTitleCase(str: string | undefined, isNodeField?: boolean): string {
|
export function toTitleCase(
|
||||||
|
str: string | undefined,
|
||||||
|
isNodeField?: boolean
|
||||||
|
): string {
|
||||||
if (!str) return "";
|
if (!str) return "";
|
||||||
let result = str
|
let result = str
|
||||||
.split("_")
|
.split("_")
|
||||||
.map((word, index) => {
|
.map((word, index) => {
|
||||||
if (isNodeField) return word
|
if (isNodeField) return word;
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
return checkUpperWords(
|
return checkUpperWords(
|
||||||
word[0].toUpperCase() + word.slice(1).toLowerCase()
|
word[0].toUpperCase() + word.slice(1).toLowerCase()
|
||||||
|
|
@ -76,7 +79,7 @@ export function toTitleCase(str: string | undefined, isNodeField?: boolean): str
|
||||||
return result
|
return result
|
||||||
.split("-")
|
.split("-")
|
||||||
.map((word, index) => {
|
.map((word, index) => {
|
||||||
if (isNodeField) return word
|
if (isNodeField) return word;
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
return checkUpperWords(
|
return checkUpperWords(
|
||||||
word[0].toUpperCase() + word.slice(1).toLowerCase()
|
word[0].toUpperCase() + word.slice(1).toLowerCase()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue