created langFlowState type

This commit is contained in:
anovazzi1 2023-04-19 23:33:01 -03:00
commit 5c64bc6698
3 changed files with 10 additions and 3 deletions

View file

@ -1,6 +1,6 @@
import { createContext, useEffect, useState, useRef, ReactNode, useContext } from "react";
import { FlowType } from "../types/flow";
import { TabsContextType } from "../types/tabs";
import { LangFlowState, TabsContextType } from "../types/tabs";
import { normalCaseToSnakeCase } from "../utils";
import { alertContext } from "./alertContext";
import { TemplatesContext } from "./templatesContext";
@ -58,7 +58,7 @@ export function TabsProvider({ children }: { children: ReactNode }) {
if (cookie && Object.keys(templates).length>0) {
console.log(templates)
console.log(Object.keys(templates).length)
let cookieObject = JSON.parse(cookie);
let cookieObject:LangFlowState = JSON.parse(cookie);
setTabIndex(cookieObject.tabIndex);
setFlows(cookieObject.flows);
setId(cookieObject.id);

View file

@ -14,4 +14,6 @@ export type TabsContextType = {
lockChat:boolean;
setLockChat:(prevState:boolean)=>void;
hardReset:()=>void;
};
};
export type LangFlowState={ tabIndex:number, flows:FlowType[], id:number, nodeId:number }

View file

@ -17,6 +17,7 @@ import {
} from "@heroicons/react/24/outline";
import { Connection, Edge, Node, ReactFlowInstance } from "reactflow";
import { FlowType } from "./types/flow";
import { APIClassType } from "./types/api";
var _ = require('lodash')
export function classNames(...classes:Array<string>) {
@ -383,4 +384,8 @@ export function removeApiKeys(flow:FlowType):FlowType{
}
})
return cleanFLow
}
export function UpdateTemplate(newTemplate:APIClassType,oldTemplate:APIClassType){
}