diff --git a/web/src/app/home/agents/components/AgentCreateContent.tsx b/web/src/app/home/agents/components/AgentCreateContent.tsx index 8e6371e49..9e6e8a972 100644 --- a/web/src/app/home/agents/components/AgentCreateContent.tsx +++ b/web/src/app/home/agents/components/AgentCreateContent.tsx @@ -15,7 +15,6 @@ import { Card, CardContent, CardDescription, - CardFooter, CardHeader, CardTitle, } from '@/components/ui/card'; @@ -260,33 +259,9 @@ export default function AgentCreateContent({ - - - - - {kind === 'agent' - ? t('agents.agentDiagramTitle') - : t('agents.pipelineDiagramTitle')} - - - {t('agents.diagramHint')} - - - - {kind === 'agent' - ? t('agents.kindBadgeAgent') - : t('agents.kindBadgePipeline')} - - - - + - - {kind === 'agent' - ? t('agents.agentDiagramDescription') - : t('agents.pipelineDiagramDescription')} - diff --git a/web/src/app/home/agents/components/ProcessorTypeDiagram.tsx b/web/src/app/home/agents/components/ProcessorTypeDiagram.tsx index 9830a93f4..17e334ee3 100644 --- a/web/src/app/home/agents/components/ProcessorTypeDiagram.tsx +++ b/web/src/app/home/agents/components/ProcessorTypeDiagram.tsx @@ -2,59 +2,18 @@ import { useId } from 'react'; import { useTranslation } from 'react-i18next'; import type { AgentKind } from '@/app/infra/entities/api'; -type DiagramIds = { - accent: string; - arrow: string; - glow: string; - grid: string; - surface: string; -}; - -function useDiagramIds(prefix: string): DiagramIds { - const id = useId().replace(/:/g, ''); - return { - accent: `${prefix}-accent-${id}`, - arrow: `${prefix}-arrow-${id}`, - glow: `${prefix}-glow-${id}`, - grid: `${prefix}-grid-${id}`, - surface: `${prefix}-surface-${id}`, - }; -} - -function DiagramDefinitions({ ids }: { ids: DiagramIds }) { +function ArrowMarker({ id }: { id: string }) { return ( - - - - - - - - - - - - - - - - - + ); @@ -62,449 +21,261 @@ function DiagramDefinitions({ ids }: { ids: DiagramIds }) { function AgentDiagram() { const { t } = useTranslation(); - const ids = useDiagramIds('agent'); - const events = [ - { label: t('agents.diagramMessages'), y: 154 }, - { label: t('agents.diagramMembers'), y: 270 }, - { label: t('agents.diagramFeedback'), y: 386 }, + const arrowId = `agent-arrow-${useId().replace(/:/g, '')}`; + const inputs = [ + { label: t('agents.diagramMessages'), y: 155 }, + { label: t('agents.diagramMembers'), y: 275 }, + { label: t('agents.diagramFeedback'), y: 395 }, ]; - const capabilities = [ - { label: t('agents.diagramModel'), y: 154 }, - { label: t('agents.diagramTools'), y: 270 }, - { label: t('agents.diagramActions'), y: 386 }, + const outputs = [ + { label: t('agents.diagramModel'), y: 155 }, + { label: t('agents.diagramTools'), y: 275 }, + { label: t('agents.diagramActions'), y: 395 }, ]; return ( {t('agents.agentDiagramTitle')} {t('agents.agentDiagramDescription')} - + - - - - - - - {events.map((event) => ( - - ))} - {capabilities.map((capability) => ( - - ))} - + {t('agents.diagramEvents')} - {events.map((event, index) => ( - - - - {index === 0 && ( - - )} - {index === 1 && ( - - - - - - )} - {index === 2 && ( - - )} - - {event.label} - - - - ))} - - - - - - - - - - - - - - {t('agents.agentType')} - - - {t('agents.diagramDecide')} - - - - {capabilities.map((capability, index) => ( - - - - + {inputs.map((item) => ( + + + - {capability.label} + {item.label} ))} + + + + + + + {t('agents.agentType')} + + + {t('agents.diagramDecide')} + + + {outputs.map((item, index) => ( + + + + + + {item.label} + + + ))} ); } function PipelineDiagram() { const { t } = useTranslation(); - const ids = useDiagramIds('pipeline'); - const stations = [ - { x: 198, y: 312, label: t('agents.diagramPreprocess') }, - { x: 338, y: 242, label: t('agents.diagramAI') }, - { x: 478, y: 312, label: t('agents.diagramPostprocess') }, - { x: 618, y: 242, label: t('agents.diagramOutput') }, + const arrowId = `pipeline-arrow-${useId().replace(/:/g, '')}`; + const stages = [ + t('agents.diagramPreprocess'), + t('agents.diagramAI'), + t('agents.diagramPostprocess'), + t('agents.diagramOutput'), ]; return ( {t('agents.pipelineDiagramTitle')} {t('agents.pipelineDiagramDescription')} - + - + - - - - - - {t('agents.pipelineDiagramFlow')} - - - - - {t('agents.diagramMessage')} - {stations.map((station, index) => ( - - - - - {index + 1} - - - - {station.label} - - - ))} - - - - - - - - {[0, 1, 2, 3].map((step) => ( - - { + const x = 198 + index * 146; + const active = index === 1; + return ( + + - {step < 3 && ( - - )} + + + {index + 1} + + + {stage} + - ))} - + ); + })} ); }