@yuhuanowo/yunui 0.2.12 → 0.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ai.d.ts CHANGED
@@ -55,6 +55,66 @@ interface ModelCardProps {
55
55
  /** Card summarizing an AI model: icon, name, capability chips, id badges, description, and a developer/context/tier/price footer. */
56
56
  declare function ModelCard({ name, icon, ids, description, capabilities, developer, context, tier, price, nonofficial, suspended, labels, onClick, className, }: ModelCardProps): React.JSX.Element;
57
57
 
58
+ interface ModelSelectOption {
59
+ /** Stable id used as the value. */
60
+ id: string;
61
+ /** Display name (trigger label + primary search corpus). */
62
+ label: string;
63
+ /** Group key — models are grouped and provider-filtered by this. */
64
+ group: string;
65
+ /** Human label for the group (defaults to `group`). */
66
+ groupLabel?: string;
67
+ /** Extra text folded into search (ids, aliases, owner). */
68
+ searchText?: string;
69
+ /** Leading model icon (trigger + row). */
70
+ icon?: ReactNode;
71
+ /** Group/provider icon (filter chip + group header). */
72
+ groupIcon?: ReactNode;
73
+ /** Inline capability glyphs shown after the name. */
74
+ badges?: ReactNode;
75
+ /** Secondary line under the name (ids/aliases/pricing). */
76
+ detail?: ReactNode;
77
+ /** Right-aligned meta chip(s) (context length / max tokens). */
78
+ meta?: ReactNode;
79
+ disabled?: boolean;
80
+ }
81
+ /** A capability filter chip; `match` decides whether an option passes it. */
82
+ interface ModelSelectFilter {
83
+ key: string;
84
+ /** Chip content (e.g. a capability badge). */
85
+ node: ReactNode;
86
+ title?: string;
87
+ /** Whether an option satisfies this filter (all active filters must pass). */
88
+ match: (option: ModelSelectOption) => boolean;
89
+ }
90
+ interface ModelSelectLabels {
91
+ placeholder?: string;
92
+ search?: string;
93
+ clearSearch?: string;
94
+ clearFilters?: string;
95
+ all?: string;
96
+ pinned?: string;
97
+ noResults?: string;
98
+ }
99
+ interface ModelSelectProps {
100
+ options: ModelSelectOption[];
101
+ /** Selected option id. */
102
+ value: string;
103
+ onChange: (id: string) => void;
104
+ className?: string;
105
+ labels?: ModelSelectLabels;
106
+ /** Controlled pinned ids. Pass with `onTogglePin` to show the pin column. */
107
+ pinned?: string[];
108
+ onTogglePin?: (id: string) => void;
109
+ /** Capability filter chips. */
110
+ filters?: ModelSelectFilter[];
111
+ /** Optional footer bar; receives the current (filtered) result count. */
112
+ renderFooter?: (count: number) => ReactNode;
113
+ }
114
+ /** A generic, searchable model picker: provider grouping + provider/capability
115
+ * filters + a pinned section + a styled dropdown. Domain-agnostic. */
116
+ declare function ModelSelect({ options, value, onChange, className, labels, pinned, onTogglePin, filters, renderFooter, }: ModelSelectProps): React.JSX.Element;
117
+
58
118
  /** Click-to-copy mono ID badge (faithful port of Yunxin's IDBadge). */
59
119
  declare function IDBadge({ text, truncate }: {
60
120
  text: string;
@@ -78,6 +138,16 @@ interface CapabilitySelectorProps {
78
138
  /** Multi-select grid of toggleable model capabilities; the option set adapts to `modelType`. */
79
139
  declare function CapabilitySelector({ selected, onChange, disabled, size, columns, modelType }: CapabilitySelectorProps): React.JSX.Element;
80
140
 
141
+ /** Whether a capability key has a known icon/color in the design system. */
142
+ declare function isKnownCapability(capability: string): boolean;
143
+ /** Just the colored capability glyph — e.g. the inline icons shown after a model
144
+ * name. Renders nothing for an unknown capability. */
145
+ declare function CapabilityIcon({ capability, size, className, }: {
146
+ capability: string;
147
+ size?: number;
148
+ className?: string;
149
+ }): React.JSX.Element | null;
150
+
81
151
  /**
82
152
  * Rounded provider icon — a thin alias over the canonical {@link ProviderIcon}
83
153
  * (rounded avatar style). Kept for call sites that prefer the short name.
@@ -166,6 +236,8 @@ declare function ModelAvatar({ iconUrl, developer, provider, size, className, }:
166
236
  className?: string;
167
237
  }): React.JSX.Element;
168
238
 
239
+ declare const PROVIDER_ICON_SLUGS: ReadonlySet<string>;
240
+
169
241
  interface LanguageOption {
170
242
  /** Locale code (e.g. "en", "zh-TW"). */
171
243
  value: string;
@@ -230,4 +302,4 @@ interface NavbarProps {
230
302
  /** Floating top navigation bar: logo, center links with scroll-spy, theme/language slots, and auth buttons with a mobile menu. */
231
303
  declare function Navbar({ appName, logoSrc, links, currentPath, variant, labels, languageSwitcher, themeToggle, homeHref, loginHref, signupHref, }: NavbarProps): React.JSX.Element;
232
304
 
233
- export { type ButtonProps, CapabilitySelector, IDBadge, type LanguageOption, LanguageSwitcher, ModelAvatar, ModelCard, type ModelCardProps, ModelIcon, ModelTypeIcon, type NavLink, Navbar, ProviderAvatar, ProviderIcon, ProviderIconImg, ProviderNames, ThinkingBlock, buttonVariants, getDeveloperIconPath, getIconPath, getProviderIconOptions, getProviderName, normalizeProviderId };
305
+ export { type ButtonProps, CapabilityIcon, CapabilitySelector, IDBadge, type LanguageOption, LanguageSwitcher, ModelAvatar, ModelCard, type ModelCardProps, ModelIcon, ModelSelect, type ModelSelectFilter, type ModelSelectLabels, type ModelSelectOption, type ModelSelectProps, ModelTypeIcon, type NavLink, Navbar, PROVIDER_ICON_SLUGS, ProviderAvatar, ProviderIcon, ProviderIconImg, ProviderNames, ThinkingBlock, buttonVariants, getDeveloperIconPath, getIconPath, getProviderIconOptions, getProviderName, isKnownCapability, normalizeProviderId };
package/dist/ai.js CHANGED
@@ -1,11 +1,11 @@
1
1
  "use client";
2
- import { copyToClipboard } from './chunk-BO6CDGJS.js';
3
- export { DiscordIcon, Footer, GithubIcon, InstagramIcon } from './chunk-BO6CDGJS.js';
2
+ import { copyToClipboard } from './chunk-N53PNMPJ.js';
3
+ export { DiscordIcon, Footer, GithubIcon, InstagramIcon } from './chunk-N53PNMPJ.js';
4
4
  import { cn, ThemeToggle } from './chunk-TFZKMJGF.js';
5
5
  import { useYunUI } from './chunk-U2LNRVMI.js';
6
- import { useState, useRef, useEffect, useMemo } from 'react';
6
+ import { memo, useState, useRef, useMemo, useEffect } from 'react';
7
7
  import { AnimatePresence, motion } from 'framer-motion';
8
- import { Brain, ChevronUp, ChevronDown, Check, Copy, Waves, SlidersHorizontal, Layers, Fingerprint, Ban, Image, Code, Eye, PauseCircle, Bot, Globe, X, Menu, Radio, Box, Shield, Shuffle, Music, Video, Mic, Volume2, Headphones, Palette, Hash, FileText, MessageSquare, Pencil } from 'lucide-react';
8
+ import { Pin, MessageSquare, Waves, Code, Eye, Brain, Pencil, Ban, Fingerprint, Layers, SlidersHorizontal, Mic, Video, Music, Box, Radio, ChevronUp, ChevronDown, Check, Copy, Image, PauseCircle, Search, X, Sparkles, Bot, Globe, Menu, Shield, Shuffle, Volume2, Headphones, Palette, Hash, FileText } from 'lucide-react';
9
9
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
10
10
  import { cva } from 'class-variance-authority';
11
11
 
@@ -152,38 +152,292 @@ function ModelCard({
152
152
  }
153
153
  );
154
154
  }
155
+ function ModelSelect({
156
+ options,
157
+ value,
158
+ onChange,
159
+ className,
160
+ labels,
161
+ pinned,
162
+ onTogglePin,
163
+ filters,
164
+ renderFooter
165
+ }) {
166
+ const L = {
167
+ placeholder: "Select a model",
168
+ search: "Search models\u2026",
169
+ clearSearch: "Clear",
170
+ clearFilters: "Clear filters",
171
+ all: "All",
172
+ pinned: "Pinned",
173
+ noResults: "No models found",
174
+ ...labels
175
+ };
176
+ const [isOpen, setIsOpen] = useState(false);
177
+ const [search, setSearch] = useState("");
178
+ const [activeGroup, setActiveGroup] = useState(null);
179
+ const [activeFilters, setActiveFilters] = useState([]);
180
+ const rootRef = useRef(null);
181
+ const inputRef = useRef(null);
182
+ const listRef = useRef(null);
183
+ const pinnedSet = useMemo(() => new Set(pinned ?? []), [pinned]);
184
+ useEffect(() => {
185
+ const onDown = (e) => {
186
+ if (rootRef.current && !rootRef.current.contains(e.target)) setIsOpen(false);
187
+ };
188
+ document.addEventListener("mousedown", onDown);
189
+ document.addEventListener("touchstart", onDown);
190
+ return () => {
191
+ document.removeEventListener("mousedown", onDown);
192
+ document.removeEventListener("touchstart", onDown);
193
+ };
194
+ }, []);
195
+ useEffect(() => {
196
+ if (!isOpen) return;
197
+ const t = setTimeout(() => {
198
+ inputRef.current?.focus();
199
+ if (value && listRef.current) {
200
+ const el = listRef.current.querySelector(`[data-model-id="${CSS.escape(value)}"]`);
201
+ el?.scrollIntoView({ block: "center" });
202
+ }
203
+ }, 50);
204
+ return () => clearTimeout(t);
205
+ }, [isOpen, value]);
206
+ const groups = useMemo(() => {
207
+ const counts = {};
208
+ for (const o of options) counts[o.group] = (counts[o.group] || 0) + 1;
209
+ return Object.entries(counts).sort((a, b) => b[1] - a[1]).map(([g]) => g);
210
+ }, [options]);
211
+ const groupLabel = useMemo(() => {
212
+ const m = {};
213
+ for (const o of options) if (o.groupLabel) m[o.group] = o.groupLabel;
214
+ return m;
215
+ }, [options]);
216
+ const groupIcon = useMemo(() => {
217
+ const m = {};
218
+ for (const o of options) if (o.groupIcon && !(o.group in m)) m[o.group] = o.groupIcon;
219
+ return m;
220
+ }, [options]);
221
+ const filtered = useMemo(() => {
222
+ const q = search.trim().toLowerCase();
223
+ return options.filter((o) => {
224
+ if (q) {
225
+ const hay = `${o.label} ${o.searchText ?? ""} ${o.group}`.toLowerCase();
226
+ if (!hay.includes(q)) return false;
227
+ }
228
+ if (activeGroup && o.group !== activeGroup) return false;
229
+ if (activeFilters.length && filters) {
230
+ const fs = filters.filter((f) => activeFilters.includes(f.key));
231
+ if (!fs.every((f) => f.match(o))) return false;
232
+ }
233
+ return true;
234
+ });
235
+ }, [options, search, activeGroup, activeFilters, filters]);
236
+ const pinnedList = filtered.filter((o) => pinnedSet.has(o.id));
237
+ const grouped = useMemo(() => {
238
+ const acc = {};
239
+ for (const o of filtered) {
240
+ if (pinnedSet.has(o.id)) continue;
241
+ (acc[o.group] ??= []).push(o);
242
+ }
243
+ return acc;
244
+ }, [filtered, pinnedSet]);
245
+ const selected = options.find((o) => o.id === value);
246
+ const onWheel = (e) => {
247
+ const el = e.currentTarget;
248
+ const atTop = el.scrollTop <= 1;
249
+ const atBottom = el.scrollTop + el.clientHeight >= el.scrollHeight - 1;
250
+ if (atTop && e.deltaY < 0 || atBottom && e.deltaY > 0) e.preventDefault();
251
+ };
252
+ const select = (id) => {
253
+ onChange(id);
254
+ setIsOpen(false);
255
+ };
256
+ return (
257
+ // Fixed-width root so the trigger doesn't grow/shrink as the selected
258
+ // label changes; override the width via `className`.
259
+ /* @__PURE__ */ jsxs("div", { ref: rootRef, className: cn("relative w-64", className), children: [
260
+ /* @__PURE__ */ jsxs(
261
+ "button",
262
+ {
263
+ type: "button",
264
+ onClick: () => setIsOpen((o) => !o),
265
+ className: cn(
266
+ "flex items-center gap-2 px-3 py-2 bg-card border rounded-xl text-left group transition-all w-full shadow-sm hover:shadow-md",
267
+ isOpen ? "border-ring/60 ring-2 ring-ring/25" : "border-border hover:border-ring"
268
+ ),
269
+ children: [
270
+ selected ? /* @__PURE__ */ jsxs(Fragment, { children: [
271
+ selected.icon,
272
+ /* @__PURE__ */ jsx("span", { className: "flex-1 truncate text-sm font-medium", children: selected.label })
273
+ ] }) : /* @__PURE__ */ jsx("span", { className: "flex-1 text-sm text-muted-foreground", children: L.placeholder }),
274
+ /* @__PURE__ */ jsx(ChevronDown, { size: 14, className: cn("text-muted-foreground transition-transform shrink-0", isOpen && "rotate-180") })
275
+ ]
276
+ }
277
+ ),
278
+ isOpen && /* @__PURE__ */ jsxs(
279
+ motion.div,
280
+ {
281
+ initial: { opacity: 0, y: -8, scale: 0.96 },
282
+ animate: { opacity: 1, y: 0, scale: 1 },
283
+ transition: { duration: 0.16, ease: "easeOut" },
284
+ style: { maxWidth: "calc(100vw - 1rem)" },
285
+ className: "origin-top absolute z-50 top-full left-0 mt-2 w-96 bg-popover/90 backdrop-blur-xl border border-border/60 rounded-2xl shadow-2xl overflow-hidden",
286
+ children: [
287
+ /* @__PURE__ */ jsxs("div", { className: "p-2.5 border-b border-border/50", children: [
288
+ /* @__PURE__ */ jsxs("div", { className: "relative", children: [
289
+ /* @__PURE__ */ jsx(Search, { size: 15, className: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none" }),
290
+ /* @__PURE__ */ jsx(
291
+ "input",
292
+ {
293
+ ref: inputRef,
294
+ value: search,
295
+ onChange: (e) => setSearch(e.target.value),
296
+ placeholder: L.search,
297
+ className: "w-full pl-9 pr-8 py-2 text-sm bg-muted/50 border border-transparent rounded-xl outline-none focus:border-ring focus:bg-background transition-colors"
298
+ }
299
+ ),
300
+ search && /* @__PURE__ */ jsx("button", { type: "button", onClick: () => setSearch(""), title: L.clearSearch, className: "absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors p-0.5 rounded-md hover:bg-muted", children: /* @__PURE__ */ jsx(X, { size: 13 }) })
301
+ ] }),
302
+ filters && filters.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 mt-2 px-1", children: [
303
+ filters.map((f) => {
304
+ const on = activeFilters.includes(f.key);
305
+ return /* @__PURE__ */ jsx("button", { type: "button", title: f.title, onClick: () => setActiveFilters((p) => p.includes(f.key) ? p.filter((k) => k !== f.key) : [...p, f.key]), className: cn("p-1 rounded-md transition-colors", on ? "bg-foreground/10" : "hover:bg-muted"), children: f.node }, f.key);
306
+ }),
307
+ activeFilters.length > 0 && /* @__PURE__ */ jsx("button", { type: "button", onClick: () => setActiveFilters([]), title: L.clearFilters, className: "p-1 rounded-md text-muted-foreground hover:bg-muted", children: /* @__PURE__ */ jsx(X, { size: 14 }) })
308
+ ] })
309
+ ] }),
310
+ groups.length > 1 && /* @__PURE__ */ jsx("div", { className: "px-2.5 py-2 border-b border-border/50 overflow-x-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex gap-1 min-w-max", children: [
311
+ /* @__PURE__ */ jsxs("button", { type: "button", onClick: () => setActiveGroup(null), className: cn("px-2.5 py-1.5 text-xs rounded-lg font-medium transition-colors whitespace-nowrap", !activeGroup ? "bg-foreground text-background" : "bg-muted text-muted-foreground hover:bg-muted/80"), children: [
312
+ L.all,
313
+ " (",
314
+ options.length,
315
+ ")"
316
+ ] }),
317
+ groups.map((g) => /* @__PURE__ */ jsxs("button", { type: "button", onClick: () => setActiveGroup((c) => c === g ? null : g), className: cn("px-2.5 py-1.5 text-xs rounded-lg font-medium transition-colors flex items-center gap-1.5 whitespace-nowrap", activeGroup === g ? "bg-foreground text-background" : "bg-muted text-muted-foreground hover:bg-muted/80"), children: [
318
+ groupIcon[g],
319
+ groupLabel[g] ?? g
320
+ ] }, g))
321
+ ] }) }),
322
+ /* @__PURE__ */ jsxs("div", { ref: listRef, onWheel, className: "max-h-96 overflow-y-auto overscroll-contain", children: [
323
+ pinnedList.length > 0 && /* @__PURE__ */ jsxs("div", { className: "px-1.5 py-1.5 border-b border-border/40", children: [
324
+ /* @__PURE__ */ jsxs("div", { className: "text-[10px] font-medium text-muted-foreground uppercase tracking-wide px-2 mb-1 flex items-center gap-1", children: [
325
+ /* @__PURE__ */ jsx(Pin, { size: 9 }),
326
+ " ",
327
+ L.pinned
328
+ ] }),
329
+ pinnedList.map((o) => /* @__PURE__ */ jsx(ModelRow, { option: o, selected: o.id === value, pinned: true, isPinnable: !!onTogglePin, onSelect: () => select(o.id), onTogglePin: () => onTogglePin?.(o.id) }, o.id))
330
+ ] }),
331
+ /* @__PURE__ */ jsx("div", { className: "px-1.5 py-1.5", children: Object.entries(grouped).map(([g, opts]) => /* @__PURE__ */ jsxs("div", { className: "mb-3 last:mb-0", children: [
332
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-2 mb-1 sticky top-0 bg-popover/95 backdrop-blur-sm py-1.5 z-10", children: [
333
+ groupIcon[g],
334
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-semibold", children: groupLabel[g] ?? g }),
335
+ /* @__PURE__ */ jsx("span", { className: "ml-auto text-[10px] text-muted-foreground bg-muted/60 px-2 py-0.5 rounded-full font-medium", children: opts.length })
336
+ ] }),
337
+ opts.map((o) => /* @__PURE__ */ jsx(ModelRow, { option: o, selected: o.id === value, pinned: false, isPinnable: !!onTogglePin, onSelect: () => select(o.id), onTogglePin: () => onTogglePin?.(o.id) }, o.id))
338
+ ] }, g)) }),
339
+ filtered.length === 0 && /* @__PURE__ */ jsxs("div", { className: "py-12 text-center text-muted-foreground", children: [
340
+ /* @__PURE__ */ jsx(Sparkles, { size: 28, className: "mx-auto mb-3 opacity-40" }),
341
+ /* @__PURE__ */ jsx("p", { className: "text-sm", children: L.noResults })
342
+ ] })
343
+ ] }),
344
+ renderFooter && filtered.length > 0 && /* @__PURE__ */ jsx("div", { className: "border-t border-border/50 px-3 py-2 bg-muted/30 text-xs text-muted-foreground", children: renderFooter(filtered.length) })
345
+ ]
346
+ }
347
+ )
348
+ ] })
349
+ );
350
+ }
351
+ var ModelRow = memo(function ModelRow2({
352
+ option,
353
+ selected,
354
+ pinned,
355
+ isPinnable,
356
+ onSelect,
357
+ onTogglePin
358
+ }) {
359
+ return /* @__PURE__ */ jsxs(
360
+ "div",
361
+ {
362
+ "data-model-id": option.id,
363
+ onClick: onSelect,
364
+ className: cn(
365
+ "relative flex items-center gap-3 px-3 py-2.5 rounded-xl cursor-pointer group transition-colors",
366
+ // A clear gray fill on both states (selected solid, hover lighter)
367
+ // — the bar's opacity then tells selected from merely-hovered.
368
+ selected ? "bg-muted" : "hover:bg-muted"
369
+ ),
370
+ children: [
371
+ /* @__PURE__ */ jsx(
372
+ "div",
373
+ {
374
+ className: cn(
375
+ "absolute left-0 top-1/2 w-1 h-6 rounded-full bg-primary transition-all duration-150 -translate-y-1/2",
376
+ selected ? "opacity-100 translate-x-0" : "opacity-0 -translate-x-1.5 group-hover:opacity-50 group-hover:translate-x-0"
377
+ )
378
+ }
379
+ ),
380
+ option.icon,
381
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
382
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
383
+ /* @__PURE__ */ jsx("span", { className: "font-medium truncate", children: option.label }),
384
+ option.badges
385
+ ] }),
386
+ option.detail
387
+ ] }),
388
+ option.meta && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1 shrink-0", children: option.meta }),
389
+ isPinnable && /* @__PURE__ */ jsx(
390
+ "button",
391
+ {
392
+ type: "button",
393
+ onClick: (e) => {
394
+ e.stopPropagation();
395
+ onTogglePin();
396
+ },
397
+ className: cn(
398
+ "p-1.5 rounded-md transition-all shrink-0 lg:opacity-0 lg:group-hover:opacity-100",
399
+ pinned ? "text-foreground opacity-100 hover:bg-muted/50" : "text-muted-foreground/40 opacity-60 hover:text-foreground/70 hover:bg-muted/50"
400
+ ),
401
+ "aria-label": pinned ? "Unpin" : "Pin",
402
+ children: /* @__PURE__ */ jsx(Pin, { size: 14, className: pinned ? "fill-current" : "" })
403
+ }
404
+ )
405
+ ]
406
+ }
407
+ );
408
+ });
155
409
  var llmCapabilityConfig = [
156
- { value: "chat", icon: MessageSquare, iconColor: "text-blue-500", color: "bg-blue-500/10 text-blue-600 border-blue-500/20 hover:bg-blue-500/20" },
157
- { value: "streaming", icon: Waves, iconColor: "text-cyan-500", color: "bg-cyan-500/10 text-cyan-600 border-cyan-500/20 hover:bg-cyan-500/20" },
158
- { value: "function_calling", icon: Code, iconColor: "text-purple-500", color: "bg-purple-500/10 text-purple-600 border-purple-500/20 hover:bg-purple-500/20" },
159
- { value: "vision", icon: Eye, iconColor: "text-amber-500", color: "bg-amber-500/10 text-amber-600 border-amber-500/20 hover:bg-amber-500/20" },
160
- { value: "thinking", icon: Brain, iconColor: "text-pink-500", color: "bg-pink-500/10 text-pink-600 border-pink-500/20 hover:bg-pink-500/20" }
410
+ { value: "chat", icon: MessageSquare, iconColor: "text-blue-500", color: "bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20 hover:bg-blue-500/20" },
411
+ { value: "streaming", icon: Waves, iconColor: "text-cyan-500", color: "bg-cyan-500/10 text-cyan-600 dark:text-cyan-400 border-cyan-500/20 hover:bg-cyan-500/20" },
412
+ { value: "function_calling", icon: Code, iconColor: "text-purple-500", color: "bg-purple-500/10 text-purple-600 dark:text-purple-400 border-purple-500/20 hover:bg-purple-500/20" },
413
+ { value: "vision", icon: Eye, iconColor: "text-amber-500", color: "bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20 hover:bg-amber-500/20" },
414
+ { value: "thinking", icon: Brain, iconColor: "text-pink-500", color: "bg-pink-500/10 text-pink-600 dark:text-pink-400 border-pink-500/20 hover:bg-pink-500/20" }
161
415
  ];
162
416
  var imageCapabilityConfig = [
163
- { value: "image_edit", icon: Pencil, iconColor: "text-orange-500", color: "bg-orange-500/10 text-orange-600 border-orange-500/20 hover:bg-orange-500/20" },
164
- { value: "negative_prompt", icon: Ban, iconColor: "text-red-500", color: "bg-red-500/10 text-red-600 border-red-500/20 hover:bg-red-500/20" },
165
- { value: "seed_control", icon: Fingerprint, iconColor: "text-indigo-500", color: "bg-indigo-500/10 text-indigo-600 border-indigo-500/20 hover:bg-indigo-500/20" },
166
- { value: "lora", icon: Layers, iconColor: "text-teal-500", color: "bg-teal-500/10 text-teal-600 border-teal-500/20 hover:bg-teal-500/20" },
167
- { value: "guidance_scale", icon: SlidersHorizontal, iconColor: "text-yellow-500", color: "bg-yellow-500/10 text-yellow-600 border-yellow-500/20 hover:bg-yellow-500/20" },
168
- { value: "strength", icon: SlidersHorizontal, iconColor: "text-orange-500", color: "bg-orange-500/10 text-orange-600 border-orange-500/20 hover:bg-orange-500/20" },
169
- { value: "batch", icon: Waves, iconColor: "text-cyan-500", color: "bg-cyan-500/10 text-cyan-600 border-cyan-500/20 hover:bg-cyan-500/20" }
417
+ { value: "image_edit", icon: Pencil, iconColor: "text-orange-500", color: "bg-orange-500/10 text-orange-600 dark:text-orange-400 border-orange-500/20 hover:bg-orange-500/20" },
418
+ { value: "negative_prompt", icon: Ban, iconColor: "text-red-500", color: "bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20 hover:bg-red-500/20" },
419
+ { value: "seed_control", icon: Fingerprint, iconColor: "text-indigo-500", color: "bg-indigo-500/10 text-indigo-600 dark:text-indigo-400 border-indigo-500/20 hover:bg-indigo-500/20" },
420
+ { value: "lora", icon: Layers, iconColor: "text-teal-500", color: "bg-teal-500/10 text-teal-600 dark:text-teal-400 border-teal-500/20 hover:bg-teal-500/20" },
421
+ { value: "guidance_scale", icon: SlidersHorizontal, iconColor: "text-yellow-500", color: "bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 border-yellow-500/20 hover:bg-yellow-500/20" },
422
+ { value: "strength", icon: SlidersHorizontal, iconColor: "text-orange-500", color: "bg-orange-500/10 text-orange-600 dark:text-orange-400 border-orange-500/20 hover:bg-orange-500/20" },
423
+ { value: "batch", icon: Waves, iconColor: "text-cyan-500", color: "bg-cyan-500/10 text-cyan-600 dark:text-cyan-400 border-cyan-500/20 hover:bg-cyan-500/20" }
170
424
  ];
171
425
  var audioCapabilityConfig = [
172
- { value: "tts", icon: Mic, iconColor: "text-green-500", color: "bg-green-500/10 text-green-600 border-green-500/20 hover:bg-green-500/20" },
173
- { value: "stt", icon: MessageSquare, iconColor: "text-blue-500", color: "bg-blue-500/10 text-blue-600 border-blue-500/20 hover:bg-blue-500/20" },
174
- { value: "audio_translation", icon: Waves, iconColor: "text-purple-500", color: "bg-purple-500/10 text-purple-600 border-purple-500/20 hover:bg-purple-500/20" }
426
+ { value: "tts", icon: Mic, iconColor: "text-green-500", color: "bg-green-500/10 text-green-600 dark:text-green-400 border-green-500/20 hover:bg-green-500/20" },
427
+ { value: "stt", icon: MessageSquare, iconColor: "text-blue-500", color: "bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20 hover:bg-blue-500/20" },
428
+ { value: "audio_translation", icon: Waves, iconColor: "text-purple-500", color: "bg-purple-500/10 text-purple-600 dark:text-purple-400 border-purple-500/20 hover:bg-purple-500/20" }
175
429
  ];
176
430
  var videoCapabilityConfig = [
177
- { value: "video_generation", icon: Video, iconColor: "text-red-500", color: "bg-red-500/10 text-red-600 border-red-500/20 hover:bg-red-500/20" }
431
+ { value: "video_generation", icon: Video, iconColor: "text-red-500", color: "bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20 hover:bg-red-500/20" }
178
432
  ];
179
433
  var musicCapabilityConfig = [
180
- { value: "music_generation", icon: Music, iconColor: "text-pink-500", color: "bg-pink-500/10 text-pink-600 border-pink-500/20 hover:bg-pink-500/20" }
434
+ { value: "music_generation", icon: Music, iconColor: "text-pink-500", color: "bg-pink-500/10 text-pink-600 dark:text-pink-400 border-pink-500/20 hover:bg-pink-500/20" }
181
435
  ];
182
436
  var threedCapabilityConfig = [
183
- { value: "threed_generation", icon: Box, iconColor: "text-indigo-500", color: "bg-indigo-500/10 text-indigo-600 border-indigo-500/20 hover:bg-indigo-500/20" }
437
+ { value: "threed_generation", icon: Box, iconColor: "text-indigo-500", color: "bg-indigo-500/10 text-indigo-600 dark:text-indigo-400 border-indigo-500/20 hover:bg-indigo-500/20" }
184
438
  ];
185
439
  var realtimeCapabilityConfig = [
186
- { value: "realtime_voice", icon: Radio, iconColor: "text-yellow-500", color: "bg-yellow-500/10 text-yellow-600 border-yellow-500/20 hover:bg-yellow-500/20" }
440
+ { value: "realtime_voice", icon: Radio, iconColor: "text-yellow-500", color: "bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 border-yellow-500/20 hover:bg-yellow-500/20" }
187
441
  ];
188
442
  function CapabilitySelector({ selected, onChange, disabled = false, size = "md", columns = 4, modelType }) {
189
443
  const t = useYunUI().useT("capabilities");
@@ -230,11 +484,11 @@ function CapabilitySelector({ selected, onChange, disabled = false, size = "md",
230
484
  const gridColsClass = {
231
485
  1: "grid-cols-1",
232
486
  2: "grid-cols-2",
233
- 3: "grid-cols-3",
234
- 4: "grid-cols-4",
235
- 5: "grid-cols-5",
236
- 6: "grid-cols-6"
237
- }[columns] || "grid-cols-3";
487
+ 3: "grid-cols-2 sm:grid-cols-3",
488
+ 4: "grid-cols-2 sm:grid-cols-4",
489
+ 5: "grid-cols-2 sm:grid-cols-3 lg:grid-cols-5",
490
+ 6: "grid-cols-2 sm:grid-cols-3 lg:grid-cols-6"
491
+ }[columns] || "grid-cols-2 sm:grid-cols-3";
238
492
  return /* @__PURE__ */ jsx("div", { className: `grid ${gridColsClass} gap-2`, children: capabilityOptions.map((cap) => {
239
493
  const isSelected = selected.includes(cap.value);
240
494
  const Icon = cap.icon;
@@ -254,6 +508,30 @@ function CapabilitySelector({ selected, onChange, disabled = false, size = "md",
254
508
  );
255
509
  }) });
256
510
  }
511
+ var CAPABILITY_BY_KEY = Object.fromEntries(
512
+ [
513
+ ...llmCapabilityConfig,
514
+ ...imageCapabilityConfig,
515
+ ...audioCapabilityConfig,
516
+ ...videoCapabilityConfig,
517
+ ...musicCapabilityConfig,
518
+ ...threedCapabilityConfig,
519
+ ...realtimeCapabilityConfig
520
+ ].map((c) => [c.value, c])
521
+ );
522
+ function isKnownCapability(capability) {
523
+ return capability in CAPABILITY_BY_KEY;
524
+ }
525
+ function CapabilityIcon({
526
+ capability,
527
+ size = 14,
528
+ className
529
+ }) {
530
+ const cfg = CAPABILITY_BY_KEY[capability];
531
+ if (!cfg) return null;
532
+ const Icon = cfg.icon;
533
+ return /* @__PURE__ */ jsx(Icon, { size, className: cn(cfg.iconColor, "shrink-0", className) });
534
+ }
257
535
 
258
536
  // src/ai/icon-slugs.generated.ts
259
537
  var PROVIDER_ICON_SLUGS = /* @__PURE__ */ new Set([
@@ -684,10 +962,10 @@ var providerIconMap = {
684
962
  grok: "grok.webp",
685
963
  xai: "grok.webp",
686
964
  // Cloud providers
687
- azure: "github.webp",
688
- "azure-openai": "github.webp",
689
- aws: "github.webp",
690
- bedrock: "github.webp",
965
+ azure: "azure.webp",
966
+ "azure-openai": "azure.webp",
967
+ aws: "aws.webp",
968
+ bedrock: "bedrock.webp",
691
969
  // Chinese providers
692
970
  zhipu: "zhipu.webp",
693
971
  moonshot: "moonshot.webp",
@@ -905,10 +1183,10 @@ var ProviderNames = {
905
1183
  xai: "xAI",
906
1184
  grok: "Grok",
907
1185
  groq: "Groq",
908
- azure: "GitHub Models",
909
- "azure-openai": "GitHub Models",
910
- aws: "GitHub Models",
911
- bedrock: "GitHub Models",
1186
+ azure: "Azure",
1187
+ "azure-openai": "Azure OpenAI",
1188
+ aws: "AWS",
1189
+ bedrock: "Bedrock",
912
1190
  nvidia: "NVIDIA",
913
1191
  zhipu: "Zhipu",
914
1192
  moonshot: "Moonshot",
@@ -1281,26 +1559,23 @@ function Navbar({
1281
1559
  link.href
1282
1560
  )) }),
1283
1561
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 shrink-0", children: [
1284
- languageSwitcher,
1562
+ /* @__PURE__ */ jsx("span", { className: "hidden md:flex items-center gap-1.5", children: languageSwitcher }),
1285
1563
  themeToggle ?? /* @__PURE__ */ jsx(ThemeToggle, { variant: "pill" }),
1286
1564
  variant !== "minimal" && /* @__PURE__ */ jsxs(Fragment, { children: [
1287
1565
  /* @__PURE__ */ jsx(
1288
1566
  Link,
1289
1567
  {
1290
1568
  href: loginHref,
1291
- className: "hidden sm:block text-sm text-muted-foreground hover:text-foreground transition-colors duration-200 py-2 whitespace-nowrap min-w-15 text-center",
1569
+ className: "hidden md:block text-sm text-muted-foreground hover:text-foreground transition-colors duration-200 py-2 whitespace-nowrap min-w-15 text-center",
1292
1570
  children: signIn
1293
1571
  }
1294
1572
  ),
1295
- /* @__PURE__ */ jsxs(
1573
+ /* @__PURE__ */ jsx(
1296
1574
  Link,
1297
1575
  {
1298
1576
  href: signupHref,
1299
- className: "px-3 sm:px-4 py-2 bg-foreground text-background text-sm font-medium rounded-lg hover:bg-foreground/90 hover:shadow-md transition-all duration-200 whitespace-nowrap min-w-20 text-center yunui-accent-bg yunui-accent-on",
1300
- children: [
1301
- /* @__PURE__ */ jsx("span", { className: "hidden sm:inline", children: signUp }),
1302
- /* @__PURE__ */ jsx("span", { className: "sm:hidden", children: "Sign Up" })
1303
- ]
1577
+ className: "hidden md:inline-block px-4 py-2 bg-foreground text-background text-sm font-medium rounded-lg hover:bg-foreground/90 hover:shadow-md transition-all duration-200 whitespace-nowrap min-w-20 text-center yunui-accent-bg yunui-accent-on",
1578
+ children: signUp
1304
1579
  }
1305
1580
  )
1306
1581
  ] }),
@@ -1329,6 +1604,8 @@ function Navbar({
1329
1604
  },
1330
1605
  link.href
1331
1606
  )),
1607
+ /* @__PURE__ */ jsx("div", { className: "my-1 border-t border-border" }),
1608
+ languageSwitcher && /* @__PURE__ */ jsx("div", { className: "px-2 py-1.5", children: languageSwitcher }),
1332
1609
  /* @__PURE__ */ jsx(
1333
1610
  Link,
1334
1611
  {
@@ -1337,12 +1614,21 @@ function Navbar({
1337
1614
  className: "px-4 py-2.5 rounded-xl text-sm text-muted-foreground transition-colors hover:bg-foreground/5",
1338
1615
  children: signIn
1339
1616
  }
1617
+ ),
1618
+ /* @__PURE__ */ jsx(
1619
+ Link,
1620
+ {
1621
+ href: signupHref,
1622
+ onClick: () => setMenuOpen(false),
1623
+ className: "mt-0.5 px-4 py-2.5 rounded-xl text-sm font-medium text-center bg-foreground text-background hover:bg-foreground/90 transition-colors yunui-accent-bg yunui-accent-on",
1624
+ children: signUp
1625
+ }
1340
1626
  )
1341
1627
  ] })
1342
1628
  ] })
1343
1629
  ] });
1344
1630
  }
1345
1631
 
1346
- export { CapabilitySelector, IDBadge, LanguageSwitcher, ModelAvatar, ModelCard, ModelIcon, ModelTypeIcon, Navbar, ProviderAvatar, ProviderIcon, ProviderIconImg, ProviderNames, ThinkingBlock, buttonVariants, getDeveloperIconPath, getIconPath, getProviderIconOptions, getProviderName, normalizeProviderId };
1632
+ export { CapabilityIcon, CapabilitySelector, IDBadge, LanguageSwitcher, ModelAvatar, ModelCard, ModelIcon, ModelSelect, ModelTypeIcon, Navbar, PROVIDER_ICON_SLUGS, ProviderAvatar, ProviderIcon, ProviderIconImg, ProviderNames, ThinkingBlock, buttonVariants, getDeveloperIconPath, getIconPath, getProviderIconOptions, getProviderName, isKnownCapability, normalizeProviderId };
1347
1633
  //# sourceMappingURL=ai.js.map
1348
1634
  //# sourceMappingURL=ai.js.map