diff --git a/src/frontend/src/CustomNodes/hooks/use-validation-status-string.tsx b/src/frontend/src/CustomNodes/hooks/use-validation-status-string.tsx index bb37900d5..a8f964a2c 100644 --- a/src/frontend/src/CustomNodes/hooks/use-validation-status-string.tsx +++ b/src/frontend/src/CustomNodes/hooks/use-validation-status-string.tsx @@ -3,11 +3,11 @@ import { VertexBuildTypeAPI } from "../../types/api"; import { isErrorLog } from "../../types/utils/typeCheckingUtils"; const useValidationStatusString = ( - validationStatus: VertexBuildTypeAPI, + validationStatus: VertexBuildTypeAPI | null, setValidationString, ) => { useEffect(() => { - if (validationStatus?.data?.logs) { + if (validationStatus && validationStatus.data?.logs) { // if it is not a string turn it into a string let newValidationString = ""; Object.values(validationStatus?.data?.logs).forEach((log: any) => { diff --git a/src/frontend/src/stores/flowStore.ts b/src/frontend/src/stores/flowStore.ts index d7f6a7e26..597308e25 100644 --- a/src/frontend/src/stores/flowStore.ts +++ b/src/frontend/src/stores/flowStore.ts @@ -434,7 +434,7 @@ const useFlowStore = create((set, get) => ({ input_value?: string; files?: string[]; silent?: boolean; - setLockChat: (lock: boolean) => void; + setLockChat?: (lock: boolean) => void; }) => { get().setIsBuilding(true); const currentFlow = useFlowsManagerStore.getState().currentFlow; diff --git a/src/frontend/src/types/api/index.ts b/src/frontend/src/types/api/index.ts index 5c60f6cf2..b9c9c1e4b 100644 --- a/src/frontend/src/types/api/index.ts +++ b/src/frontend/src/types/api/index.ts @@ -201,7 +201,7 @@ export type VertexDataTypeAPI = { timedelta?: number; duration?: string; artifacts?: any | ChatOutputType | ChatInputType; - message: ChatOutputType | ChatInputType; + message?: ChatOutputType | ChatInputType; }; export type CodeErrorDataTypeAPI = { diff --git a/src/frontend/src/types/zustand/flow/index.ts b/src/frontend/src/types/zustand/flow/index.ts index c74cff320..77eef030d 100644 --- a/src/frontend/src/types/zustand/flow/index.ts +++ b/src/frontend/src/types/zustand/flow/index.ts @@ -126,7 +126,7 @@ export type FlowStoreType = { silent, setLockChat, }: { - setLockChat: (lock: boolean) => void; + setLockChat?: (lock: boolean) => void; startNodeId?: string; stopNodeId?: string; input_value?: string; diff --git a/src/frontend/src/utils/buildUtils.ts b/src/frontend/src/utils/buildUtils.ts index 01bb94c4e..b9b8c453d 100644 --- a/src/frontend/src/utils/buildUtils.ts +++ b/src/frontend/src/utils/buildUtils.ts @@ -9,7 +9,7 @@ import { isErrorLogType } from "../types/utils/typeCheckingUtils"; import { VertexLayerElementType } from "../types/zustand/flow"; type BuildVerticesParams = { - setLockChat: (lock: boolean) => void; + setLockChat?: (lock: boolean) => void; flowId: string; // Assuming FlowType is the type for your flow input_value?: any; // Replace any with the actual type if it's not any files?: string[]; @@ -33,7 +33,7 @@ function getInactiveVertexData(vertexId: string): VertexBuildTypeAPI { // Build VertexBuildTypeAPI let inactiveData = { results: {}, - logs: [], + logs: {}, messages: [], inactive: true, }; @@ -46,6 +46,9 @@ function getInactiveVertexData(vertexId: string): VertexBuildTypeAPI { top_level_vertices: [], inactive_vertices: null, valid: false, + params: null, + messages: [], + artifacts: null, timestamp: new Date().toISOString(), }; @@ -54,7 +57,7 @@ function getInactiveVertexData(vertexId: string): VertexBuildTypeAPI { export async function updateVerticesOrder( flowId: string, - setLockChat: (lock: boolean) => void, + setLockChat?: (lock: boolean) => void, startNodeId?: string | null, stopNodeId?: string | null, nodes?: Node[], @@ -82,7 +85,7 @@ export async function updateVerticesOrder( list: [error.response?.data?.detail ?? "Unknown Error"], }); useFlowStore.getState().setIsBuilding(false); - setLockChat(false); + setLockChat && setLockChat(false); throw new Error("Invalid nodes"); } // orderResponse.data.ids, @@ -141,7 +144,7 @@ export async function buildVertices({ onValidateNodes(verticesOrderResponse.verticesToRun); } catch (e) { useFlowStore.getState().setIsBuilding(false); - setLockChat(false); + setLockChat && setLockChat(false); return; } }