'use client'; import { useState } from 'react'; interface WorkflowConfigProps { data: any; onChange: (data: any) => void; } export default function WorkflowConfig({ data, onChange }: WorkflowConfigProps) { const [selectedWorkflows, setSelectedWorkflows] = useState(data.workflows || []); const [searchTerm, setSearchTerm] = useState(''); const [filterCategory, setFilterCategory] = useState('all'); const availableWorkflows = [ { id: 'wf-001', name: '数据分析流程', description: '自动化数据收集、清洗和分析', category: 'data-processing', icon: '📊', status: 'active', lastUsed: '2024-01-15', executions: 156 }, { id: 'wf-002', name: '内容审核工作流', description: '文本内容智能审核和分类', category: 'content-moderation', icon: '🔍', status: 'active', lastUsed: '2024-01-14', executions: 89 }, { id: 'wf-003', name: '客服自动回复', description: '基于知识库的智能客服响应', category: 'customer-service', icon: '💬', status: 'active', lastUsed: '2024-01-13', executions: 234 }, { id: 'wf-004', name: '报告生成器', description: '自动生成业务分析报告', category: 'report-generation', icon: '📄', status: 'active', lastUsed: '2024-01-12', executions: 67 }, { id: 'wf-005', name: '邮件处理流程', description: '邮件分类和自动回复', category: 'email-automation', icon: '📧', status: 'active', lastUsed: '2024-01-11', executions: 145 }, { id: 'wf-006', name: '社交媒体监控', description: '社交媒体内容监控和分析', category: 'social-media', icon: '📱', status: 'active', lastUsed: '2024-01-10', executions: 78 } ]; const categories = [ { key: 'all', label: '全部分类', count: availableWorkflows.length }, { key: 'data-processing', label: '数据处理', count: 1 }, { key: 'content-moderation', label: '内容审核', count: 1 }, { key: 'customer-service', label: '客服服务', count: 1 }, { key: 'report-generation', label: '报告生成', count: 1 }, { key: 'email-automation', label: '邮件自动化', count: 1 }, { key: 'social-media', label: '社交媒体', count: 1 } ]; const filteredWorkflows = availableWorkflows.filter(workflow => { const matchesSearch = workflow.name.toLowerCase().includes(searchTerm.toLowerCase()) || workflow.description.toLowerCase().includes(searchTerm.toLowerCase()); const matchesCategory = filterCategory === 'all' || workflow.category === filterCategory; return matchesSearch && matchesCategory; }); const handleWorkflowToggle = (workflowId: string) => { const isSelected = selectedWorkflows.includes(workflowId); const updatedWorkflows = isSelected ? selectedWorkflows.filter(id => id !== workflowId) : [...selectedWorkflows, workflowId]; setSelectedWorkflows(updatedWorkflows); onChange({ ...data, workflows: updatedWorkflows }); }; const handleSelectAll = () => { const allIds = filteredWorkflows.map(wf => wf.id); setSelectedWorkflows(allIds); onChange({ ...data, workflows: allIds }); }; const handleDeselectAll = () => { setSelectedWorkflows([]); onChange({ ...data, workflows: [] }); }; return (
选择Agent可以调用的工作流程,增强自动化处理能力
{workflow.description}
没有找到匹配的工作流
还未选择任何工作流
) : (选择的工作流将与Agent集成,用户可以通过对话触发相应的自动化流程。建议选择与Agent功能相关的工作流。