Compare commits

...

4 Commits

Author SHA1 Message Date
Aarushi
5b2e52f445 api folder in types 2024-07-05 17:51:59 +01:00
Aarushi
12f6743d5d move globals 2024-07-05 15:50:43 +01:00
Aarushi
e915cf1182 add styles for css 2024-07-05 15:49:44 +01:00
Aarushi
a953217d37 setting up project structure 2024-07-05 15:47:58 +01:00
12 changed files with 86 additions and 76 deletions

View File

@@ -1,5 +1,4 @@
import { XYPosition } from "reactflow";
import { ObjectSchema } from "./types";
import {Block, NodeExecutionResult} from "@/types/api";
export default class AutoGPTServerAPI {
private baseUrl: string;
@@ -127,67 +126,4 @@ export default class AutoGPTServerAPI {
}
}
/* Mirror of autogpt_server/data/block.py:Block */
export type Block = {
id: string;
name: string;
description: string;
inputSchema: ObjectSchema;
outputSchema: ObjectSchema;
};
/* Mirror of autogpt_server/data/graph.py:Node */
export type Node = {
id: string;
block_id: string;
input_default: Map<string, any>;
input_nodes: Array<{ name: string, node_id: string }>;
output_nodes: Array<{ name: string, node_id: string }>;
metadata: {
position: XYPosition;
[key: string]: any;
};
};
/* Mirror of autogpt_server/data/graph.py:Link */
export type Link = {
source_id: string;
sink_id: string;
source_name: string;
sink_name: string;
}
/* Mirror of autogpt_server/data/graph.py:Graph */
export type Flow = {
id: string;
name: string;
description: string;
nodes: Array<Node>;
links: Array<Link>;
};
export type FlowCreateBody = Flow | {
id?: string;
}
/* Derived from autogpt_server/executor/manager.py:ExecutionManager.add_execution */
export type FlowExecuteResponse = {
/* ID of the initiated run */
id: string;
/* List of node executions */
executions: Array<{ id: string, node_id: string }>;
};
/* Mirror of autogpt_server/data/execution.py:ExecutionResult */
export type NodeExecutionResult = {
graph_exec_id: string;
node_exec_id: string;
node_id: string;
status: 'INCOMPLETE' | 'QUEUED' | 'RUNNING' | 'COMPLETED' | 'FAILED';
input_data: Map<string, any>;
output_data: Map<string, any[]>;
add_time: Date;
queue_time?: Date;
start_time?: Date;
end_time?: Date;
};

View File

@@ -2,7 +2,7 @@ import type { Metadata } from "next";
import { ThemeProvider as NextThemeProvider } from "next-themes";
import { type ThemeProviderProps } from "next-themes/dist/types";
import { Inter } from "next/font/google";
import "./globals.css";
import "../styles/globals.css";
const inter = Inter({ subsets: ["latin"] });

View File

@@ -1,7 +1,7 @@
import React, { useState, useEffect, FC, memo } from 'react';
import { Handle, Position, NodeProps } from 'reactflow';
import 'reactflow/dist/style.css';
import './customnode.css';
import '../styles/customnode.css';
import ModalComponent from './ModalComponent';
type Schema = {

View File

@@ -14,8 +14,8 @@ import ReactFlow, {
} from 'reactflow';
import 'reactflow/dist/style.css';
import CustomNode from './CustomNode';
import './flow.css';
import AutoGPTServerAPI, { Block } from '@/lib/autogpt_server_api';
import '../styles/flow.css';
import AutoGPTServerAPI, { Block } from '@/api/autogpt_server_api';
import { ObjectSchema } from '@/lib/types';
type CustomNodeData = {

View File

@@ -1,5 +1,5 @@
import React, { FC } from 'react';
import './modal.css';
import '../styles/modal.css';
interface ModalProps {
isOpen: boolean;

View File

@@ -0,0 +1,5 @@
export const STATUS_INCOMPLETE = 'INCOMPLETE';
export const STATUS_QUEUED = 'QUEUED';
export const STATUS_RUNNING = 'RUNNING';
export const STATUS_COMPLETED = 'COMPLETED';
export const STATUS_FAILED = 'FAILED';

View File

@@ -1,6 +0,0 @@
export type ObjectSchema = {
type: string;
properties: { [key: string]: any };
additionalProperties?: { type: string };
required?: string[];
};

View File

@@ -0,0 +1,75 @@
import {XYPosition} from "reactflow";
import {STATUS_COMPLETED, STATUS_FAILED, STATUS_INCOMPLETE, STATUS_QUEUED, STATUS_RUNNING} from "@/constants/constants";
export type ObjectSchema = {
type: string;
properties: { [key: string]: any };
additionalProperties?: { type: string };
required?: string[];
};
/* Mirror of autogpt_server/data/block.py:Block */
export type Block = {
id: string;
name: string;
description: string;
inputSchema: ObjectSchema;
outputSchema: ObjectSchema;
};
/* Mirror of autogpt_server/data/graph.py:Node */
export type Node = {
id: string;
block_id: string;
input_default: Map<string, any>;
input_nodes: Array<{ name: string, node_id: string }>;
output_nodes: Array<{ name: string, node_id: string }>;
metadata: {
position: XYPosition;
[key: string]: any;
};
};
/* Mirror of autogpt_server/data/graph.py:Link */
export type Link = {
source_id: string;
sink_id: string;
source_name: string;
sink_name: string;
}
/* Mirror of autogpt_server/data/graph.py:Graph */
export type Flow = {
id: string;
name: string;
description: string;
nodes: Array<Node>;
links: Array<Link>;
};
export type FlowCreateBody = Flow | {
id?: string;
}
/* Derived from autogpt_server/executor/manager.py:ExecutionManager.add_execution */
export type FlowExecuteResponse = {
/* ID of the initiated run */
id: string;
/* List of node executions */
executions: Array<{ id: string, node_id: string }>;
};
/* Mirror of autogpt_server/data/execution.py:ExecutionResult */
export type NodeExecutionResult = {
graph_exec_id: string;
node_exec_id: string;
node_id: string;
status: typeof STATUS_INCOMPLETE | typeof STATUS_QUEUED | typeof STATUS_RUNNING | typeof STATUS_COMPLETED | typeof STATUS_FAILED;
input_data: Map<string, any>;
output_data: Map<string, any[]>;
add_time: Date;
queue_time?: Date;
start_time?: Date;
end_time?: Date;
};