mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-01-21 04:57:58 -05:00
setting up project structure
This commit is contained in:
@@ -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;
|
||||
};
|
||||
@@ -15,7 +15,7 @@ import ReactFlow, {
|
||||
import 'reactflow/dist/style.css';
|
||||
import CustomNode from './CustomNode';
|
||||
import './flow.css';
|
||||
import AutoGPTServerAPI, { Block } from '@/lib/autogpt_server_api';
|
||||
import AutoGPTServerAPI, { Block } from '@/api/autogpt_server_api';
|
||||
import { ObjectSchema } from '@/lib/types';
|
||||
|
||||
type CustomNodeData = {
|
||||
|
||||
5
rnd/autogpt_builder/src/constants/constants.ts
Normal file
5
rnd/autogpt_builder/src/constants/constants.ts
Normal 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';
|
||||
@@ -1,6 +0,0 @@
|
||||
export type ObjectSchema = {
|
||||
type: string;
|
||||
properties: { [key: string]: any };
|
||||
additionalProperties?: { type: string };
|
||||
required?: string[];
|
||||
};
|
||||
75
rnd/autogpt_builder/src/types/api.ts
Normal file
75
rnd/autogpt_builder/src/types/api.ts
Normal 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;
|
||||
};
|
||||
Reference in New Issue
Block a user