// File: frontend/app/workflow/components/ChatInputNode.tsx (新建) // Description: 自定义 ChatInput 节点 import React, { memo, useCallback, ChangeEvent } from 'react'; import { Handle, Position, useReactFlow, Node } from 'reactflow'; import { MessageCircleQuestion } from 'lucide-react'; // 使用合适的图标 import { Label } from "@/components/ui/label"; import { Textarea } from "@/components/ui/textarea"; import type { ChatInputNodeData, CustomNodeProps } from './types'; const ChatInputNodeComponent = ({ id, data, isConnectable }: CustomNodeProps) => { const { setNodes } = useReactFlow(); const handleTextChange = useCallback((event: ChangeEvent) => { const newText = event.target.value; setNodes((nds: Node[]) => nds.map((node) => { if (node.id === id) { return { ...node, data: { ...node.data, text: newText } }; } return node; }) ); }, [id, setNodes]); return (
{/* 调整宽度 */} {/* 节点头部 */}
Chat Input

从 Playground 获取聊天输入。

{/* 节点内容 */}