Update FlowStoreType to include ChatOutputType and chatInputType
This commit is contained in:
parent
20810988b0
commit
2add242a18
2 changed files with 13 additions and 5 deletions
|
|
@ -19,7 +19,7 @@ import {
|
|||
sourceHandleType,
|
||||
targetHandleType,
|
||||
} from "../types/flow";
|
||||
import { FlowPoolObjectType, FlowStoreType } from "../types/zustand/flow";
|
||||
import { ChatOutputType, FlowPoolObjectType, FlowStoreType, chatInputType } from "../types/zustand/flow";
|
||||
import { buildVertices } from "../utils/buildUtils";
|
||||
import {
|
||||
cleanEdges,
|
||||
|
|
@ -59,7 +59,7 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
|
|||
}
|
||||
get().setFlowPool(newFlowPool);
|
||||
},
|
||||
updateFlowPool:(nodeId:string,data:FlowPoolObjectType,buildId?:string)=>{
|
||||
updateFlowPool:(nodeId:string,data:FlowPoolObjectType| ChatOutputType | chatInputType,buildId?:string)=>{
|
||||
let newFlowPool = cloneDeep({ ...get().flowPool });
|
||||
if (!newFlowPool[nodeId]){
|
||||
return;
|
||||
|
|
@ -69,7 +69,15 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
|
|||
if(buildId){
|
||||
index = newFlowPool[nodeId].findIndex((flow)=>flow.id===buildId);
|
||||
}
|
||||
newFlowPool[nodeId][index] = data;
|
||||
//check if the data is a flowpool object
|
||||
if((data as FlowPoolObjectType).data?.artifacts!==undefined){
|
||||
newFlowPool[nodeId][index] = (data as FlowPoolObjectType);
|
||||
}
|
||||
//update data artifact
|
||||
else
|
||||
{
|
||||
newFlowPool[nodeId][index].data.artifacts = data;
|
||||
}
|
||||
}
|
||||
get().setFlowPool(newFlowPool);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ export type FlowPoolObjectType = {
|
|||
timestamp: string;
|
||||
valid: boolean;
|
||||
params: any;
|
||||
data: { artifacts: any; results: any | ChatOutputType | chatInputType };
|
||||
data: { artifacts: any | ChatOutputType | chatInputType; results: any | ChatOutputType | chatInputType };
|
||||
duration: string;
|
||||
progress: number;
|
||||
id: string;
|
||||
|
|
@ -92,5 +92,5 @@ export type FlowStoreType = {
|
|||
updateBuildStatus: (nodeId: string[], status: BuildStatus) => void;
|
||||
revertBuiltStatusFromBuilding: () => void;
|
||||
flowBuildStatus: { [key: string]: BuildStatus };
|
||||
updateFlowPool: (nodeId:string, data:FlowPoolObjectType,buildId?:string) => void;
|
||||
updateFlowPool: (nodeId:string, data:FlowPoolObjectType | ChatOutputType | chatInputType,buildId?:string) => void;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue