@yuhuanowo/yunui 0.2.12 → 0.2.14
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 +109 -1
- package/dist/ai.js +451 -64
- package/dist/ai.js.map +1 -1
- package/dist/{chunk-TFZKMJGF.js → chunk-GHO4RCDR.js} +5 -5
- package/dist/{chunk-TFZKMJGF.js.map → chunk-GHO4RCDR.js.map} +1 -1
- package/dist/{chunk-BO6CDGJS.js → chunk-N53PNMPJ.js} +3 -3
- package/dist/chunk-N53PNMPJ.js.map +1 -0
- package/dist/{chunk-65XAR7FY.js → chunk-VXFEANVX.js} +128 -84
- package/dist/chunk-VXFEANVX.js.map +1 -0
- package/dist/index.d.ts +24 -5
- package/dist/index.js +2 -2
- package/dist/patterns.d.ts +220 -3
- package/dist/patterns.js +468 -57
- package/dist/patterns.js.map +1 -1
- package/package.json +1 -1
- package/styles/yunui.css +161 -31
- package/dist/chunk-65XAR7FY.js.map +0 -1
- package/dist/chunk-BO6CDGJS.js.map +0 -1
package/dist/ai.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { copyToClipboard } from './chunk-
|
|
3
|
-
export { DiscordIcon, Footer, GithubIcon, InstagramIcon } from './chunk-
|
|
4
|
-
import { cn, ThemeToggle } from './chunk-
|
|
2
|
+
import { copyToClipboard } from './chunk-N53PNMPJ.js';
|
|
3
|
+
export { DiscordIcon, Footer, GithubIcon, InstagramIcon } from './chunk-N53PNMPJ.js';
|
|
4
|
+
import { cn, ThemeToggle } from './chunk-GHO4RCDR.js';
|
|
5
5
|
import { useYunUI } from './chunk-U2LNRVMI.js';
|
|
6
|
-
import { useState, useRef,
|
|
6
|
+
import { memo, useState, useRef, useMemo, useEffect } from 'react';
|
|
7
7
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
8
|
-
import {
|
|
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
|
|
|
@@ -17,7 +17,8 @@ function ThinkingBlock({ content, isStreaming, defaultOpen = false, renderConten
|
|
|
17
17
|
"button",
|
|
18
18
|
{
|
|
19
19
|
onClick: () => setIsOpen(!isOpen),
|
|
20
|
-
|
|
20
|
+
"aria-expanded": isOpen,
|
|
21
|
+
className: "w-full flex items-center gap-2 px-3 py-1.5 text-xs text-muted-foreground hover:bg-muted/50 transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",
|
|
21
22
|
children: [
|
|
22
23
|
/* @__PURE__ */ jsx("div", { className: cn(
|
|
23
24
|
"flex items-center justify-center w-5 h-5 rounded-md bg-muted text-muted-foreground",
|
|
@@ -62,12 +63,13 @@ function IDBadge({ text, truncate = true }) {
|
|
|
62
63
|
setTimeout(() => setCopied(false), 1500);
|
|
63
64
|
};
|
|
64
65
|
return /* @__PURE__ */ jsxs(
|
|
65
|
-
"
|
|
66
|
+
"button",
|
|
66
67
|
{
|
|
67
|
-
|
|
68
|
+
type: "button",
|
|
68
69
|
onClick: handleCopy,
|
|
69
|
-
className: `group/badge relative inline-flex items-center rounded-md bg-muted border border-border hover:bg-muted/70 cursor-pointer transition-colors duration-200 overflow-hidden ${truncate ? "max-w-full min-w-0" : ""}`,
|
|
70
|
+
className: `group/badge relative inline-flex items-center rounded-md bg-muted border border-border hover:bg-muted/70 cursor-pointer transition-colors duration-200 overflow-hidden outline-none focus-visible:ring-2 focus-visible:ring-ring ${truncate ? "max-w-full min-w-0" : ""}`,
|
|
70
71
|
title: t("clickToCopy", { text }),
|
|
72
|
+
"aria-label": t("clickToCopy", { text }),
|
|
71
73
|
children: [
|
|
72
74
|
/* @__PURE__ */ jsx("span", { className: `px-2 py-0.5 text-xs font-mono block ${truncate ? "truncate max-w-full min-w-0" : "whitespace-nowrap"}`, children: text }),
|
|
73
75
|
/* @__PURE__ */ jsx("span", { className: "opacity-0 group-hover/badge:opacity-100 absolute right-0 inset-y-0 w-5 flex items-center justify-center rounded-r-md bg-muted/90 backdrop-blur-sm transition-opacity duration-200", children: copied ? /* @__PURE__ */ jsx(Check, { size: 10 }) : /* @__PURE__ */ jsx(Copy, { size: 10 }) })
|
|
@@ -118,7 +120,7 @@ function ModelCard({
|
|
|
118
120
|
onClick();
|
|
119
121
|
}
|
|
120
122
|
},
|
|
121
|
-
className: `card card-interactive p-4 text-left w-full group cursor-pointer flex flex-col ${className}`,
|
|
123
|
+
className: `card card-interactive p-4 text-left w-full group cursor-pointer flex flex-col outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background ${className}`,
|
|
122
124
|
children: [
|
|
123
125
|
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between mb-3", children: [
|
|
124
126
|
icon,
|
|
@@ -130,7 +132,7 @@ function ModelCard({
|
|
|
130
132
|
/* @__PURE__ */ jsx("div", { className: "mb-2", children: /* @__PURE__ */ jsxs("div", { className: "font-medium text-sm group-hover:text-foreground flex items-center gap-1.5", children: [
|
|
131
133
|
/* @__PURE__ */ jsx("span", { className: "truncate", children: name }),
|
|
132
134
|
nonofficial && /* @__PURE__ */ jsx("span", { className: "shrink-0 text-[10px] px-1.5 py-0.5 rounded badge-warning font-medium whitespace-nowrap", children: labels?.nonofficial ?? "Unofficial" }),
|
|
133
|
-
suspended && /* @__PURE__ */ jsxs("span", { className: "shrink-0 inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded font-medium whitespace-nowrap
|
|
135
|
+
suspended && /* @__PURE__ */ jsxs("span", { className: "shrink-0 inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded badge-warning font-medium whitespace-nowrap", children: [
|
|
134
136
|
/* @__PURE__ */ jsx(PauseCircle, { size: 10 }),
|
|
135
137
|
labels?.suspended ?? "Suspended"
|
|
136
138
|
] })
|
|
@@ -139,7 +141,7 @@ function ModelCard({
|
|
|
139
141
|
/* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground line-clamp-2 mb-3 min-h-[2.5em]", children: description || /* @__PURE__ */ jsx("span", { className: "opacity-40", children: labels?.noDescription ?? "No description" }) }),
|
|
140
142
|
/* @__PURE__ */ jsxs("div", { className: "mt-auto flex flex-wrap items-center justify-between gap-x-3 gap-y-1.5 text-[11px] text-muted-foreground pt-3 border-t border-border", children: [
|
|
141
143
|
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 min-w-0", children: [
|
|
142
|
-
developer?.iconUrl && /* @__PURE__ */ jsx("div", { className: "rounded-md overflow-hidden bg-
|
|
144
|
+
developer?.iconUrl && /* @__PURE__ */ jsx("div", { className: "rounded-md overflow-hidden bg-muted", style: { width: 12, height: 12 }, children: /* @__PURE__ */ jsx(Image, { src: developer.iconUrl, alt: developer.label, width: 12, height: 12, className: "object-cover" }) }),
|
|
143
145
|
developer?.label && /* @__PURE__ */ jsx("span", { children: developer.label })
|
|
144
146
|
] }),
|
|
145
147
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
@@ -152,38 +154,386 @@ function ModelCard({
|
|
|
152
154
|
}
|
|
153
155
|
);
|
|
154
156
|
}
|
|
157
|
+
function ModelSelect({
|
|
158
|
+
options,
|
|
159
|
+
value,
|
|
160
|
+
onChange,
|
|
161
|
+
className,
|
|
162
|
+
labels,
|
|
163
|
+
pinned,
|
|
164
|
+
onTogglePin,
|
|
165
|
+
filters,
|
|
166
|
+
renderFooter
|
|
167
|
+
}) {
|
|
168
|
+
const L = {
|
|
169
|
+
placeholder: "Select a model",
|
|
170
|
+
search: "Search models\u2026",
|
|
171
|
+
clearSearch: "Clear",
|
|
172
|
+
clearFilters: "Clear filters",
|
|
173
|
+
all: "All",
|
|
174
|
+
pinned: "Pinned",
|
|
175
|
+
noResults: "No models found",
|
|
176
|
+
...labels
|
|
177
|
+
};
|
|
178
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
179
|
+
const [search, setSearch] = useState("");
|
|
180
|
+
const [activeGroup, setActiveGroup] = useState(null);
|
|
181
|
+
const [activeFilters, setActiveFilters] = useState([]);
|
|
182
|
+
const rootRef = useRef(null);
|
|
183
|
+
const inputRef = useRef(null);
|
|
184
|
+
const listRef = useRef(null);
|
|
185
|
+
const pinnedSet = useMemo(() => new Set(pinned ?? []), [pinned]);
|
|
186
|
+
useEffect(() => {
|
|
187
|
+
const onDown = (e) => {
|
|
188
|
+
if (rootRef.current && !rootRef.current.contains(e.target)) setIsOpen(false);
|
|
189
|
+
};
|
|
190
|
+
document.addEventListener("mousedown", onDown);
|
|
191
|
+
document.addEventListener("touchstart", onDown);
|
|
192
|
+
return () => {
|
|
193
|
+
document.removeEventListener("mousedown", onDown);
|
|
194
|
+
document.removeEventListener("touchstart", onDown);
|
|
195
|
+
};
|
|
196
|
+
}, []);
|
|
197
|
+
useEffect(() => {
|
|
198
|
+
if (!isOpen) return;
|
|
199
|
+
const t = setTimeout(() => {
|
|
200
|
+
inputRef.current?.focus();
|
|
201
|
+
if (value && listRef.current) {
|
|
202
|
+
const el = listRef.current.querySelector(`[data-model-id="${CSS.escape(value)}"]`);
|
|
203
|
+
el?.scrollIntoView({ block: "center" });
|
|
204
|
+
}
|
|
205
|
+
}, 50);
|
|
206
|
+
return () => clearTimeout(t);
|
|
207
|
+
}, [isOpen, value]);
|
|
208
|
+
const groups = useMemo(() => {
|
|
209
|
+
const counts = {};
|
|
210
|
+
for (const o of options) counts[o.group] = (counts[o.group] || 0) + 1;
|
|
211
|
+
return Object.entries(counts).sort((a, b) => b[1] - a[1]).map(([g]) => g);
|
|
212
|
+
}, [options]);
|
|
213
|
+
const groupLabel = useMemo(() => {
|
|
214
|
+
const m = {};
|
|
215
|
+
for (const o of options) if (o.groupLabel) m[o.group] = o.groupLabel;
|
|
216
|
+
return m;
|
|
217
|
+
}, [options]);
|
|
218
|
+
const groupIcon = useMemo(() => {
|
|
219
|
+
const m = {};
|
|
220
|
+
for (const o of options) if (o.groupIcon && !(o.group in m)) m[o.group] = o.groupIcon;
|
|
221
|
+
return m;
|
|
222
|
+
}, [options]);
|
|
223
|
+
const filtered = useMemo(() => {
|
|
224
|
+
const q = search.trim().toLowerCase();
|
|
225
|
+
return options.filter((o) => {
|
|
226
|
+
if (q) {
|
|
227
|
+
const hay = `${o.label} ${o.searchText ?? ""} ${o.group}`.toLowerCase();
|
|
228
|
+
if (!hay.includes(q)) return false;
|
|
229
|
+
}
|
|
230
|
+
if (activeGroup && o.group !== activeGroup) return false;
|
|
231
|
+
if (activeFilters.length && filters) {
|
|
232
|
+
const fs = filters.filter((f) => activeFilters.includes(f.key));
|
|
233
|
+
if (!fs.every((f) => f.match(o))) return false;
|
|
234
|
+
}
|
|
235
|
+
return true;
|
|
236
|
+
});
|
|
237
|
+
}, [options, search, activeGroup, activeFilters, filters]);
|
|
238
|
+
const pinnedList = filtered.filter((o) => pinnedSet.has(o.id));
|
|
239
|
+
const grouped = useMemo(() => {
|
|
240
|
+
const acc = {};
|
|
241
|
+
for (const o of filtered) {
|
|
242
|
+
if (pinnedSet.has(o.id)) continue;
|
|
243
|
+
(acc[o.group] ??= []).push(o);
|
|
244
|
+
}
|
|
245
|
+
return acc;
|
|
246
|
+
}, [filtered, pinnedSet]);
|
|
247
|
+
const selected = options.find((o) => o.id === value);
|
|
248
|
+
const onWheel = (e) => {
|
|
249
|
+
const el = e.currentTarget;
|
|
250
|
+
const atTop = el.scrollTop <= 1;
|
|
251
|
+
const atBottom = el.scrollTop + el.clientHeight >= el.scrollHeight - 1;
|
|
252
|
+
if (atTop && e.deltaY < 0 || atBottom && e.deltaY > 0) e.preventDefault();
|
|
253
|
+
};
|
|
254
|
+
const select = (id) => {
|
|
255
|
+
onChange(id);
|
|
256
|
+
setIsOpen(false);
|
|
257
|
+
};
|
|
258
|
+
const flatOptions = useMemo(() => {
|
|
259
|
+
const out = [...pinnedList];
|
|
260
|
+
for (const opts of Object.values(grouped)) out.push(...opts);
|
|
261
|
+
return out;
|
|
262
|
+
}, [pinnedList, grouped]);
|
|
263
|
+
const [activeIndex, setActiveIndex] = useState(-1);
|
|
264
|
+
useEffect(() => {
|
|
265
|
+
setActiveIndex(-1);
|
|
266
|
+
}, [isOpen, search, activeGroup, activeFilters]);
|
|
267
|
+
const clearActiveOnPointer = () => setActiveIndex((i) => i === -1 ? i : -1);
|
|
268
|
+
useEffect(() => {
|
|
269
|
+
const id = flatOptions[activeIndex]?.id;
|
|
270
|
+
if (!isOpen || !id || !listRef.current) return;
|
|
271
|
+
listRef.current.querySelector(`[data-model-id="${CSS.escape(id)}"]`)?.scrollIntoView({ block: "nearest" });
|
|
272
|
+
}, [activeIndex, isOpen, flatOptions]);
|
|
273
|
+
const activeId = flatOptions[activeIndex]?.id;
|
|
274
|
+
const rowDomId = (id) => `yunui-ms-opt-${id.replace(/[^a-zA-Z0-9_-]/g, "_")}`;
|
|
275
|
+
const onSearchKeyDown = (e) => {
|
|
276
|
+
if (e.key === "ArrowDown") {
|
|
277
|
+
e.preventDefault();
|
|
278
|
+
setActiveIndex((i) => Math.min(i + 1, flatOptions.length - 1));
|
|
279
|
+
} else if (e.key === "ArrowUp") {
|
|
280
|
+
e.preventDefault();
|
|
281
|
+
setActiveIndex((i) => i < 0 ? flatOptions.length - 1 : Math.max(i - 1, 0));
|
|
282
|
+
} else if (e.key === "Enter") {
|
|
283
|
+
e.preventDefault();
|
|
284
|
+
const o = flatOptions[activeIndex] ?? flatOptions[0];
|
|
285
|
+
if (o) select(o.id);
|
|
286
|
+
} else if (e.key === "Escape") {
|
|
287
|
+
e.preventDefault();
|
|
288
|
+
setIsOpen(false);
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
return (
|
|
292
|
+
// Fixed-width root so the trigger doesn't grow/shrink as the selected
|
|
293
|
+
// label changes; override the width via `className`.
|
|
294
|
+
/* @__PURE__ */ jsxs("div", { ref: rootRef, className: cn("relative w-64", className), children: [
|
|
295
|
+
/* @__PURE__ */ jsxs(
|
|
296
|
+
"button",
|
|
297
|
+
{
|
|
298
|
+
type: "button",
|
|
299
|
+
onClick: () => setIsOpen((o) => !o),
|
|
300
|
+
"aria-expanded": isOpen,
|
|
301
|
+
"aria-haspopup": "listbox",
|
|
302
|
+
className: cn(
|
|
303
|
+
"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 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
304
|
+
isOpen ? "border-ring/60 ring-2 ring-ring/25" : "border-border hover:border-ring"
|
|
305
|
+
),
|
|
306
|
+
children: [
|
|
307
|
+
selected ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
308
|
+
selected.icon,
|
|
309
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1 truncate text-sm font-medium", children: selected.label })
|
|
310
|
+
] }) : /* @__PURE__ */ jsx("span", { className: "flex-1 text-sm text-muted-foreground", children: L.placeholder }),
|
|
311
|
+
/* @__PURE__ */ jsx(ChevronDown, { size: 14, className: cn("text-muted-foreground transition-transform shrink-0", isOpen && "rotate-180") })
|
|
312
|
+
]
|
|
313
|
+
}
|
|
314
|
+
),
|
|
315
|
+
isOpen && /* @__PURE__ */ jsxs(
|
|
316
|
+
motion.div,
|
|
317
|
+
{
|
|
318
|
+
initial: { opacity: 0, y: -8, scale: 0.96 },
|
|
319
|
+
animate: { opacity: 1, y: 0, scale: 1 },
|
|
320
|
+
transition: { duration: 0.16, ease: "easeOut" },
|
|
321
|
+
style: { maxWidth: "calc(100vw - 1rem)" },
|
|
322
|
+
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",
|
|
323
|
+
children: [
|
|
324
|
+
/* @__PURE__ */ jsxs("div", { className: "p-2.5 border-b border-border/50", children: [
|
|
325
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
326
|
+
/* @__PURE__ */ jsx(Search, { size: 15, className: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none" }),
|
|
327
|
+
/* @__PURE__ */ jsx(
|
|
328
|
+
"input",
|
|
329
|
+
{
|
|
330
|
+
ref: inputRef,
|
|
331
|
+
value: search,
|
|
332
|
+
onChange: (e) => setSearch(e.target.value),
|
|
333
|
+
onKeyDown: onSearchKeyDown,
|
|
334
|
+
placeholder: L.search,
|
|
335
|
+
role: "combobox",
|
|
336
|
+
"aria-expanded": isOpen,
|
|
337
|
+
"aria-controls": "yunui-ms-listbox",
|
|
338
|
+
"aria-activedescendant": activeId ? rowDomId(activeId) : void 0,
|
|
339
|
+
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"
|
|
340
|
+
}
|
|
341
|
+
),
|
|
342
|
+
search && /* @__PURE__ */ jsx("button", { type: "button", onClick: () => setSearch(""), title: L.clearSearch, "aria-label": 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 outline-none focus-visible:ring-2 focus-visible:ring-ring", children: /* @__PURE__ */ jsx(X, { size: 13 }) })
|
|
343
|
+
] }),
|
|
344
|
+
filters && filters.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 mt-2 px-1", children: [
|
|
345
|
+
filters.map((f) => {
|
|
346
|
+
const on = activeFilters.includes(f.key);
|
|
347
|
+
return /* @__PURE__ */ jsx("button", { type: "button", title: f.title, "aria-label": f.title, "aria-pressed": on, onClick: () => setActiveFilters((p) => p.includes(f.key) ? p.filter((k) => k !== f.key) : [...p, f.key]), className: cn("p-1 rounded-md transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring", on ? "bg-foreground/10" : "hover:bg-muted"), children: f.node }, f.key);
|
|
348
|
+
}),
|
|
349
|
+
activeFilters.length > 0 && /* @__PURE__ */ jsx("button", { type: "button", onClick: () => setActiveFilters([]), title: L.clearFilters, "aria-label": L.clearFilters, className: "p-1 rounded-md text-muted-foreground hover:bg-muted outline-none focus-visible:ring-2 focus-visible:ring-ring", children: /* @__PURE__ */ jsx(X, { size: 14 }) })
|
|
350
|
+
] })
|
|
351
|
+
] }),
|
|
352
|
+
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: [
|
|
353
|
+
/* @__PURE__ */ jsxs("button", { type: "button", onClick: () => setActiveGroup(null), "aria-pressed": !activeGroup, className: cn("px-2.5 py-1.5 text-xs rounded-lg font-medium transition-colors whitespace-nowrap outline-none focus-visible:ring-2 focus-visible:ring-ring", !activeGroup ? "bg-foreground text-background" : "bg-muted text-muted-foreground hover:bg-muted/80"), children: [
|
|
354
|
+
L.all,
|
|
355
|
+
" (",
|
|
356
|
+
options.length,
|
|
357
|
+
")"
|
|
358
|
+
] }),
|
|
359
|
+
groups.map((g) => /* @__PURE__ */ jsxs("button", { type: "button", onClick: () => setActiveGroup((c) => c === g ? null : g), "aria-pressed": activeGroup === 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 outline-none focus-visible:ring-2 focus-visible:ring-ring", activeGroup === g ? "bg-foreground text-background" : "bg-muted text-muted-foreground hover:bg-muted/80"), children: [
|
|
360
|
+
groupIcon[g],
|
|
361
|
+
groupLabel[g] ?? g
|
|
362
|
+
] }, g))
|
|
363
|
+
] }) }),
|
|
364
|
+
/* @__PURE__ */ jsxs("div", { ref: listRef, onWheel, onMouseMove: clearActiveOnPointer, id: "yunui-ms-listbox", role: "listbox", className: "max-h-96 overflow-y-auto overscroll-contain", children: [
|
|
365
|
+
pinnedList.length > 0 && /* @__PURE__ */ jsxs("div", { className: "px-1.5 py-1.5 border-b border-border/40", children: [
|
|
366
|
+
/* @__PURE__ */ jsxs("div", { className: "text-[10px] font-medium text-muted-foreground uppercase tracking-wide px-2 mb-1 flex items-center gap-1", children: [
|
|
367
|
+
/* @__PURE__ */ jsx(Pin, { size: 9 }),
|
|
368
|
+
" ",
|
|
369
|
+
L.pinned
|
|
370
|
+
] }),
|
|
371
|
+
pinnedList.map((o) => /* @__PURE__ */ jsx(ModelRow, { domId: rowDomId(o.id), active: o.id === activeId, option: o, selected: o.id === value, pinned: true, isPinnable: !!onTogglePin, onSelect: () => select(o.id), onTogglePin: () => onTogglePin?.(o.id) }, o.id))
|
|
372
|
+
] }),
|
|
373
|
+
/* @__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: [
|
|
374
|
+
/* @__PURE__ */ jsx("div", { className: "sticky top-0 z-10 pt-1 pb-1.5", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 rounded-xl bg-muted px-3 py-2", children: [
|
|
375
|
+
groupIcon[g],
|
|
376
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-semibold", children: groupLabel[g] ?? g }),
|
|
377
|
+
/* @__PURE__ */ jsx("span", { className: "ml-auto shrink-0 min-w-5 text-center text-[10px] font-semibold tabular-nums text-muted-foreground bg-foreground/10 px-1.5 py-0.5 rounded-md", children: opts.length })
|
|
378
|
+
] }) }),
|
|
379
|
+
opts.map((o) => /* @__PURE__ */ jsx(ModelRow, { domId: rowDomId(o.id), active: o.id === activeId, option: o, selected: o.id === value, pinned: false, isPinnable: !!onTogglePin, onSelect: () => select(o.id), onTogglePin: () => onTogglePin?.(o.id) }, o.id))
|
|
380
|
+
] }, g)) }),
|
|
381
|
+
filtered.length === 0 && /* @__PURE__ */ jsxs("div", { className: "py-12 text-center text-muted-foreground", children: [
|
|
382
|
+
/* @__PURE__ */ jsx(Sparkles, { size: 28, className: "mx-auto mb-3 opacity-40" }),
|
|
383
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm", children: L.noResults })
|
|
384
|
+
] })
|
|
385
|
+
] }),
|
|
386
|
+
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) })
|
|
387
|
+
]
|
|
388
|
+
}
|
|
389
|
+
)
|
|
390
|
+
] })
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
var ModelRow = memo(function ModelRow2({
|
|
394
|
+
option,
|
|
395
|
+
selected,
|
|
396
|
+
active,
|
|
397
|
+
domId,
|
|
398
|
+
pinned,
|
|
399
|
+
isPinnable,
|
|
400
|
+
onSelect,
|
|
401
|
+
onTogglePin
|
|
402
|
+
}) {
|
|
403
|
+
return /* @__PURE__ */ jsxs(
|
|
404
|
+
"div",
|
|
405
|
+
{
|
|
406
|
+
id: domId,
|
|
407
|
+
"data-model-id": option.id,
|
|
408
|
+
role: "option",
|
|
409
|
+
"aria-selected": selected,
|
|
410
|
+
onClick: onSelect,
|
|
411
|
+
className: cn(
|
|
412
|
+
"relative flex items-center gap-3 px-3 py-2.5 rounded-xl cursor-pointer group transition-colors",
|
|
413
|
+
// A clear gray fill on both states (selected solid, hover lighter)
|
|
414
|
+
// — the bar's opacity then tells selected from merely-hovered.
|
|
415
|
+
selected ? "bg-muted" : "hover:bg-muted",
|
|
416
|
+
// keyboard highlight (arrow-key navigation)
|
|
417
|
+
active && "bg-muted ring-2 ring-ring/40"
|
|
418
|
+
),
|
|
419
|
+
children: [
|
|
420
|
+
/* @__PURE__ */ jsx(
|
|
421
|
+
"div",
|
|
422
|
+
{
|
|
423
|
+
className: cn(
|
|
424
|
+
"absolute left-0 top-1/2 w-1 h-6 rounded-full bg-primary transition-all duration-150 -translate-y-1/2",
|
|
425
|
+
selected ? "opacity-100 translate-x-0" : "opacity-0 -translate-x-1.5 group-hover:opacity-50 group-hover:translate-x-0"
|
|
426
|
+
)
|
|
427
|
+
}
|
|
428
|
+
),
|
|
429
|
+
option.icon,
|
|
430
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
431
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
432
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium truncate", children: option.label }),
|
|
433
|
+
option.badges
|
|
434
|
+
] }),
|
|
435
|
+
option.detail
|
|
436
|
+
] }),
|
|
437
|
+
option.meta && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1 shrink-0", children: option.meta }),
|
|
438
|
+
isPinnable && /* @__PURE__ */ jsx(
|
|
439
|
+
"button",
|
|
440
|
+
{
|
|
441
|
+
type: "button",
|
|
442
|
+
onClick: (e) => {
|
|
443
|
+
e.stopPropagation();
|
|
444
|
+
onTogglePin();
|
|
445
|
+
},
|
|
446
|
+
className: cn(
|
|
447
|
+
"p-1.5 rounded-md transition-all shrink-0 lg:opacity-0 lg:group-hover:opacity-100",
|
|
448
|
+
pinned ? "text-foreground opacity-100 hover:bg-muted/50" : "text-muted-foreground/40 opacity-60 hover:text-foreground/70 hover:bg-muted/50"
|
|
449
|
+
),
|
|
450
|
+
"aria-label": pinned ? "Unpin" : "Pin",
|
|
451
|
+
children: /* @__PURE__ */ jsx(Pin, { size: 14, className: pinned ? "fill-current" : "" })
|
|
452
|
+
}
|
|
453
|
+
)
|
|
454
|
+
]
|
|
455
|
+
}
|
|
456
|
+
);
|
|
457
|
+
});
|
|
458
|
+
function ModelManagerCard({
|
|
459
|
+
icon,
|
|
460
|
+
name,
|
|
461
|
+
nameBadges,
|
|
462
|
+
ids,
|
|
463
|
+
selectSlot,
|
|
464
|
+
actions,
|
|
465
|
+
fields,
|
|
466
|
+
capabilities,
|
|
467
|
+
selected,
|
|
468
|
+
className
|
|
469
|
+
}) {
|
|
470
|
+
return /* @__PURE__ */ jsxs(
|
|
471
|
+
"div",
|
|
472
|
+
{
|
|
473
|
+
className: cn(
|
|
474
|
+
"card p-5 transition-shadow hover:shadow-md",
|
|
475
|
+
selected && "ring-2 ring-primary/40 bg-muted/30",
|
|
476
|
+
className
|
|
477
|
+
),
|
|
478
|
+
children: [
|
|
479
|
+
(selectSlot || actions) && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 -mt-2 mb-3 min-h-7", children: [
|
|
480
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center", children: selectSlot }),
|
|
481
|
+
actions && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-0.5 -mr-1.5 text-muted-foreground", children: actions })
|
|
482
|
+
] }),
|
|
483
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
|
|
484
|
+
icon && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: icon }),
|
|
485
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
486
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2 gap-y-1 flex-wrap", children: [
|
|
487
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold leading-tight min-w-0 break-words", children: name }),
|
|
488
|
+
nameBadges
|
|
489
|
+
] }),
|
|
490
|
+
ids && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center gap-1 mt-1.5", children: ids })
|
|
491
|
+
] })
|
|
492
|
+
] }),
|
|
493
|
+
fields && fields.length > 0 && /* @__PURE__ */ jsx("dl", { className: "grid grid-cols-2 gap-x-4 gap-y-3 mt-4 text-sm", children: fields.map((f, i) => /* @__PURE__ */ jsxs("div", { className: cn("min-w-0", f.full && "col-span-2"), children: [
|
|
494
|
+
/* @__PURE__ */ jsx("dt", { className: "text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: f.label }),
|
|
495
|
+
/* @__PURE__ */ jsx("dd", { className: "mt-1", children: f.value })
|
|
496
|
+
] }, i)) }),
|
|
497
|
+
capabilities && /* @__PURE__ */ jsxs("div", { className: "mt-4", children: [
|
|
498
|
+
capabilities.label && /* @__PURE__ */ jsx("div", { className: "text-[10px] font-medium uppercase tracking-wide text-muted-foreground mb-1.5", children: capabilities.label }),
|
|
499
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1.5", children: capabilities.value })
|
|
500
|
+
] })
|
|
501
|
+
]
|
|
502
|
+
}
|
|
503
|
+
);
|
|
504
|
+
}
|
|
155
505
|
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" }
|
|
506
|
+
{ 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" },
|
|
507
|
+
{ 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" },
|
|
508
|
+
{ 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" },
|
|
509
|
+
{ 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" },
|
|
510
|
+
{ 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
511
|
];
|
|
162
512
|
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" }
|
|
513
|
+
{ 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" },
|
|
514
|
+
{ 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" },
|
|
515
|
+
{ 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" },
|
|
516
|
+
{ 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" },
|
|
517
|
+
{ 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" },
|
|
518
|
+
{ 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" },
|
|
519
|
+
{ 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
520
|
];
|
|
171
521
|
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" }
|
|
522
|
+
{ 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" },
|
|
523
|
+
{ 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" },
|
|
524
|
+
{ 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
525
|
];
|
|
176
526
|
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" }
|
|
527
|
+
{ 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
528
|
];
|
|
179
529
|
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" }
|
|
530
|
+
{ 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
531
|
];
|
|
182
532
|
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" }
|
|
533
|
+
{ 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
534
|
];
|
|
185
535
|
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" }
|
|
536
|
+
{ 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
537
|
];
|
|
188
538
|
function CapabilitySelector({ selected, onChange, disabled = false, size = "md", columns = 4, modelType }) {
|
|
189
539
|
const t = useYunUI().useT("capabilities");
|
|
@@ -230,11 +580,11 @@ function CapabilitySelector({ selected, onChange, disabled = false, size = "md",
|
|
|
230
580
|
const gridColsClass = {
|
|
231
581
|
1: "grid-cols-1",
|
|
232
582
|
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";
|
|
583
|
+
3: "grid-cols-2 sm:grid-cols-3",
|
|
584
|
+
4: "grid-cols-2 sm:grid-cols-4",
|
|
585
|
+
5: "grid-cols-2 sm:grid-cols-3 lg:grid-cols-5",
|
|
586
|
+
6: "grid-cols-2 sm:grid-cols-3 lg:grid-cols-6"
|
|
587
|
+
}[columns] || "grid-cols-2 sm:grid-cols-3";
|
|
238
588
|
return /* @__PURE__ */ jsx("div", { className: `grid ${gridColsClass} gap-2`, children: capabilityOptions.map((cap) => {
|
|
239
589
|
const isSelected = selected.includes(cap.value);
|
|
240
590
|
const Icon = cap.icon;
|
|
@@ -244,7 +594,8 @@ function CapabilitySelector({ selected, onChange, disabled = false, size = "md",
|
|
|
244
594
|
type: "button",
|
|
245
595
|
onClick: () => toggleCapability(cap.value),
|
|
246
596
|
disabled,
|
|
247
|
-
|
|
597
|
+
"aria-pressed": isSelected,
|
|
598
|
+
className: `rounded-lg border text-left transition-colors flex items-center outline-none focus-visible:ring-2 focus-visible:ring-ring ${sizeClasses} ${isSelected ? cap.color : "bg-background border-border hover:bg-muted/50"} ${disabled ? "opacity-50 cursor-not-allowed" : ""}`,
|
|
248
599
|
children: [
|
|
249
600
|
/* @__PURE__ */ jsx(Icon, { size: iconSize, className: `${isSelected ? "" : cap.iconColor} shrink-0` }),
|
|
250
601
|
/* @__PURE__ */ jsx("span", { className: "font-medium", children: cap.label })
|
|
@@ -254,6 +605,30 @@ function CapabilitySelector({ selected, onChange, disabled = false, size = "md",
|
|
|
254
605
|
);
|
|
255
606
|
}) });
|
|
256
607
|
}
|
|
608
|
+
var CAPABILITY_BY_KEY = Object.fromEntries(
|
|
609
|
+
[
|
|
610
|
+
...llmCapabilityConfig,
|
|
611
|
+
...imageCapabilityConfig,
|
|
612
|
+
...audioCapabilityConfig,
|
|
613
|
+
...videoCapabilityConfig,
|
|
614
|
+
...musicCapabilityConfig,
|
|
615
|
+
...threedCapabilityConfig,
|
|
616
|
+
...realtimeCapabilityConfig
|
|
617
|
+
].map((c) => [c.value, c])
|
|
618
|
+
);
|
|
619
|
+
function isKnownCapability(capability) {
|
|
620
|
+
return capability in CAPABILITY_BY_KEY;
|
|
621
|
+
}
|
|
622
|
+
function CapabilityIcon({
|
|
623
|
+
capability,
|
|
624
|
+
size = 14,
|
|
625
|
+
className
|
|
626
|
+
}) {
|
|
627
|
+
const cfg = CAPABILITY_BY_KEY[capability];
|
|
628
|
+
if (!cfg) return null;
|
|
629
|
+
const Icon = cfg.icon;
|
|
630
|
+
return /* @__PURE__ */ jsx(Icon, { size, className: cn(cfg.iconColor, "shrink-0", className) });
|
|
631
|
+
}
|
|
257
632
|
|
|
258
633
|
// src/ai/icon-slugs.generated.ts
|
|
259
634
|
var PROVIDER_ICON_SLUGS = /* @__PURE__ */ new Set([
|
|
@@ -684,10 +1059,10 @@ var providerIconMap = {
|
|
|
684
1059
|
grok: "grok.webp",
|
|
685
1060
|
xai: "grok.webp",
|
|
686
1061
|
// Cloud providers
|
|
687
|
-
azure: "
|
|
688
|
-
"azure-openai": "
|
|
689
|
-
aws: "
|
|
690
|
-
bedrock: "
|
|
1062
|
+
azure: "azure.webp",
|
|
1063
|
+
"azure-openai": "azure.webp",
|
|
1064
|
+
aws: "aws.webp",
|
|
1065
|
+
bedrock: "bedrock.webp",
|
|
691
1066
|
// Chinese providers
|
|
692
1067
|
zhipu: "zhipu.webp",
|
|
693
1068
|
moonshot: "moonshot.webp",
|
|
@@ -812,7 +1187,7 @@ function ProviderIcon({
|
|
|
812
1187
|
return /* @__PURE__ */ jsx(
|
|
813
1188
|
"div",
|
|
814
1189
|
{
|
|
815
|
-
className: `${getRadius()} overflow-hidden bg-
|
|
1190
|
+
className: `${getRadius()} overflow-hidden bg-muted flex items-center justify-center ${className}`,
|
|
816
1191
|
style: { width: size, height: size },
|
|
817
1192
|
children: /* @__PURE__ */ jsx("img", { src: effectiveIconUrl, alt: provider, width: size, height: size, className: "object-cover", onError: () => setCustomError(true) })
|
|
818
1193
|
}
|
|
@@ -831,7 +1206,7 @@ function ProviderIcon({
|
|
|
831
1206
|
return /* @__PURE__ */ jsx(
|
|
832
1207
|
"div",
|
|
833
1208
|
{
|
|
834
|
-
className: `${getRadiusClass()} overflow-hidden bg-
|
|
1209
|
+
className: `${getRadiusClass()} overflow-hidden bg-muted flex items-center justify-center ${className}`,
|
|
835
1210
|
style: { width: size, height: size },
|
|
836
1211
|
children: /* @__PURE__ */ jsx(
|
|
837
1212
|
Image,
|
|
@@ -865,7 +1240,7 @@ function ProviderIcon({
|
|
|
865
1240
|
return /* @__PURE__ */ jsx(
|
|
866
1241
|
"div",
|
|
867
1242
|
{
|
|
868
|
-
className: `${getRadiusClass()} bg-
|
|
1243
|
+
className: `${getRadiusClass()} bg-muted flex items-center justify-center ${className}`,
|
|
869
1244
|
style: { width: size, height: size },
|
|
870
1245
|
children: /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: (provider || "?").charAt(0).toUpperCase() })
|
|
871
1246
|
}
|
|
@@ -905,10 +1280,10 @@ var ProviderNames = {
|
|
|
905
1280
|
xai: "xAI",
|
|
906
1281
|
grok: "Grok",
|
|
907
1282
|
groq: "Groq",
|
|
908
|
-
azure: "
|
|
909
|
-
"azure-openai": "
|
|
910
|
-
aws: "
|
|
911
|
-
bedrock: "
|
|
1283
|
+
azure: "Azure",
|
|
1284
|
+
"azure-openai": "Azure OpenAI",
|
|
1285
|
+
aws: "AWS",
|
|
1286
|
+
bedrock: "Bedrock",
|
|
912
1287
|
nvidia: "NVIDIA",
|
|
913
1288
|
zhipu: "Zhipu",
|
|
914
1289
|
moonshot: "Moonshot",
|
|
@@ -1014,7 +1389,7 @@ function ModelIcon({
|
|
|
1014
1389
|
return /* @__PURE__ */ jsx(
|
|
1015
1390
|
"div",
|
|
1016
1391
|
{
|
|
1017
|
-
className: `${getRadiusClass()} overflow-hidden bg-
|
|
1392
|
+
className: `${getRadiusClass()} overflow-hidden bg-muted flex items-center justify-center ${className}`,
|
|
1018
1393
|
style: { width: size, height: size },
|
|
1019
1394
|
children: /* @__PURE__ */ jsx(
|
|
1020
1395
|
Image,
|
|
@@ -1053,7 +1428,7 @@ function ModelIcon({
|
|
|
1053
1428
|
return /* @__PURE__ */ jsx(
|
|
1054
1429
|
"div",
|
|
1055
1430
|
{
|
|
1056
|
-
className: `${getRadiusClass()} overflow-hidden bg-
|
|
1431
|
+
className: `${getRadiusClass()} overflow-hidden bg-muted flex items-center justify-center ${className}`,
|
|
1057
1432
|
style: { width: size, height: size },
|
|
1058
1433
|
children: /* @__PURE__ */ jsx(
|
|
1059
1434
|
Image,
|
|
@@ -1175,25 +1550,29 @@ function LanguageSwitcher({
|
|
|
1175
1550
|
"button",
|
|
1176
1551
|
{
|
|
1177
1552
|
onClick: () => setIsOpen(!isOpen),
|
|
1178
|
-
className: "flex items-center gap-1.5 h-9 px-3 rounded-full text-sm font-medium transition-all bg-(--bg-elevated) hover:bg-(--bg-elevated)/80 border border-(--border-hairline) text-(--text-secondary) hover:text-(--text-primary) disabled:opacity-50",
|
|
1553
|
+
className: "flex items-center gap-1.5 h-9 px-2.5 sm:px-3 rounded-full text-sm font-medium transition-all bg-(--bg-elevated) hover:bg-(--bg-elevated)/80 border border-(--border-hairline) text-(--text-secondary) hover:text-(--text-primary) disabled:opacity-50 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
1179
1554
|
disabled: pending,
|
|
1180
1555
|
"aria-label": label,
|
|
1556
|
+
"aria-expanded": isOpen,
|
|
1557
|
+
"aria-haspopup": "listbox",
|
|
1181
1558
|
children: [
|
|
1182
|
-
/* @__PURE__ */ jsx(Globe, { size: 14 }),
|
|
1183
|
-
/* @__PURE__ */ jsx("span", { children: currentLabel })
|
|
1559
|
+
/* @__PURE__ */ jsx(Globe, { size: 14, className: "shrink-0" }),
|
|
1560
|
+
/* @__PURE__ */ jsx("span", { className: "hidden sm:inline", children: currentLabel })
|
|
1184
1561
|
]
|
|
1185
1562
|
}
|
|
1186
1563
|
) : /* @__PURE__ */ jsx(
|
|
1187
1564
|
"button",
|
|
1188
1565
|
{
|
|
1189
1566
|
onClick: () => setIsOpen(!isOpen),
|
|
1190
|
-
className: "w-9 h-9 rounded-lg flex items-center justify-center hover:bg-foreground/5 transition-colors disabled:opacity-50",
|
|
1567
|
+
className: "w-9 h-9 rounded-lg flex items-center justify-center hover:bg-foreground/5 transition-colors disabled:opacity-50 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
1191
1568
|
disabled: pending,
|
|
1192
1569
|
"aria-label": label,
|
|
1570
|
+
"aria-expanded": isOpen,
|
|
1571
|
+
"aria-haspopup": "listbox",
|
|
1193
1572
|
children: /* @__PURE__ */ jsx(Globe, { className: "h-[1.2rem] w-[1.2rem]" })
|
|
1194
1573
|
}
|
|
1195
1574
|
),
|
|
1196
|
-
isOpen && /* @__PURE__ */ jsx("div", { className: `absolute ${align === "left" ? "left-0" : "right-0"} top-full mt-2 z-50 rounded-2xl border border-
|
|
1575
|
+
isOpen && /* @__PURE__ */ jsx("div", { className: `absolute ${align === "left" ? "left-0" : "right-0"} top-full mt-2 z-50 rounded-2xl border border-border bg-background/60 backdrop-blur-2xl text-popover-foreground shadow-lg shadow-black/5 animate-in fade-in-0 zoom-in-95 duration-200`, children: /* @__PURE__ */ jsx("div", { className: "p-1", children: locales.map((lang) => /* @__PURE__ */ jsx(
|
|
1197
1576
|
"button",
|
|
1198
1577
|
{
|
|
1199
1578
|
onClick: () => handleLocaleChange(lang.value),
|
|
@@ -1281,26 +1660,23 @@ function Navbar({
|
|
|
1281
1660
|
link.href
|
|
1282
1661
|
)) }),
|
|
1283
1662
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 shrink-0", children: [
|
|
1284
|
-
languageSwitcher,
|
|
1663
|
+
/* @__PURE__ */ jsx("span", { className: "hidden md:flex items-center gap-1.5", children: languageSwitcher }),
|
|
1285
1664
|
themeToggle ?? /* @__PURE__ */ jsx(ThemeToggle, { variant: "pill" }),
|
|
1286
1665
|
variant !== "minimal" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1287
1666
|
/* @__PURE__ */ jsx(
|
|
1288
1667
|
Link,
|
|
1289
1668
|
{
|
|
1290
1669
|
href: loginHref,
|
|
1291
|
-
className: "hidden
|
|
1670
|
+
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
1671
|
children: signIn
|
|
1293
1672
|
}
|
|
1294
1673
|
),
|
|
1295
|
-
/* @__PURE__ */
|
|
1674
|
+
/* @__PURE__ */ jsx(
|
|
1296
1675
|
Link,
|
|
1297
1676
|
{
|
|
1298
1677
|
href: signupHref,
|
|
1299
|
-
className: "
|
|
1300
|
-
children:
|
|
1301
|
-
/* @__PURE__ */ jsx("span", { className: "hidden sm:inline", children: signUp }),
|
|
1302
|
-
/* @__PURE__ */ jsx("span", { className: "sm:hidden", children: "Sign Up" })
|
|
1303
|
-
]
|
|
1678
|
+
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",
|
|
1679
|
+
children: signUp
|
|
1304
1680
|
}
|
|
1305
1681
|
)
|
|
1306
1682
|
] }),
|
|
@@ -1329,6 +1705,8 @@ function Navbar({
|
|
|
1329
1705
|
},
|
|
1330
1706
|
link.href
|
|
1331
1707
|
)),
|
|
1708
|
+
/* @__PURE__ */ jsx("div", { className: "my-1 border-t border-border" }),
|
|
1709
|
+
languageSwitcher && /* @__PURE__ */ jsx("div", { className: "px-2 py-1.5", children: languageSwitcher }),
|
|
1332
1710
|
/* @__PURE__ */ jsx(
|
|
1333
1711
|
Link,
|
|
1334
1712
|
{
|
|
@@ -1337,12 +1715,21 @@ function Navbar({
|
|
|
1337
1715
|
className: "px-4 py-2.5 rounded-xl text-sm text-muted-foreground transition-colors hover:bg-foreground/5",
|
|
1338
1716
|
children: signIn
|
|
1339
1717
|
}
|
|
1718
|
+
),
|
|
1719
|
+
/* @__PURE__ */ jsx(
|
|
1720
|
+
Link,
|
|
1721
|
+
{
|
|
1722
|
+
href: signupHref,
|
|
1723
|
+
onClick: () => setMenuOpen(false),
|
|
1724
|
+
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",
|
|
1725
|
+
children: signUp
|
|
1726
|
+
}
|
|
1340
1727
|
)
|
|
1341
1728
|
] })
|
|
1342
1729
|
] })
|
|
1343
1730
|
] });
|
|
1344
1731
|
}
|
|
1345
1732
|
|
|
1346
|
-
export { CapabilitySelector, IDBadge, LanguageSwitcher, ModelAvatar, ModelCard, ModelIcon, ModelTypeIcon, Navbar, ProviderAvatar, ProviderIcon, ProviderIconImg, ProviderNames, ThinkingBlock, buttonVariants, getDeveloperIconPath, getIconPath, getProviderIconOptions, getProviderName, normalizeProviderId };
|
|
1733
|
+
export { CapabilityIcon, CapabilitySelector, IDBadge, LanguageSwitcher, ModelAvatar, ModelCard, ModelIcon, ModelManagerCard, ModelSelect, ModelTypeIcon, Navbar, PROVIDER_ICON_SLUGS, ProviderAvatar, ProviderIcon, ProviderIconImg, ProviderNames, ThinkingBlock, buttonVariants, getDeveloperIconPath, getIconPath, getProviderIconOptions, getProviderName, isKnownCapability, normalizeProviderId };
|
|
1347
1734
|
//# sourceMappingURL=ai.js.map
|
|
1348
1735
|
//# sourceMappingURL=ai.js.map
|