"use client"; import React from "react"; import { Box, Chip, Paper, Stack, Typography, alpha, useTheme, } from "@mui/material"; import type { Theme } from "@mui/material/styles"; import BarChartRounded from "@mui/icons-material/BarChartRounded"; import LocationOnRounded from "@mui/icons-material/LocationOnRounded"; import SensorsRounded from "@mui/icons-material/SensorsRounded"; import BuildCircleRounded from "@mui/icons-material/BuildCircleRounded"; import { ChatInlineChart } from "./ChatInlineChart"; import type { AgentArtifact } from "./GlobalChatbox.types"; const artifactIcon = (kind: AgentArtifact["kind"]) => { if (kind === "chart") return ; if (kind === "map") return ; if (kind === "panel") return ; return ; }; const artifactColor = (kind: AgentArtifact["kind"], theme: Theme) => { if (kind === "chart") return theme.palette.info.main; if (kind === "map") return theme.palette.success.main; if (kind === "panel") return theme.palette.warning.main; return theme.palette.primary.main; }; export const AgentArtifactPanel = ({ artifacts }: { artifacts: AgentArtifact[] }) => { const theme = useTheme(); if (!artifacts.length) return null; return ( 结果与动作 {artifacts.map((artifact) => { const color = artifactColor(artifact.kind, theme); if (artifact.kind === "chart") { return ( ); } return ( {artifactIcon(artifact.kind)} {artifact.title} {artifact.description ? ( {artifact.description} ) : null} ); })} ); };