The platform for continuously improving AI agents.
import { Icon, type IconName } from "@/components/ui/icons";
import { cn } from "@/lib/utils";
import { activityIcon } from "./datasets/chat-activity";
import { integrationLogo } from "./traces/trace-source-chip";
const SLACK_LOGO = "https://a.slack-edge.com/80588/marketing/img/icons/icon_slack_hash_colored.png";
const HUGGING_FACE_LOGO = "https://huggingface.co/front/assets/huggingface_logo-noborder.svg";
const brandLogo = (name: string, className: string) => {
const segments = new Set(name.split("_").filter(Boolean));
if (segments.has("slack")) {
return <img alt="" className={cn(className, "object-contain")} src={SLACK_LOGO} />;
}
if (segments.has("huggingface") || (segments.has("hugging") && segments.has("face"))) {
return <img alt="" className={cn(className, "object-contain")} src={HUGGING_FACE_LOGO} />;
}
for (const segment of segments) {
const logo = integrationLogo(segment, className);
if (logo) return logo;
}
return null;
};
export function ToolMark({
name,
className = "size-3.5",
generic = "code",
}: {
name?: string;
className?: string;
generic?: IconName;
}) {
const key = (name ?? "")
.trim()
.toLowerCase()
.replaceAll(/[\s-]+/g, "_");
const mapped = activityIcon(key);
const Glyph = Icon[mapped === "code" ? generic : mapped];
return (
<span
className={cn(
"inline-flex items-center justify-center [&_img]:size-full [&_svg]:size-full",
className
)}
data-slot="tool-mark"
data-tool={key || undefined}
>
{brandLogo(key, "size-full") ?? <Glyph aria-hidden className="size-full" />}
</span>
);
}