/**
* Agent Flow Diagram Component
* Visualizes the complete data flow through all 12 agents
*/
"use client";
import { Card } from "@/components/ui/card";
import {
ArrowDown,
Database,
MessageSquare,
Newspaper,
DollarSign,
TrendingUp,
TrendingDown,
Shield,
ShieldAlert,
ShieldCheck,
Users,
Target,
BarChart3
} from "lucide-react";
import { useLanguage } from "@/contexts/LanguageContext";
export function AgentFlowDiagram() {
const { t } = useLanguage();
return (
{/* Data Sources Layer */}
📥 {t.flowDiagram.layer1}
}
name="yfinance"
description={t.flowDiagram.stockData}
color="blue"
/>
}
name="Reddit API"
description={t.flowDiagram.socialSentiment}
color="orange"
/>
}
name="RSS Feed"
description={t.flowDiagram.newsInfo}
color="green"
/>
}
name="Alpha Vantage / FinMind"
description={t.flowDiagram.financialData}
color="purple"
/>
{/* Arrow */}
{/* Analysts Layer - 4 agents */}
🤖 {t.flowDiagram.layer2}
}
gradient="from-blue-500 to-cyan-500"
description={t.flowDiagram.technicalAnalysis}
tasks={[t.flowDiagram.rsiIndicator, t.flowDiagram.macdMomentum, t.flowDiagram.priceTrend]}
/>
}
gradient="from-orange-500 to-red-500"
description={t.flowDiagram.sentimentAnalysis}
tasks={[t.flowDiagram.nlpSentiment, t.flowDiagram.discussionHeat, t.flowDiagram.investorConfidence]}
/>
}
gradient="from-green-500 to-emerald-500"
description={t.flowDiagram.newsAnalysis}
tasks={[t.flowDiagram.newsSummary, t.flowDiagram.eventAssessment, t.flowDiagram.impactPrediction]}
/>
}
gradient="from-purple-500 to-pink-500"
description={t.flowDiagram.fundamentalsAnalysis}
tasks={[t.flowDiagram.financialAnalysis, t.flowDiagram.valuationMetrics, t.flowDiagram.profitEvaluation]}
/>
{/* Arrow */}
{/* Researchers Layer - 2 agents */}
🔍 {t.flowDiagram.layer3}
}
gradient="from-green-500 to-emerald-500"
description={t.flowDiagram.bullishResearch}
tasks={[t.flowDiagram.positiveFactors, t.flowDiagram.growthOpportunities, t.flowDiagram.buyReasons]}
/>
}
gradient="from-red-500 to-rose-500"
description={t.flowDiagram.bearishResearch}
tasks={[t.flowDiagram.negativeFactors, t.flowDiagram.riskAssessment, t.flowDiagram.sellReasons]}
/>
{/* Arrow */}
{/* Research Manager */}
}
gradient="from-indigo-500 to-purple-500"
description={t.flowDiagram.integrateViews}
tasks={[t.flowDiagram.balanceArguments, t.flowDiagram.comprehensiveAdvice, t.flowDiagram.preliminaryStrategy]}
/>
{/* Arrow */}
{/* Risk Debators Layer - 3 agents */}
⚖️ {t.flowDiagram.layer4}
}
gradient="from-red-500 to-orange-500"
description={t.flowDiagram.highRiskReward}
tasks={[t.flowDiagram.aggressiveStrategy, t.flowDiagram.maximizeReturns, t.flowDiagram.calculatedRisk]}
/>
}
gradient="from-blue-500 to-indigo-500"
description={t.flowDiagram.balancedRisk}
tasks={[t.flowDiagram.prudentStrategy, t.flowDiagram.riskBalance, t.flowDiagram.rationalDecision]}
/>
}
gradient="from-green-500 to-teal-500"
description={t.flowDiagram.lowRiskVol}
tasks={[t.flowDiagram.conservativeStrategy, t.flowDiagram.capitalProtection, t.flowDiagram.riskReduction]}
/>
{/* Arrow */}
{/* Risk Manager */}
}
gradient="from-red-500 to-pink-500"
description={t.flowDiagram.integrateRisk}
tasks={[t.flowDiagram.riskRating, t.flowDiagram.stopLossSettings, t.flowDiagram.finalRiskControl]}
/>
{/* Arrow */}
{/* Trader */}
}
gradient="from-blue-600 via-purple-600 to-pink-600"
description={t.flowDiagram.executeTrade}
outputs={[t.flowDiagram.tradeSignal, t.flowDiagram.targetPrice, t.flowDiagram.tradeQuantity, t.flowDiagram.riskParams]}
/>
{/* Final Arrow */}
{/* Output Layer */}
📊 {t.flowDiagram.finalOutput}
{t.flowDiagram.completeReportSet}
{t.flowDiagram.comprehensiveSupport}
);
}
function DataSourceCard({
icon,
name,
description,
color,
}: {
icon: React.ReactNode;
name: string;
description: string;
color: "blue" | "orange" | "green" | "purple";
}) {
const colorClasses = {
blue: "from-blue-500 to-cyan-500 border-blue-300 dark:border-blue-700",
orange: "from-orange-500 to-red-500 border-orange-300 dark:border-orange-700",
green: "from-green-500 to-emerald-500 border-green-300 dark:border-green-700",
purple: "from-purple-500 to-pink-500 border-purple-300 dark:border-purple-700",
};
return (
{icon}
{name}
{description}
);
}
function AgentCard({
name,
icon,
gradient,
description,
tasks,
}: {
name: string;
icon: React.ReactNode;
gradient: string;
description: string;
tasks: string[];
}) {
return (
{icon}
{name}
{description}
{tasks.map((task, index) => (
•
{task}
))}
);
}
function ManagerCard({
name,
icon,
gradient,
description,
tasks,
}: {
name: string;
icon: React.ReactNode;
gradient: string;
description: string;
tasks: string[];
}) {
return (
{icon}
{name}
{description}
{tasks.map((task, index) => (
✓
{task}
))}
);
}
function TraderCard({
name,
icon,
gradient,
description,
outputs,
}: {
name: string;
icon: React.ReactNode;
gradient: string;
description: string;
outputs: string[];
}) {
return (
{icon}
{name}
{description}
最終輸出:
{outputs.map((output, index) => (
▸
{output}
))}
);
}
function FlowArrow({ label, color }: { label: string; color: string }) {
const colorClasses = {
blue: "text-blue-500 dark:text-blue-400",
purple: "text-purple-500 dark:text-purple-400",
green: "text-green-500 dark:text-green-400",
orange: "text-orange-500 dark:text-orange-400",
red: "text-red-500 dark:text-red-400",
};
return (
);
}
function ReportSection({
title,
items,
color,
}: {
title: string;
items: string[];
color: "blue" | "green" | "red";
}) {
const colorClasses = {
blue: "bg-blue-50 dark:bg-blue-950/30 border-blue-200 dark:border-blue-800",
green: "bg-green-50 dark:bg-green-950/30 border-green-200 dark:border-green-800",
red: "bg-red-50 dark:bg-red-950/30 border-red-200 dark:border-red-800",
};
return (
{title}
{items.map((item, index) => (
•
{item}
))}
);
}