diff --git a/site/src/pages/AIBridgePage/RequestLogsPage/AIBridgeModelIcon.tsx b/site/src/pages/AIBridgePage/RequestLogsPage/AIBridgeModelIcon.tsx new file mode 100644 index 0000000000..2a3b4aef29 --- /dev/null +++ b/site/src/pages/AIBridgePage/RequestLogsPage/AIBridgeModelIcon.tsx @@ -0,0 +1,65 @@ +import { ExternalImage } from "components/ExternalImage/ExternalImage"; +import { CircleQuestionMarkIcon } from "lucide-react"; +import { cn } from "utils/cn"; + +// Infers the model family from a model name string. +// See official model naming docs: +// - Anthropic: https://docs.anthropic.com/en/docs/about-claude/models/all-models +// - OpenAI: https://platform.openai.com/docs/models +function inferModelFamily(model: string): string { + const modelFamily = model.toLowerCase(); + // Anthropic model families + if ( + modelFamily.includes("claude") || + modelFamily.includes("opus") || + modelFamily.includes("sonnet") || + modelFamily.includes("haiku") + ) { + return "claude"; + } + // OpenAI model families (gpt-*, o1/o3/o4-*, codex, whisper) + if ( + modelFamily.includes("gpt") || + modelFamily.startsWith("o1") || + modelFamily.startsWith("o3") || + modelFamily.startsWith("o4") || + modelFamily.includes("codex") || + modelFamily.includes("whisper") + ) { + return "openai"; + } + return "unknown"; +} + +export const AIBridgeModelIcon = ({ + model, + ...props +}: { + model: string; +} & React.ComponentProps<"svg">) => { + const iconClassName = "flex-shrink-0"; + const family = inferModelFamily(model); + switch (family) { + case "claude": + return ( + + ); + case "openai": + return ( + + ); + default: + return ( + + ); + } +}; diff --git a/site/src/pages/AIBridgePage/RequestLogsPage/RequestLogsRow/RequestLogsRow.tsx b/site/src/pages/AIBridgePage/RequestLogsPage/RequestLogsRow/RequestLogsRow.tsx index feeba6d71c..a60462614e 100644 --- a/site/src/pages/AIBridgePage/RequestLogsPage/RequestLogsRow/RequestLogsRow.tsx +++ b/site/src/pages/AIBridgePage/RequestLogsPage/RequestLogsRow/RequestLogsRow.tsx @@ -17,7 +17,7 @@ import { import { type FC, Fragment, useState } from "react"; import { cn } from "utils/cn"; import { formatDate, humanDuration } from "utils/time"; -import { AIBridgeProviderIcon } from "../AIBridgeProviderIcon"; +import { AIBridgeModelIcon } from "../AIBridgeModelIcon"; type RequestLogsRowProps = { interception: AIBridgeInterception; @@ -204,8 +204,8 @@ export const RequestLogsRow: FC = ({ interception }) => {
-
@@ -279,8 +279,8 @@ export const RequestLogsRow: FC = ({ interception }) => {
-