merge dev

This commit is contained in:
cristhianzl 2024-06-06 12:15:35 -03:00
commit feca70d7ec
10 changed files with 27 additions and 73 deletions

View file

@ -964,12 +964,8 @@ export async function getVerticesOrder(
export async function postBuildVertex( export async function postBuildVertex(
flowId: string, flowId: string,
vertexId: string, vertexId: string,
<<<<<<< HEAD
input_value: string, input_value: string,
files?: string[], files?: string[]
=======
input_value: string
>>>>>>> dev
): Promise<AxiosResponse<VertexBuildTypeAPI>> { ): Promise<AxiosResponse<VertexBuildTypeAPI>> {
// input_value is optional and is a query parameter // input_value is optional and is a query parameter
const data = { inputs: { input_value: input_value ?? "" } }; const data = { inputs: { input_value: input_value ?? "" } };
@ -978,11 +974,7 @@ export async function postBuildVertex(
} }
return await api.post( return await api.post(
`${BASE_URL_API}build/${flowId}/vertices/${vertexId}`, `${BASE_URL_API}build/${flowId}/vertices/${vertexId}`,
<<<<<<< HEAD data
data,
=======
input_value ? { inputs: { input_value: input_value } } : undefined
>>>>>>> dev
); );
} }

View file

@ -22,7 +22,6 @@ import useFlowStore from "../../stores/flowStore";
import useFlowsManagerStore from "../../stores/flowsManagerStore"; import useFlowsManagerStore from "../../stores/flowsManagerStore";
import { useTypesStore } from "../../stores/typesStore"; import { useTypesStore } from "../../stores/typesStore";
import { APIClassType, VertexBuildTypeAPI } from "../../types/api"; import { APIClassType, VertexBuildTypeAPI } from "../../types/api";
import { validationStatusType } from "../../types/components";
import { NodeDataType } from "../../types/flow"; import { NodeDataType } from "../../types/flow";
import { handleKeyDown, scapedJSONStringfy } from "../../utils/reactflowUtils"; import { handleKeyDown, scapedJSONStringfy } from "../../utils/reactflowUtils";
import { nodeColors, nodeIconsLucide } from "../../utils/styleUtils"; import { nodeColors, nodeIconsLucide } from "../../utils/styleUtils";
@ -170,7 +169,7 @@ export default function GenericNode({
// should be empty string if no duration // should be empty string if no duration
// else should be `Duration: ${duration}` // else should be `Duration: ${duration}`
const getDurationString = (duration: number | undefined|string): string => { const getDurationString = (duration: number | undefined | string): string => {
if (duration === undefined) { if (duration === undefined) {
return ""; return "";
} else { } else {
@ -193,7 +192,7 @@ export default function GenericNode({
? flowPool[data.id][flowPool[data.id].length - 1] ? flowPool[data.id][flowPool[data.id].length - 1]
: null; : null;
if (relevantData) { if (relevantData) {
console.log(relevantData) console.log(relevantData);
// Extract validation information from relevantData and update the validationStatus state // Extract validation information from relevantData and update the validationStatus state
setValidationStatus(relevantData); setValidationStatus(relevantData);
} else { } else {
@ -261,11 +260,7 @@ export default function GenericNode({
const isDark = useDarkStore((state) => state.dark); const isDark = useDarkStore((state) => state.dark);
const renderIconStatus = ( const renderIconStatus = (
buildStatus: BuildStatus | undefined, buildStatus: BuildStatus | undefined,
<<<<<<< HEAD
validationStatus: VertexBuildTypeAPI | null validationStatus: VertexBuildTypeAPI | null
=======
validationStatus: validationStatusType | null
>>>>>>> dev
) => { ) => {
if (buildStatus === BuildStatus.BUILDING) { if (buildStatus === BuildStatus.BUILDING) {
return <Loading className="text-medium-indigo" />; return <Loading className="text-medium-indigo" />;
@ -306,11 +301,7 @@ export default function GenericNode({
}; };
const getSpecificClassFromBuildStatus = ( const getSpecificClassFromBuildStatus = (
buildStatus: BuildStatus | undefined, buildStatus: BuildStatus | undefined,
<<<<<<< HEAD
validationStatus: VertexBuildTypeAPI | null validationStatus: VertexBuildTypeAPI | null
=======
validationStatus: validationStatusType | null
>>>>>>> dev
) => { ) => {
let isInvalid = validationStatus && !validationStatus.valid; let isInvalid = validationStatus && !validationStatus.valid;
@ -334,11 +325,7 @@ export default function GenericNode({
selected: boolean, selected: boolean,
showNode: boolean, showNode: boolean,
buildStatus: BuildStatus | undefined, buildStatus: BuildStatus | undefined,
<<<<<<< HEAD
validationStatus: VertexBuildTypeAPI | null validationStatus: VertexBuildTypeAPI | null
=======
validationStatus: validationStatusType | null
>>>>>>> dev
) => { ) => {
const specificClassFromBuildStatus = getSpecificClassFromBuildStatus( const specificClassFromBuildStatus = getSpecificClassFromBuildStatus(
buildStatus, buildStatus,

View file

@ -6,8 +6,8 @@ import {
import { uploadFile } from "../../../../../controllers/API"; import { uploadFile } from "../../../../../controllers/API";
import useFlowsManagerStore from "../../../../../stores/flowsManagerStore"; import useFlowsManagerStore from "../../../../../stores/flowsManagerStore";
import { import {
ChatInputType,
FilePreviewType, FilePreviewType,
chatInputType,
} from "../../../../../types/components"; } from "../../../../../types/components";
import FilePreview from "../filePreviewChat"; import FilePreview from "../filePreviewChat";
import ButtonSendWrapper from "./components/buttonSendWrapper"; import ButtonSendWrapper from "./components/buttonSendWrapper";
@ -15,7 +15,6 @@ import TextAreaWrapper from "./components/textAreaWrapper";
import UploadFileButton from "./components/uploadFileButton"; import UploadFileButton from "./components/uploadFileButton";
import { getClassNamesFilePreview } from "./helpers/get-class-file-preview"; import { getClassNamesFilePreview } from "./helpers/get-class-file-preview";
import useAutoResizeTextArea from "./hooks/use-auto-resize-text-area"; import useAutoResizeTextArea from "./hooks/use-auto-resize-text-area";
import useDragAndDrop from "./hooks/use-drag-and-drop";
import useFocusOnUnlock from "./hooks/use-focus-unlock"; import useFocusOnUnlock from "./hooks/use-focus-unlock";
import useHandleFileChange from "./hooks/use-handle-file-change"; import useHandleFileChange from "./hooks/use-handle-file-change";
import useUpload from "./hooks/use-upload"; import useUpload from "./hooks/use-upload";
@ -29,7 +28,7 @@ export default function ChatInput({
files, files,
setFiles, setFiles,
isDragging, isDragging,
}: chatInputType): JSX.Element { }: ChatInputType): JSX.Element {
const [repeat, setRepeat] = useState(1); const [repeat, setRepeat] = useState(1);
const saveLoading = useFlowsManagerStore((state) => state.saveLoading); const saveLoading = useFlowsManagerStore((state) => state.saveLoading);
const currentFlowId = useFlowsManagerStore((state) => state.currentFlowId); const currentFlowId = useFlowsManagerStore((state) => state.currentFlowId);
@ -111,7 +110,7 @@ export default function ChatInput({
key={file.id} key={file.id}
onDelete={() => { onDelete={() => {
setFiles((prev: FilePreviewType[]) => setFiles((prev: FilePreviewType[]) =>
prev.filter((f) => f.id !== file.id), prev.filter((f) => f.id !== file.id)
); );
// TODO: delete file on backend // TODO: delete file on backend
}} }}

View file

@ -1,9 +1,6 @@
import { useEffect, useRef, useState } from "react"; import { useEffect, useRef, useState } from "react";
import IconComponent from "../../../../components/genericIconComponent"; import IconComponent from "../../../../components/genericIconComponent";
<<<<<<< HEAD
=======
import { Button } from "../../../../components/ui/button"; import { Button } from "../../../../components/ui/button";
>>>>>>> dev
import { import {
CHAT_FIRST_INITIAL_TEXT, CHAT_FIRST_INITIAL_TEXT,
CHAT_SECOND_INITIAL_TEXT, CHAT_SECOND_INITIAL_TEXT,
@ -185,15 +182,10 @@ export default function ChatView({
<IconComponent <IconComponent
name="Eraser" name="Eraser"
className={classNames( className={classNames(
<<<<<<< HEAD
"h-5 w-5", "h-5 w-5",
lockChat lockChat
? "animate-pulse text-primary" ? "animate-pulse text-primary"
: "text-primary hover:text-gray-600" : "text-primary hover:text-gray-600"
=======
"h-5 w-5 transition-all duration-100",
lockChat ? "animate-pulse text-primary" : "text-primary"
>>>>>>> dev
)} )}
aria-hidden="true" aria-hidden="true"
/> />

View file

@ -16,7 +16,7 @@ import {
import { BuildStatus } from "../constants/enums"; import { BuildStatus } from "../constants/enums";
import { getFlowPool } from "../controllers/API"; import { getFlowPool } from "../controllers/API";
import { VertexBuildTypeAPI } from "../types/api"; import { VertexBuildTypeAPI } from "../types/api";
import { ChatOutputType, chatInputType } from "../types/chat"; import { ChatInputType, ChatOutputType } from "../types/chat";
import { import {
NodeDataType, NodeDataType,
NodeType, NodeType,
@ -73,11 +73,7 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
}, },
updateFlowPool: ( updateFlowPool: (
nodeId: string, nodeId: string,
<<<<<<< HEAD data: VertexBuildTypeAPI | ChatOutputType | ChatInputType,
data: VertexBuildTypeAPI | ChatOutputType | chatInputType,
=======
data: FlowPoolObjectType | ChatOutputType | chatInputType,
>>>>>>> dev
buildId?: string buildId?: string
) => { ) => {
let newFlowPool = cloneDeep({ ...get().flowPool }); let newFlowPool = cloneDeep({ ...get().flowPool });
@ -96,7 +92,7 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
else { else {
newFlowPool[nodeId][index].data.message = data as newFlowPool[nodeId][index].data.message = data as
| ChatOutputType | ChatOutputType
| chatInputType; | ChatInputType;
} }
} }
get().setFlowPool(newFlowPool); get().setFlowPool(newFlowPool);
@ -492,11 +488,7 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
(id) => !vertexBuildData.inactivated_vertices?.includes(id) (id) => !vertexBuildData.inactivated_vertices?.includes(id)
); );
const top_level_vertices = vertexBuildData.top_level_vertices.filter( const top_level_vertices = vertexBuildData.top_level_vertices.filter(
<<<<<<< HEAD
(vertex) => !vertexBuildData.inactivated_vertices?.includes(vertex) (vertex) => !vertexBuildData.inactivated_vertices?.includes(vertex)
=======
(vertex) => !vertexBuildData.inactivated_vertices?.includes(vertex.id)
>>>>>>> dev
); );
const nextVertices: VertexLayerElementType[] = zip( const nextVertices: VertexLayerElementType[] = zip(
next_vertices_ids, next_vertices_ids,
@ -521,11 +513,7 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
} }
get().addDataToFlowPool( get().addDataToFlowPool(
<<<<<<< HEAD
{ ...vertexBuildData, run_id: runId }, { ...vertexBuildData, run_id: runId },
=======
{ ...vertexBuildData, buildId: runId },
>>>>>>> dev
vertexBuildData.id vertexBuildData.id
); );

View file

@ -1,6 +1,5 @@
import { Edge, Node, Viewport } from "reactflow"; import { Edge, Node, Viewport } from "reactflow";
import { ChatOutputType, chatInputType } from "../chat"; import { ChatInputType, ChatOutputType } from "../chat";
import { Log } from "../components";
import { FlowType } from "../flow"; import { FlowType } from "../flow";
//kind and class are just representative names to represent the actual structure of the object received by the API //kind and class are just representative names to represent the actual structure of the object received by the API
export type APIDataType = { [key: string]: APIKindType }; export type APIDataType = { [key: string]: APIKindType };
@ -162,7 +161,7 @@ export type VertexDataTypeAPI = {
results: { [key: string]: string }; results: { [key: string]: string };
artifacts?: { [key: string]: string }; artifacts?: { [key: string]: string };
logs: { message: any; type: string }[]; logs: { message: any; type: string }[];
message: ChatOutputType | chatInputType; message: ChatOutputType | ChatInputType;
inactive?: boolean; inactive?: boolean;
timedelta?: number; timedelta?: number;
duration?: string; duration?: string;

View file

@ -22,7 +22,7 @@ export type ChatOutputType = {
files?: Array<{ path: string; type: string; name: string }>; files?: Array<{ path: string; type: string; name: string }>;
}; };
export type chatInputType = { export type ChatInputType = {
message: string; message: string;
sender: string; sender: string;
sender_name: string; sender_name: string;
@ -34,7 +34,7 @@ export type FlowPoolObjectType = {
timestamp: string; timestamp: string;
valid: boolean; valid: boolean;
// list of chat outputs or list of chat inputs // list of chat outputs or list of chat inputs
messages: Array<ChatOutputType | chatInputType> | []; messages: Array<ChatOutputType | ChatInputType> | [];
data: { artifacts: any; results: any | ChatOutputType | chatInputType }; data: { artifacts: any; results: any | ChatOutputType | ChatInputType };
id: string; id: string;
}; };

View file

@ -76,6 +76,7 @@ export type InputListComponentType = {
disabled: boolean; disabled: boolean;
editNode?: boolean; editNode?: boolean;
componentName?: string; componentName?: string;
playgroundDisabled?: boolean;
}; };
export type InputGlobalComponentType = { export type InputGlobalComponentType = {
@ -490,11 +491,11 @@ export type headerFlowsType = {
style?: FlowStyleType; style?: FlowStyleType;
}; };
export type chatInputType = { export type ChatInputType = {
isDragging: boolean; isDragging: boolean;
files: FilePreviewType[]; files: FilePreviewType[];
setFiles: ( setFiles: (
files: FilePreviewType[] | ((prev: FilePreviewType[]) => FilePreviewType[]), files: FilePreviewType[] | ((prev: FilePreviewType[]) => FilePreviewType[])
) => void; ) => void;
chatValue: string; chatValue: string;
inputRef: { inputRef: {

View file

@ -9,16 +9,16 @@ import {
} from "reactflow"; } from "reactflow";
import { BuildStatus } from "../../../constants/enums"; import { BuildStatus } from "../../../constants/enums";
import { VertexBuildTypeAPI } from "../../api"; import { VertexBuildTypeAPI } from "../../api";
import { ChatOutputType, chatInputType } from "../../chat"; import { ChatInputType, ChatOutputType } from "../../chat";
import { FlowState } from "../../tabs"; import { FlowState } from "../../tabs";
export type FlowPoolObjectType = { export type FlowPoolObjectType = {
timestamp: string; timestamp: string;
valid: boolean; valid: boolean;
messages: Array<ChatOutputType | chatInputType> | []; messages: Array<ChatOutputType | ChatInputType> | [];
data: { data: {
artifacts: any | ChatOutputType | chatInputType; artifacts: any | ChatOutputType | ChatInputType;
results: any | ChatOutputType | chatInputType; results: any | ChatOutputType | ChatInputType;
}; };
duration?: string; duration?: string;
progress?: number; progress?: number;
@ -33,8 +33,8 @@ export type FlowPoolObjectTypeNew = {
timestamp: string; timestamp: string;
valid: boolean; valid: boolean;
data: { data: {
logs?: any | ChatOutputType | chatInputType; logs?: any | ChatOutputType | ChatInputType;
results: any | ChatOutputType | chatInputType; results: any | ChatOutputType | ChatInputType;
}; };
duration?: string; duration?: string;
progress?: number; progress?: number;
@ -155,11 +155,7 @@ export type FlowStoreType = {
}; };
updateFlowPool: ( updateFlowPool: (
nodeId: string, nodeId: string,
<<<<<<< HEAD data: VertexBuildTypeAPI | ChatOutputType | ChatInputType,
data: VertexBuildTypeAPI | ChatOutputType | chatInputType,
=======
data: FlowPoolObjectType | ChatOutputType | chatInputType,
>>>>>>> dev
buildId?: string buildId?: string
) => void; ) => void;
getNodePosition: (nodeId: string) => { x: number; y: number }; getNodePosition: (nodeId: string) => { x: number; y: number };

View file

@ -1,4 +1,4 @@
export type chatInputType = { export type ChatInputType = {
result: string; result: string;
}; };
@ -12,7 +12,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; results: any | ChatOutputType | ChatInputType };
id: string; id: string;
}; };