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

View file

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

View file

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

View file

@ -1,9 +1,6 @@
import { useEffect, useRef, useState } from "react";
import IconComponent from "../../../../components/genericIconComponent";
<<<<<<< HEAD
=======
import { Button } from "../../../../components/ui/button";
>>>>>>> dev
import {
CHAT_FIRST_INITIAL_TEXT,
CHAT_SECOND_INITIAL_TEXT,
@ -185,15 +182,10 @@ export default function ChatView({
<IconComponent
name="Eraser"
className={classNames(
<<<<<<< HEAD
"h-5 w-5",
lockChat
? "animate-pulse text-primary"
: "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"
/>

View file

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

View file

@ -1,6 +1,5 @@
import { Edge, Node, Viewport } from "reactflow";
import { ChatOutputType, chatInputType } from "../chat";
import { Log } from "../components";
import { ChatInputType, ChatOutputType } from "../chat";
import { FlowType } from "../flow";
//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 };
@ -162,7 +161,7 @@ export type VertexDataTypeAPI = {
results: { [key: string]: string };
artifacts?: { [key: string]: string };
logs: { message: any; type: string }[];
message: ChatOutputType | chatInputType;
message: ChatOutputType | ChatInputType;
inactive?: boolean;
timedelta?: number;
duration?: string;

View file

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

View file

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

View file

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

View file

@ -1,4 +1,4 @@
export type chatInputType = {
export type ChatInputType = {
result: string;
};
@ -12,7 +12,7 @@ export type FlowPoolObjectType = {
timestamp: string;
valid: boolean;
params: any;
data: { artifacts: any; results: any | ChatOutputType | chatInputType };
data: { artifacts: any; results: any | ChatOutputType | ChatInputType };
id: string;
};