| 1 | import { SparklesIcon } from "@heroicons/react/24/outline"; |
| 2 | import { ProfileDescription } from "core/config/ProfileLifecycleManager"; |
| 3 | import { isLocalProfile } from "../../util"; |
| 4 | import { BotIcon } from "../svg/BotIcon"; |
| 5 | |
| 6 | export interface AssistantIconProps { |
| 7 | assistant: ProfileDescription; |
| 8 | size?: string; |
| 9 | } |
| 10 | |
| 11 | export function AssistantIcon({ |
| 12 | assistant, |
| 13 | size = "h-4 w-4", |
| 14 | }: AssistantIconProps) { |
| 15 | if (isLocalProfile(assistant)) { |
| 16 | return <BotIcon className={`text-foreground ${size} flex-shrink-0`} />; |
| 17 | } else if (assistant.iconUrl) { |
| 18 | return ( |
| 19 | <img |
| 20 | src={assistant.iconUrl} |
| 21 | className={`${size} flex-shrink-0 rounded-full`} |
| 22 | alt="" |
| 23 | /> |
| 24 | ); |
| 25 | } else { |
| 26 | return <SparklesIcon className={`${size} flex-shrink-0`} />; |
| 27 | } |
| 28 | } |