Files
ai-video-fullstack/frontend/src/components/workflow/context.ts
Xin Wang c2a39257ff 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.
2026-06-15 10:12:41 +08:00

24 lines
716 B
TypeScript

"use client";
/**
* 画布内共享上下文。GenericNode / ConditionEdge 由 ReactFlow 渲染,拿不到外层
* 回调,统一通过这些 context 取节点规格与编辑/删除动作。
*/
import { createContext } from "react";
import type { NodeSpecMap } from "./specs";
/** 节点类型 → 运行期规格(来自 /api/node-types) */
export const NodeSpecsContext = createContext<NodeSpecMap>({});
export type ElementActions = {
edit: (id: string) => void;
remove: (id: string) => void;
};
const noop: ElementActions = { edit: () => {}, remove: () => {} };
export const NodeActionContext = createContext<ElementActions>(noop);
export const EdgeActionContext = createContext<ElementActions>(noop);