Fixed type errors on GenericNode

This commit is contained in:
Lucas Oliveira 2024-06-19 14:29:32 -03:00
commit 94fec39865
5 changed files with 13 additions and 10 deletions

View file

@ -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) => {

View file

@ -434,7 +434,7 @@ const useFlowStore = create<FlowStoreType>((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;

View file

@ -201,7 +201,7 @@ export type VertexDataTypeAPI = {
timedelta?: number;
duration?: string;
artifacts?: any | ChatOutputType | ChatInputType;
message: ChatOutputType | ChatInputType;
message?: ChatOutputType | ChatInputType;
};
export type CodeErrorDataTypeAPI = {

View file

@ -126,7 +126,7 @@ export type FlowStoreType = {
silent,
setLockChat,
}: {
setLockChat: (lock: boolean) => void;
setLockChat?: (lock: boolean) => void;
startNodeId?: string;
stopNodeId?: string;
input_value?: string;

View file

@ -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;
}
}