import { DownOutlined } from "@ant-design/icons"; import type { ReactNode } from "react"; import type { WorkbenchOption, WorkbenchFieldGroup } from "./workbenchConstants"; import { getRatioOptionClassName, getSettingsGridColumnsClassName } from "./workbenchReferenceUtils"; const VIDEO_MODEL_ICON_URLS = { happyHorse: "https://stringtest.oss-cn-hangzhou.aliyuncs.com/static/model-icons/HappyHorse.svg", pixverse: "https://stringtest.oss-cn-hangzhou.aliyuncs.com/static/model-icons/Pixverse.svg", vidu: "https://stringtest.oss-cn-hangzhou.aliyuncs.com/static/model-icons/viduQ3.svg", wanxiang: "https://stringtest.oss-cn-hangzhou.aliyuncs.com/static/model-icons/wan.svg", kling: "https://stringtest.oss-cn-hangzhou.aliyuncs.com/static/model-icons/kling.svg", } as const; function getVideoModelIconUrl(option: WorkbenchOption): string | null { const text = `${option.value} ${option.label}`.toLowerCase(); if (text.includes("happyhorse")) return VIDEO_MODEL_ICON_URLS.happyHorse; if (text.includes("pixverse")) return VIDEO_MODEL_ICON_URLS.pixverse; if (text.includes("vidu")) return VIDEO_MODEL_ICON_URLS.vidu; if (text.includes("wan") || text.includes("万相")) return VIDEO_MODEL_ICON_URLS.wanxiang; if (text.includes("kling") || text.includes("可灵")) return VIDEO_MODEL_ICON_URLS.kling; return null; } export function SelectChip({ chipId, value, options, disabled, isOpen, onToggle, onClose, onChange, ariaLabel, direction = "up", }: { chipId: string; value: string; options: WorkbenchOption[]; disabled?: boolean; isOpen: boolean; onToggle: () => void; onClose: () => void; onChange: (value: string) => void; ariaLabel?: string; direction?: "up" | "down"; }) { const activeOption = options.find((option) => option.value === value); return (
{isOpen ? (
{options.map((option, index) => { const active = option.value === value; const iconUrl = chipId === "video-model" ? getVideoModelIconUrl(option) : null; return ( ); })}
) : null}
); } export function CompoundSelectChip({ chipId, summary, groups, disabled, isOpen, onToggle, direction = "up", }: { chipId: string; summary: string; groups: WorkbenchFieldGroup[]; disabled?: boolean; isOpen: boolean; onToggle: () => void; direction?: "up" | "down"; }) { return (
{isOpen ? ( ) : null}
); } export function InlineOptionChip({ chipId, value, options, icon, disabled, isOpen, onToggle, onClose, onChange, direction = "up", }: { chipId: string; value: string; options: WorkbenchOption[]; icon?: ReactNode; disabled?: boolean; isOpen: boolean; onToggle: () => void; onClose: () => void; onChange: (value: string) => void; direction?: "up" | "down"; }) { const activeOption = options.find((option) => option.value === value); return (
{isOpen ? (
{options.map((option) => { const active = option.value === value; return ( ); })}
) : null}
); }