Add workflow editor and node types support in frontend and backend

- Introduce a new workflow editor component for visualizing and managing workflows, allowing users to add nodes and define connections.
- Implement backend support for node types, including validation and constraints for workflow graphs.
- Add new API endpoints for retrieving node types and their specifications.
- Enhance the AssistantPage to integrate the workflow editor, enabling users to create and edit workflows directly.
- Update frontend components to support new workflow functionalities, including condition edges and generic nodes.
- Refactor existing code to accommodate the new workflow features and improve overall structure.
This commit is contained in:
Xin Wang
2026-06-15 10:12:41 +08:00
parent 0309c154b5
commit c2a39257ff
15 changed files with 1733 additions and 54 deletions

View File

@@ -172,3 +172,39 @@ export type KnowledgeBase = {
export const knowledgeBasesApi = {
list: () => request<KnowledgeBase[]>("/api/knowledge-bases"),
};
// ---------- 工作流节点类型目录 ----------
export type NodeFieldSpec = {
key: string;
label: string;
type: "text" | "textarea" | "switch";
required?: boolean;
};
export type NodeConstraints = {
minIncoming?: number;
maxIncoming?: number;
minOutgoing?: number;
maxOutgoing?: number;
};
export type NodeSpecDto = {
name: string;
displayName: string;
category: string;
description: string;
icon: string;
accent: string;
addable: boolean;
constraints: NodeConstraints;
fields: NodeFieldSpec[];
};
export type NodeTypesResponse = {
specVersion: string;
nodeTypes: NodeSpecDto[];
};
export const nodeTypesApi = {
list: () => request<NodeTypesResponse>("/api/node-types"),
};