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,
|
sourceHandleType,
|
||||||
targetHandleType,
|
targetHandleType,
|
||||||
} from "../types/flow";
|
} 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 { buildVertices } from "../utils/buildUtils";
|
||||||
import {
|
import {
|
||||||
cleanEdges,
|
cleanEdges,
|
||||||
|
|
@ -59,7 +59,7 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
|
||||||
}
|
}
|
||||||
get().setFlowPool(newFlowPool);
|
get().setFlowPool(newFlowPool);
|
||||||
},
|
},
|
||||||
updateFlowPool:(nodeId:string,data:FlowPoolObjectType,buildId?:string)=>{
|
updateFlowPool:(nodeId:string,data:FlowPoolObjectType| ChatOutputType | chatInputType,buildId?:string)=>{
|
||||||
let newFlowPool = cloneDeep({ ...get().flowPool });
|
let newFlowPool = cloneDeep({ ...get().flowPool });
|
||||||
if (!newFlowPool[nodeId]){
|
if (!newFlowPool[nodeId]){
|
||||||
return;
|
return;
|
||||||
|
|
@ -69,7 +69,15 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
|
||||||
if(buildId){
|
if(buildId){
|
||||||
index = newFlowPool[nodeId].findIndex((flow)=>flow.id===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);
|
get().setFlowPool(newFlowPool);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ export type FlowPoolObjectType = {
|
||||||
timestamp: string;
|
timestamp: string;
|
||||||
valid: boolean;
|
valid: boolean;
|
||||||
params: any;
|
params: any;
|
||||||
data: { artifacts: any; results: any | ChatOutputType | chatInputType };
|
data: { artifacts: any | ChatOutputType | chatInputType; results: any | ChatOutputType | chatInputType };
|
||||||
duration: string;
|
duration: string;
|
||||||
progress: number;
|
progress: number;
|
||||||
id: string;
|
id: string;
|
||||||
|
|
@ -92,5 +92,5 @@ export type FlowStoreType = {
|
||||||
updateBuildStatus: (nodeId: string[], status: BuildStatus) => void;
|
updateBuildStatus: (nodeId: string[], status: BuildStatus) => void;
|
||||||
revertBuiltStatusFromBuilding: () => void;
|
revertBuiltStatusFromBuilding: () => void;
|
||||||
flowBuildStatus: { [key: string]: BuildStatus };
|
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