@yuhuanowo/yunui 0.1.4
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/LICENSE +201 -0
- package/README.md +104 -0
- package/dist/adapters.d.ts +46 -0
- package/dist/adapters.js +4 -0
- package/dist/adapters.js.map +1 -0
- package/dist/ai.d.ts +192 -0
- package/dist/ai.js +1013 -0
- package/dist/ai.js.map +1 -0
- package/dist/chunk-DRZ7UCRU.js +85 -0
- package/dist/chunk-DRZ7UCRU.js.map +1 -0
- package/dist/chunk-OHIFY64L.js +1839 -0
- package/dist/chunk-OHIFY64L.js.map +1 -0
- package/dist/chunk-WASCOOVD.js +29 -0
- package/dist/chunk-WASCOOVD.js.map +1 -0
- package/dist/chunk-XZGNL5A6.js +66 -0
- package/dist/chunk-XZGNL5A6.js.map +1 -0
- package/dist/index.d.ts +510 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/patterns.d.ts +311 -0
- package/dist/patterns.js +1031 -0
- package/dist/patterns.js.map +1 -0
- package/package.json +77 -0
- package/styles/yunui.css +2251 -0
package/dist/ai.js
ADDED
|
@@ -0,0 +1,1013 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { copyToClipboard } from './chunk-WASCOOVD.js';
|
|
3
|
+
import { cn, ThemeToggle } from './chunk-DRZ7UCRU.js';
|
|
4
|
+
import { useYunUI } from './chunk-XZGNL5A6.js';
|
|
5
|
+
import { useState, useRef, useEffect, useMemo } from 'react';
|
|
6
|
+
import { AnimatePresence, motion } from 'framer-motion';
|
|
7
|
+
import { Brain, ChevronUp, ChevronDown, Check, Copy, Waves, SlidersHorizontal, Layers, Fingerprint, Ban, Image, Code, Eye, PauseCircle, Globe, X, Menu, MessageSquare, Radio, Box, Music, Video, Mic, Pencil } from 'lucide-react';
|
|
8
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
9
|
+
|
|
10
|
+
function ThinkingBlock({ content, isStreaming, defaultOpen = false, renderContent }) {
|
|
11
|
+
const t = useYunUI().useT("common.thinking");
|
|
12
|
+
const [isOpen, setIsOpen] = useState(defaultOpen);
|
|
13
|
+
return /* @__PURE__ */ jsxs("div", { className: "my-2 rounded-xl border border-border bg-muted/30 overflow-hidden", children: [
|
|
14
|
+
/* @__PURE__ */ jsxs(
|
|
15
|
+
"button",
|
|
16
|
+
{
|
|
17
|
+
onClick: () => setIsOpen(!isOpen),
|
|
18
|
+
className: "w-full flex items-center gap-2 px-3 py-1.5 text-xs text-muted-foreground hover:bg-muted/50 transition-colors",
|
|
19
|
+
children: [
|
|
20
|
+
/* @__PURE__ */ jsx("div", { className: cn(
|
|
21
|
+
"flex items-center justify-center w-5 h-5 rounded-md bg-muted text-muted-foreground",
|
|
22
|
+
isStreaming && "animate-pulse"
|
|
23
|
+
), children: /* @__PURE__ */ jsx(Brain, { size: 11 }) }),
|
|
24
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium whitespace-nowrap", children: t("label") }),
|
|
25
|
+
isStreaming && /* @__PURE__ */ jsx("span", { className: "text-[10px] uppercase tracking-wider font-semibold text-primary bg-primary/10 px-1.5 py-0.5 rounded whitespace-nowrap", children: t("active") }),
|
|
26
|
+
/* @__PURE__ */ jsx("div", { className: "ml-auto", children: isOpen ? /* @__PURE__ */ jsx(ChevronUp, { size: 14, className: "text-muted-foreground/70" }) : /* @__PURE__ */ jsx(ChevronDown, { size: 14, className: "text-muted-foreground/70" }) })
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
),
|
|
30
|
+
/* @__PURE__ */ jsx(AnimatePresence, { children: isOpen && /* @__PURE__ */ jsx(
|
|
31
|
+
motion.div,
|
|
32
|
+
{
|
|
33
|
+
initial: { height: 0, opacity: 0 },
|
|
34
|
+
animate: { height: "auto", opacity: 1 },
|
|
35
|
+
exit: { height: 0, opacity: 0 },
|
|
36
|
+
transition: { duration: 0.2, ease: "easeInOut" },
|
|
37
|
+
children: /* @__PURE__ */ jsx("div", { className: "px-3 pb-2.5 pt-1.5 text-xs text-muted-foreground leading-relaxed border-t border-border/50", children: content ? /* @__PURE__ */ jsxs("div", { className: "text-muted-foreground", children: [
|
|
38
|
+
renderContent ? renderContent(content) : /* @__PURE__ */ jsx("div", { className: "whitespace-pre-wrap", children: content }),
|
|
39
|
+
isStreaming && /* @__PURE__ */ jsx(
|
|
40
|
+
motion.span,
|
|
41
|
+
{
|
|
42
|
+
animate: { opacity: [0.4, 1, 0.4] },
|
|
43
|
+
transition: { duration: 1.2, repeat: Infinity },
|
|
44
|
+
className: "inline-block w-1 h-3 bg-muted-foreground/60 ml-0.5 align-middle"
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
] }) : /* @__PURE__ */ jsx("span", { className: "italic opacity-50", children: t("inProgress") }) })
|
|
48
|
+
}
|
|
49
|
+
) })
|
|
50
|
+
] });
|
|
51
|
+
}
|
|
52
|
+
function IDBadge({ text, truncate = true }) {
|
|
53
|
+
const [copied, setCopied] = useState(false);
|
|
54
|
+
const t = useYunUI().useT("common.badge");
|
|
55
|
+
const handleCopy = async (e) => {
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
e.stopPropagation();
|
|
58
|
+
if (!await copyToClipboard(text)) return;
|
|
59
|
+
setCopied(true);
|
|
60
|
+
setTimeout(() => setCopied(false), 1500);
|
|
61
|
+
};
|
|
62
|
+
return /* @__PURE__ */ jsxs(
|
|
63
|
+
"div",
|
|
64
|
+
{
|
|
65
|
+
onMouseDown: handleCopy,
|
|
66
|
+
onClick: handleCopy,
|
|
67
|
+
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" : ""}`,
|
|
68
|
+
title: t("clickToCopy", { text }),
|
|
69
|
+
children: [
|
|
70
|
+
/* @__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 }),
|
|
71
|
+
/* @__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 }) })
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
var CAPABILITY_ICONS = {
|
|
77
|
+
streaming: { icon: Waves, color: "text-cyan-500" },
|
|
78
|
+
vision: { icon: Eye, color: "text-amber-500" },
|
|
79
|
+
thinking: { icon: Brain, color: "text-pink-500" },
|
|
80
|
+
function_calling: { icon: Code, color: "text-purple-500" },
|
|
81
|
+
image_edit: { icon: Image, color: "text-orange-500" },
|
|
82
|
+
negative_prompt: { icon: Ban, color: "text-red-500" },
|
|
83
|
+
seed_control: { icon: Fingerprint, color: "text-indigo-500" },
|
|
84
|
+
lora: { icon: Layers, color: "text-teal-500" },
|
|
85
|
+
guidance_scale: { icon: SlidersHorizontal, color: "text-yellow-500" },
|
|
86
|
+
strength: { icon: SlidersHorizontal, color: "text-orange-500" },
|
|
87
|
+
batch: { icon: Waves, color: "text-cyan-500" }
|
|
88
|
+
};
|
|
89
|
+
function ModelCard({
|
|
90
|
+
name,
|
|
91
|
+
icon,
|
|
92
|
+
ids = [],
|
|
93
|
+
description,
|
|
94
|
+
capabilities = [],
|
|
95
|
+
developer,
|
|
96
|
+
context,
|
|
97
|
+
tier,
|
|
98
|
+
price,
|
|
99
|
+
nonofficial,
|
|
100
|
+
suspended,
|
|
101
|
+
labels,
|
|
102
|
+
onClick,
|
|
103
|
+
className = ""
|
|
104
|
+
}) {
|
|
105
|
+
const { Image } = useYunUI();
|
|
106
|
+
const shownCaps = capabilities.filter((c) => CAPABILITY_ICONS[c]).slice(0, 4);
|
|
107
|
+
return /* @__PURE__ */ jsxs(
|
|
108
|
+
"div",
|
|
109
|
+
{
|
|
110
|
+
onClick,
|
|
111
|
+
role: onClick ? "button" : void 0,
|
|
112
|
+
tabIndex: onClick ? 0 : void 0,
|
|
113
|
+
onKeyDown: (e) => {
|
|
114
|
+
if (onClick && (e.key === "Enter" || e.key === " ")) {
|
|
115
|
+
e.preventDefault();
|
|
116
|
+
onClick();
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
className: `card card-interactive p-4 text-left w-full group cursor-pointer flex flex-col ${className}`,
|
|
120
|
+
children: [
|
|
121
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between mb-3", children: [
|
|
122
|
+
icon,
|
|
123
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-1", children: shownCaps.map((cap) => {
|
|
124
|
+
const { icon: Icon, color } = CAPABILITY_ICONS[cap];
|
|
125
|
+
return /* @__PURE__ */ jsx("div", { className: "p-1 rounded-md bg-muted/50", title: cap, children: /* @__PURE__ */ jsx(Icon, { size: 11, className: color }) }, cap);
|
|
126
|
+
}) })
|
|
127
|
+
] }),
|
|
128
|
+
/* @__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: [
|
|
129
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: name }),
|
|
130
|
+
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" }),
|
|
131
|
+
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 bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/20", children: [
|
|
132
|
+
/* @__PURE__ */ jsx(PauseCircle, { size: 10 }),
|
|
133
|
+
labels?.suspended ?? "Suspended"
|
|
134
|
+
] })
|
|
135
|
+
] }) }),
|
|
136
|
+
ids.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center gap-1.5 mb-3", children: ids.map((id, idx) => /* @__PURE__ */ jsx(IDBadge, { text: id }, idx)) }),
|
|
137
|
+
/* @__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" }) }),
|
|
138
|
+
/* @__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: [
|
|
139
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 min-w-0", children: [
|
|
140
|
+
developer?.iconUrl && /* @__PURE__ */ jsx("div", { className: "rounded-md overflow-hidden bg-linear-to-br from-black/2 to-black/5", style: { width: 12, height: 12 }, children: /* @__PURE__ */ jsx(Image, { src: developer.iconUrl, alt: developer.label, width: 12, height: 12, className: "object-cover" }) }),
|
|
141
|
+
developer?.label && /* @__PURE__ */ jsx("span", { children: developer.label })
|
|
142
|
+
] }),
|
|
143
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
144
|
+
context && /* @__PURE__ */ jsx("span", { className: "bg-muted px-1.5 py-0.5 rounded-sm font-medium", children: context }),
|
|
145
|
+
tier && tier !== "free" && /* @__PURE__ */ jsx("span", { className: "bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400 px-1.5 py-0.5 rounded-sm font-medium", children: tier }),
|
|
146
|
+
price && /* @__PURE__ */ jsx("span", { className: "font-mono", children: price })
|
|
147
|
+
] })
|
|
148
|
+
] })
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
var llmCapabilityConfig = [
|
|
154
|
+
{ 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" },
|
|
155
|
+
{ 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" },
|
|
156
|
+
{ 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" },
|
|
157
|
+
{ 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" },
|
|
158
|
+
{ 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" }
|
|
159
|
+
];
|
|
160
|
+
var imageCapabilityConfig = [
|
|
161
|
+
{ 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" },
|
|
162
|
+
{ 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" },
|
|
163
|
+
{ 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" },
|
|
164
|
+
{ 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" },
|
|
165
|
+
{ 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" },
|
|
166
|
+
{ 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" },
|
|
167
|
+
{ 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" }
|
|
168
|
+
];
|
|
169
|
+
var audioCapabilityConfig = [
|
|
170
|
+
{ 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" },
|
|
171
|
+
{ 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" },
|
|
172
|
+
{ 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" }
|
|
173
|
+
];
|
|
174
|
+
var videoCapabilityConfig = [
|
|
175
|
+
{ 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" }
|
|
176
|
+
];
|
|
177
|
+
var musicCapabilityConfig = [
|
|
178
|
+
{ 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" }
|
|
179
|
+
];
|
|
180
|
+
var threedCapabilityConfig = [
|
|
181
|
+
{ 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" }
|
|
182
|
+
];
|
|
183
|
+
var realtimeCapabilityConfig = [
|
|
184
|
+
{ 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" }
|
|
185
|
+
];
|
|
186
|
+
function CapabilitySelector({ selected, onChange, disabled = false, size = "md", columns = 4, modelType }) {
|
|
187
|
+
const t = useYunUI().useT("capabilities");
|
|
188
|
+
const toggleCapability = (cap) => {
|
|
189
|
+
if (disabled) return;
|
|
190
|
+
onChange(
|
|
191
|
+
selected.includes(cap) ? selected.filter((c) => c !== cap) : [...selected, cap]
|
|
192
|
+
);
|
|
193
|
+
};
|
|
194
|
+
const buildCapabilities = (config) => {
|
|
195
|
+
return config.map((cap) => ({
|
|
196
|
+
...cap,
|
|
197
|
+
label: t(cap.value)
|
|
198
|
+
}));
|
|
199
|
+
};
|
|
200
|
+
const getCapabilities = () => {
|
|
201
|
+
switch (modelType) {
|
|
202
|
+
case "image_generation":
|
|
203
|
+
return buildCapabilities(imageCapabilityConfig);
|
|
204
|
+
case "audio":
|
|
205
|
+
case "tts":
|
|
206
|
+
case "stt":
|
|
207
|
+
return buildCapabilities(audioCapabilityConfig);
|
|
208
|
+
case "video":
|
|
209
|
+
case "video_generation":
|
|
210
|
+
return buildCapabilities(videoCapabilityConfig);
|
|
211
|
+
case "music":
|
|
212
|
+
case "music_generation":
|
|
213
|
+
return buildCapabilities(musicCapabilityConfig);
|
|
214
|
+
case "3d":
|
|
215
|
+
case "threed":
|
|
216
|
+
case "threed_generation":
|
|
217
|
+
return buildCapabilities(threedCapabilityConfig);
|
|
218
|
+
case "realtime":
|
|
219
|
+
case "realtime_voice":
|
|
220
|
+
return buildCapabilities(realtimeCapabilityConfig);
|
|
221
|
+
default:
|
|
222
|
+
return buildCapabilities(llmCapabilityConfig);
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
const capabilityOptions = getCapabilities();
|
|
226
|
+
const sizeClasses = size === "sm" ? "p-2.5 text-xs gap-1.5" : "p-3 text-sm gap-2";
|
|
227
|
+
const iconSize = size === "sm" ? 14 : 16;
|
|
228
|
+
const gridColsClass = {
|
|
229
|
+
1: "grid-cols-1",
|
|
230
|
+
2: "grid-cols-2",
|
|
231
|
+
3: "grid-cols-3",
|
|
232
|
+
4: "grid-cols-4",
|
|
233
|
+
5: "grid-cols-5",
|
|
234
|
+
6: "grid-cols-6"
|
|
235
|
+
}[columns] || "grid-cols-3";
|
|
236
|
+
return /* @__PURE__ */ jsx("div", { className: `grid ${gridColsClass} gap-2`, children: capabilityOptions.map((cap) => {
|
|
237
|
+
const isSelected = selected.includes(cap.value);
|
|
238
|
+
const Icon = cap.icon;
|
|
239
|
+
return /* @__PURE__ */ jsxs(
|
|
240
|
+
"button",
|
|
241
|
+
{
|
|
242
|
+
type: "button",
|
|
243
|
+
onClick: () => toggleCapability(cap.value),
|
|
244
|
+
disabled,
|
|
245
|
+
className: `rounded-lg border text-left transition-all flex items-center ${sizeClasses} ${isSelected ? cap.color : "bg-background border-border hover:bg-muted/50"} ${disabled ? "opacity-50 cursor-not-allowed" : ""}`,
|
|
246
|
+
children: [
|
|
247
|
+
/* @__PURE__ */ jsx(Icon, { size: iconSize, className: `${isSelected ? "" : cap.iconColor} shrink-0` }),
|
|
248
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: cap.label })
|
|
249
|
+
]
|
|
250
|
+
},
|
|
251
|
+
cap.value
|
|
252
|
+
);
|
|
253
|
+
}) });
|
|
254
|
+
}
|
|
255
|
+
var developerIconMap = {
|
|
256
|
+
// Major AI companies
|
|
257
|
+
openai: "openai.png",
|
|
258
|
+
anthropic: "anthropic.png",
|
|
259
|
+
google: "google.png",
|
|
260
|
+
gemini: "gemini.png",
|
|
261
|
+
gemma: "gemma.png",
|
|
262
|
+
"deepseek": "deepseek.png",
|
|
263
|
+
qwen: "qwen.png",
|
|
264
|
+
mistral: "mistral.png",
|
|
265
|
+
"01.ai": "zero-one.png",
|
|
266
|
+
"zero-one": "zero-one.png",
|
|
267
|
+
xai: "grok.png",
|
|
268
|
+
// Chinese companies
|
|
269
|
+
zhipu: "zhipu.png",
|
|
270
|
+
moonshot: "moonshot.png",
|
|
271
|
+
baichuan: "baichuan.png",
|
|
272
|
+
alibaba: "dashscope.png",
|
|
273
|
+
minimax: "minimax.png",
|
|
274
|
+
volcengine: "volcengine.png",
|
|
275
|
+
bytedance: "byte_dance.svg",
|
|
276
|
+
baidu: "wenxin.png",
|
|
277
|
+
// baidu-cloud.svg only exists under /icons/providers/; ERNIE/Wenxin icon lives in /icons/models/
|
|
278
|
+
tencent: "dianxin.png",
|
|
279
|
+
doubao: "doubao.png",
|
|
280
|
+
hunyuan: "hunyuan.png",
|
|
281
|
+
sparkdesk: "sparkdesk.png",
|
|
282
|
+
wenxin: "wenxin.png",
|
|
283
|
+
stepfun: "step.png",
|
|
284
|
+
// Research organizations
|
|
285
|
+
ai21: "ai21.png",
|
|
286
|
+
adept: "adept.png",
|
|
287
|
+
aisingapore: "aisingapore.png",
|
|
288
|
+
bigcode: "bigcode.png",
|
|
289
|
+
codegeex: "codegeex.png",
|
|
290
|
+
cohere: "cohere.png",
|
|
291
|
+
dbrx: "dbrx.png",
|
|
292
|
+
gryphe: "gryphe.png",
|
|
293
|
+
hailuo: "hailuo.png",
|
|
294
|
+
internlm: "internlm.png",
|
|
295
|
+
jina: "jina.png",
|
|
296
|
+
nvidia: "nvidia.png",
|
|
297
|
+
rakutenai: "rakutenai.png",
|
|
298
|
+
upstage: "upstage.png",
|
|
299
|
+
voyageai: "voyageai.png",
|
|
300
|
+
xirang: "xirang.png",
|
|
301
|
+
yi: "zero-one.png",
|
|
302
|
+
zai: "zai.png",
|
|
303
|
+
// Image/Audio/Video models
|
|
304
|
+
chatgpt: "chatgpt.jpeg",
|
|
305
|
+
dalle: "dalle.png",
|
|
306
|
+
flux: "flux.png",
|
|
307
|
+
ideogram: "ideogram.svg",
|
|
308
|
+
keling: "keling.png",
|
|
309
|
+
luma: "luma.png",
|
|
310
|
+
midjourney: "midjourney.png",
|
|
311
|
+
stability: "stability.png",
|
|
312
|
+
suno: "suno.png",
|
|
313
|
+
vidu: "vidu.png",
|
|
314
|
+
tokenflux: "tokenflux.png",
|
|
315
|
+
// Other
|
|
316
|
+
huggingface: "huggingface.png",
|
|
317
|
+
meta: "llama.png",
|
|
318
|
+
facebook: "llama.png",
|
|
319
|
+
// no meta.png under /icons/models/; Meta/Facebook family uses the Llama icon
|
|
320
|
+
microsoft: "microsoft.png",
|
|
321
|
+
ibm: "ibm.png",
|
|
322
|
+
github: "copilot.png",
|
|
323
|
+
tele: "tele.png",
|
|
324
|
+
ling: "ling.png",
|
|
325
|
+
mimo: "mimo.svg",
|
|
326
|
+
pangu: "pangu.svg",
|
|
327
|
+
xiaomi: "xiaomi.png",
|
|
328
|
+
// Model-family icons with dedicated art under /icons/models/
|
|
329
|
+
claude: "claude.png",
|
|
330
|
+
codestral: "codestral.png",
|
|
331
|
+
mixtral: "mixtral.png",
|
|
332
|
+
pixtral: "pixtral.png",
|
|
333
|
+
llava: "llava.png",
|
|
334
|
+
palm: "palm.png",
|
|
335
|
+
chatglm: "chatglm.png",
|
|
336
|
+
internvl: "internvl.png",
|
|
337
|
+
minicpm: "minicpm.webp",
|
|
338
|
+
nousresearch: "nousresearch.png"
|
|
339
|
+
};
|
|
340
|
+
function getDeveloperIconPath(developer) {
|
|
341
|
+
if (!developer) return null;
|
|
342
|
+
const file = getDeveloperIconFile(developer);
|
|
343
|
+
return file ? `/icons/models/${file}` : null;
|
|
344
|
+
}
|
|
345
|
+
function getDeveloperIconFile(developer) {
|
|
346
|
+
if (!developer) return null;
|
|
347
|
+
const normalized = developer.toLowerCase().replace(/[-_\s]/g, "");
|
|
348
|
+
if (developerIconMap[normalized]) {
|
|
349
|
+
return developerIconMap[normalized];
|
|
350
|
+
}
|
|
351
|
+
for (const [key, file] of Object.entries(developerIconMap)) {
|
|
352
|
+
if (normalized.includes(key) || key.includes(normalized)) {
|
|
353
|
+
return file;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
return null;
|
|
357
|
+
}
|
|
358
|
+
var providerIconMap = {
|
|
359
|
+
// Major providers
|
|
360
|
+
openai: "openai.png",
|
|
361
|
+
anthropic: "anthropic.png",
|
|
362
|
+
google: "google.png",
|
|
363
|
+
gemini: "gemini.png",
|
|
364
|
+
deepseek: "deepseek.png",
|
|
365
|
+
mistral: "mistral.png",
|
|
366
|
+
groq: "groq.png",
|
|
367
|
+
grok: "grok.png",
|
|
368
|
+
xai: "grok.png",
|
|
369
|
+
// Cloud providers
|
|
370
|
+
azure: "github.png",
|
|
371
|
+
"azure-openai": "github.png",
|
|
372
|
+
aws: "github.png",
|
|
373
|
+
bedrock: "github.png",
|
|
374
|
+
// Chinese providers
|
|
375
|
+
zhipu: "zhipu.png",
|
|
376
|
+
moonshot: "moonshot.png",
|
|
377
|
+
baichuan: "baichuan.png",
|
|
378
|
+
alibaba: "dashscope.png",
|
|
379
|
+
qwen: "dashscope.png",
|
|
380
|
+
dashscope: "dashscope.png",
|
|
381
|
+
minimax: "minimax.png",
|
|
382
|
+
volcengine: "volcengine.png",
|
|
383
|
+
doubao: "doubao.png",
|
|
384
|
+
bytedance: "bytedance.png",
|
|
385
|
+
baidu: "baidu-cloud.svg",
|
|
386
|
+
// Other providers
|
|
387
|
+
nvidia: "nvidia.png",
|
|
388
|
+
huggingface: "huggingface.png",
|
|
389
|
+
ollama: "ollama.png",
|
|
390
|
+
lmstudio: "lmstudio.png",
|
|
391
|
+
openrouter: "openrouter.png",
|
|
392
|
+
tokenrouter: "tokenrouter.png",
|
|
393
|
+
together: "together.png",
|
|
394
|
+
cohere: "cohere.png",
|
|
395
|
+
perplexity: "perplexity.png",
|
|
396
|
+
fireworks: "fireworks.png",
|
|
397
|
+
github: "github.png",
|
|
398
|
+
jina: "jina.png",
|
|
399
|
+
modelscope: "modelscope.png",
|
|
400
|
+
siliconflow: "silicon.png",
|
|
401
|
+
silicon: "silicon.png",
|
|
402
|
+
cerebras: "cerebras.webp",
|
|
403
|
+
hyperbolic: "hyperbolic.png",
|
|
404
|
+
lepton: "lepton.png",
|
|
405
|
+
cloudflare: "cloudflare.png",
|
|
406
|
+
vllm: "vllm.png",
|
|
407
|
+
zai: "zai.png",
|
|
408
|
+
// Image/special
|
|
409
|
+
step: "step.png",
|
|
410
|
+
"zero-one": "zero-one.png",
|
|
411
|
+
yi: "zero-one.png",
|
|
412
|
+
infini: "infini.png",
|
|
413
|
+
// Additional providers / gateways with icons under /icons/providers/.
|
|
414
|
+
// Keys are normalized (lowercase, separators stripped) to match getIconPath().
|
|
415
|
+
xiaomi: "Xiaomi.png",
|
|
416
|
+
intel: "intel.png",
|
|
417
|
+
nomic: "nomic.png",
|
|
418
|
+
mixedbread: "mixedbread.png",
|
|
419
|
+
lanyun: "lanyun.png",
|
|
420
|
+
newapi: "newapi.png",
|
|
421
|
+
ocoolai: "ocoolai.png",
|
|
422
|
+
ph8: "ph8.png",
|
|
423
|
+
ppio: "ppio.png",
|
|
424
|
+
vertexai: "vertexai.svg",
|
|
425
|
+
gcp: "vertexai.svg",
|
|
426
|
+
"302ai": "302ai.webp",
|
|
427
|
+
aihubmix: "aihubmix.png",
|
|
428
|
+
dmxapi: "DMXAPI.png",
|
|
429
|
+
bailian: "bailian.png",
|
|
430
|
+
bigmodel: "bigModel.png",
|
|
431
|
+
burncloud: "burncloud.png",
|
|
432
|
+
cherryin: "cherryin.png",
|
|
433
|
+
giteeai: "gitee-ai.png",
|
|
434
|
+
qiniu: "qiniu.webp",
|
|
435
|
+
sophnet: "sophnet.svg",
|
|
436
|
+
longcat: "longcat.png",
|
|
437
|
+
alayanew: "alayanew.webp",
|
|
438
|
+
cephalon: "cephalon.jpeg",
|
|
439
|
+
mcprouter: "mcprouter.webp",
|
|
440
|
+
gpustack: "gpustack.svg",
|
|
441
|
+
kwaipilot: "Kwaipilot.png",
|
|
442
|
+
tencentcloudti: "tencent-cloud-ti.png",
|
|
443
|
+
neteaseyoudao: "netease-youdao.svg",
|
|
444
|
+
aionly: "aiOnly.webp"
|
|
445
|
+
};
|
|
446
|
+
function getProviderIconOptions() {
|
|
447
|
+
const seen = /* @__PURE__ */ new Set();
|
|
448
|
+
const out = [];
|
|
449
|
+
for (const [key, file] of Object.entries(providerIconMap)) {
|
|
450
|
+
if (seen.has(file)) continue;
|
|
451
|
+
seen.add(file);
|
|
452
|
+
out.push({ value: `/icons/providers/${file}`, label: key });
|
|
453
|
+
}
|
|
454
|
+
return out.sort((a, b) => a.label.localeCompare(b.label));
|
|
455
|
+
}
|
|
456
|
+
function normalizeProviderId(id) {
|
|
457
|
+
return id.toLowerCase().replace(/[-_\s]/g, "");
|
|
458
|
+
}
|
|
459
|
+
function getIconPath(providerId) {
|
|
460
|
+
const normalized = normalizeProviderId(providerId);
|
|
461
|
+
if (providerIconMap[normalized]) {
|
|
462
|
+
return `/icons/providers/${providerIconMap[normalized]}`;
|
|
463
|
+
}
|
|
464
|
+
for (const [key, file] of Object.entries(providerIconMap)) {
|
|
465
|
+
if (normalized.includes(key) || key.includes(normalized)) {
|
|
466
|
+
return `/icons/providers/${file}`;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
return null;
|
|
470
|
+
}
|
|
471
|
+
function ProviderIcon({
|
|
472
|
+
provider,
|
|
473
|
+
className = "",
|
|
474
|
+
size = 20,
|
|
475
|
+
rounded = false,
|
|
476
|
+
iconUrl
|
|
477
|
+
}) {
|
|
478
|
+
const { Image } = useYunUI();
|
|
479
|
+
const [customError, setCustomError] = useState(false);
|
|
480
|
+
const effectiveIconUrl = iconUrl;
|
|
481
|
+
if (effectiveIconUrl && !customError) {
|
|
482
|
+
if (rounded) {
|
|
483
|
+
const getRadius = () => size <= 14 ? "rounded-sm" : size <= 20 ? "rounded-md" : "rounded-lg";
|
|
484
|
+
return /* @__PURE__ */ jsx(
|
|
485
|
+
"div",
|
|
486
|
+
{
|
|
487
|
+
className: `${getRadius()} overflow-hidden bg-linear-to-br from-black/2 to-black/5 flex items-center justify-center ${className}`,
|
|
488
|
+
style: { width: size, height: size },
|
|
489
|
+
children: /* @__PURE__ */ jsx("img", { src: effectiveIconUrl, alt: provider, width: size, height: size, className: "object-cover", onError: () => setCustomError(true) })
|
|
490
|
+
}
|
|
491
|
+
);
|
|
492
|
+
}
|
|
493
|
+
return /* @__PURE__ */ jsx("img", { src: effectiveIconUrl, alt: provider, width: size, height: size, className: `object-contain ${className}`, onError: () => setCustomError(true) });
|
|
494
|
+
}
|
|
495
|
+
const iconPath = getIconPath(provider);
|
|
496
|
+
const getRadiusClass = () => {
|
|
497
|
+
if (size <= 14) return "rounded-sm";
|
|
498
|
+
if (size <= 20) return "rounded-md";
|
|
499
|
+
return "rounded-lg";
|
|
500
|
+
};
|
|
501
|
+
if (iconPath) {
|
|
502
|
+
if (rounded) {
|
|
503
|
+
return /* @__PURE__ */ jsx(
|
|
504
|
+
"div",
|
|
505
|
+
{
|
|
506
|
+
className: `${getRadiusClass()} overflow-hidden bg-linear-to-br from-black/2 to-black/5 flex items-center justify-center ${className}`,
|
|
507
|
+
style: { width: size, height: size },
|
|
508
|
+
children: /* @__PURE__ */ jsx(
|
|
509
|
+
Image,
|
|
510
|
+
{
|
|
511
|
+
src: iconPath,
|
|
512
|
+
alt: provider,
|
|
513
|
+
width: size,
|
|
514
|
+
height: size,
|
|
515
|
+
className: "object-cover",
|
|
516
|
+
unoptimized: true
|
|
517
|
+
}
|
|
518
|
+
)
|
|
519
|
+
}
|
|
520
|
+
);
|
|
521
|
+
}
|
|
522
|
+
return /* @__PURE__ */ jsx(
|
|
523
|
+
Image,
|
|
524
|
+
{
|
|
525
|
+
src: iconPath,
|
|
526
|
+
alt: provider,
|
|
527
|
+
width: size,
|
|
528
|
+
height: size,
|
|
529
|
+
className: `object-contain ${className}`,
|
|
530
|
+
unoptimized: true
|
|
531
|
+
}
|
|
532
|
+
);
|
|
533
|
+
}
|
|
534
|
+
if (rounded) {
|
|
535
|
+
return /* @__PURE__ */ jsx(
|
|
536
|
+
"div",
|
|
537
|
+
{
|
|
538
|
+
className: `${getRadiusClass()} bg-linear-to-br from-black/5 to-black/10 flex items-center justify-center ${className}`,
|
|
539
|
+
style: { width: size, height: size },
|
|
540
|
+
children: /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: provider.charAt(0).toUpperCase() })
|
|
541
|
+
}
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
return /* @__PURE__ */ jsxs(
|
|
545
|
+
"svg",
|
|
546
|
+
{
|
|
547
|
+
className,
|
|
548
|
+
width: size,
|
|
549
|
+
height: size,
|
|
550
|
+
viewBox: "0 0 24 24",
|
|
551
|
+
fill: "none",
|
|
552
|
+
stroke: "currentColor",
|
|
553
|
+
strokeWidth: "2",
|
|
554
|
+
children: [
|
|
555
|
+
/* @__PURE__ */ jsx("rect", { x: "3", y: "3", width: "18", height: "18", rx: "3" }),
|
|
556
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "3" })
|
|
557
|
+
]
|
|
558
|
+
}
|
|
559
|
+
);
|
|
560
|
+
}
|
|
561
|
+
function ProviderAvatar({
|
|
562
|
+
provider,
|
|
563
|
+
size = 32,
|
|
564
|
+
className = ""
|
|
565
|
+
}) {
|
|
566
|
+
return /* @__PURE__ */ jsx(ProviderIcon, { provider, size, rounded: true, className });
|
|
567
|
+
}
|
|
568
|
+
var ProviderNames = {
|
|
569
|
+
openai: "OpenAI",
|
|
570
|
+
anthropic: "Anthropic",
|
|
571
|
+
google: "Google",
|
|
572
|
+
gemini: "Gemini",
|
|
573
|
+
deepseek: "DeepSeek",
|
|
574
|
+
mistral: "Mistral",
|
|
575
|
+
xai: "xAI",
|
|
576
|
+
grok: "Grok",
|
|
577
|
+
groq: "Groq",
|
|
578
|
+
azure: "GitHub Models",
|
|
579
|
+
"azure-openai": "GitHub Models",
|
|
580
|
+
aws: "GitHub Models",
|
|
581
|
+
bedrock: "GitHub Models",
|
|
582
|
+
nvidia: "NVIDIA",
|
|
583
|
+
zhipu: "Zhipu",
|
|
584
|
+
moonshot: "Moonshot",
|
|
585
|
+
alibaba: "Alibaba",
|
|
586
|
+
qwen: "Qwen",
|
|
587
|
+
dashscope: "DashScope",
|
|
588
|
+
minimax: "MiniMax",
|
|
589
|
+
volcengine: "Volcengine",
|
|
590
|
+
doubao: "Doubao",
|
|
591
|
+
bytedance: "ByteDance",
|
|
592
|
+
baidu: "Baidu",
|
|
593
|
+
baichuan: "Baichuan",
|
|
594
|
+
yi: "Yi",
|
|
595
|
+
openrouter: "OpenRouter",
|
|
596
|
+
tokenrouter: "TokenRouter",
|
|
597
|
+
huggingface: "HuggingFace",
|
|
598
|
+
ollama: "Ollama",
|
|
599
|
+
lmstudio: "LM Studio",
|
|
600
|
+
together: "Together",
|
|
601
|
+
cohere: "Cohere",
|
|
602
|
+
perplexity: "Perplexity",
|
|
603
|
+
fireworks: "Fireworks",
|
|
604
|
+
github: "GitHub Models",
|
|
605
|
+
jina: "Jina",
|
|
606
|
+
modelscope: "ModelScope",
|
|
607
|
+
siliconflow: "SiliconFlow",
|
|
608
|
+
silicon: "SiliconFlow",
|
|
609
|
+
cerebras: "Cerebras",
|
|
610
|
+
hyperbolic: "Hyperbolic",
|
|
611
|
+
lepton: "Lepton",
|
|
612
|
+
step: "Step",
|
|
613
|
+
infini: "Infini",
|
|
614
|
+
cloudflare: "Cloudflare",
|
|
615
|
+
vllm: "vLLM",
|
|
616
|
+
zai: "Z.ai",
|
|
617
|
+
// Additional providers / gateways
|
|
618
|
+
xiaomi: "Xiaomi",
|
|
619
|
+
intel: "Intel",
|
|
620
|
+
nomic: "Nomic",
|
|
621
|
+
mixedbread: "Mixedbread",
|
|
622
|
+
lanyun: "Lanyun",
|
|
623
|
+
newapi: "New API",
|
|
624
|
+
ocoolai: "OCoolAI",
|
|
625
|
+
ph8: "PH8",
|
|
626
|
+
ppio: "PPIO",
|
|
627
|
+
vertexai: "Vertex AI",
|
|
628
|
+
gcp: "Vertex AI",
|
|
629
|
+
"302ai": "302.AI",
|
|
630
|
+
aihubmix: "AiHubMix",
|
|
631
|
+
dmxapi: "DMXAPI",
|
|
632
|
+
bailian: "Bailian",
|
|
633
|
+
bigmodel: "BigModel",
|
|
634
|
+
burncloud: "BurnCloud",
|
|
635
|
+
cherryin: "CherryIN",
|
|
636
|
+
giteeai: "Gitee AI",
|
|
637
|
+
qiniu: "Qiniu",
|
|
638
|
+
sophnet: "SophNet",
|
|
639
|
+
longcat: "LongCat",
|
|
640
|
+
alayanew: "AlayaNew",
|
|
641
|
+
cephalon: "Cephalon",
|
|
642
|
+
mcprouter: "MCP Router",
|
|
643
|
+
gpustack: "GPUStack",
|
|
644
|
+
kwaipilot: "Kwaipilot",
|
|
645
|
+
tencentcloudti: "Tencent Cloud TI",
|
|
646
|
+
neteaseyoudao: "NetEase Youdao",
|
|
647
|
+
aionly: "AiOnly"
|
|
648
|
+
};
|
|
649
|
+
function getProviderName(providerId) {
|
|
650
|
+
const normalized = providerId.toLowerCase().replace(/[-_\s]/g, "");
|
|
651
|
+
if (ProviderNames[normalized]) return ProviderNames[normalized];
|
|
652
|
+
for (const [key, name] of Object.entries(ProviderNames)) {
|
|
653
|
+
if (normalized.includes(key) || key.includes(normalized)) {
|
|
654
|
+
return name;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
return providerId.charAt(0).toUpperCase() + providerId.slice(1);
|
|
658
|
+
}
|
|
659
|
+
function getProxiedImageUrl(url) {
|
|
660
|
+
return url;
|
|
661
|
+
}
|
|
662
|
+
function ModelIcon({
|
|
663
|
+
iconUrl,
|
|
664
|
+
developer,
|
|
665
|
+
provider,
|
|
666
|
+
className = "",
|
|
667
|
+
size = 20,
|
|
668
|
+
rounded = false
|
|
669
|
+
}) {
|
|
670
|
+
const { Image } = useYunUI();
|
|
671
|
+
const [failedPriority, setFailedPriority] = useState(0);
|
|
672
|
+
const getRadiusClass = () => {
|
|
673
|
+
if (size <= 14) return "rounded-sm";
|
|
674
|
+
if (size <= 20) return "rounded-md";
|
|
675
|
+
return "rounded-lg";
|
|
676
|
+
};
|
|
677
|
+
if (failedPriority < 1 && iconUrl && iconUrl.trim()) {
|
|
678
|
+
const src = iconUrl.startsWith("http") ? getProxiedImageUrl(iconUrl) : iconUrl.startsWith("/") ? iconUrl : `/icons/models/${iconUrl}`;
|
|
679
|
+
const handleError = () => setFailedPriority(1);
|
|
680
|
+
if (rounded) {
|
|
681
|
+
return /* @__PURE__ */ jsx(
|
|
682
|
+
"div",
|
|
683
|
+
{
|
|
684
|
+
className: `${getRadiusClass()} overflow-hidden bg-linear-to-br from-black/2 to-black/5 flex items-center justify-center ${className}`,
|
|
685
|
+
style: { width: size, height: size },
|
|
686
|
+
children: /* @__PURE__ */ jsx(
|
|
687
|
+
Image,
|
|
688
|
+
{
|
|
689
|
+
src,
|
|
690
|
+
alt: provider,
|
|
691
|
+
width: size,
|
|
692
|
+
height: size,
|
|
693
|
+
className: "object-cover",
|
|
694
|
+
unoptimized: true,
|
|
695
|
+
onError: handleError
|
|
696
|
+
}
|
|
697
|
+
)
|
|
698
|
+
}
|
|
699
|
+
);
|
|
700
|
+
}
|
|
701
|
+
return /* @__PURE__ */ jsx(
|
|
702
|
+
Image,
|
|
703
|
+
{
|
|
704
|
+
src,
|
|
705
|
+
alt: provider,
|
|
706
|
+
width: size,
|
|
707
|
+
height: size,
|
|
708
|
+
className: `object-contain ${className}`,
|
|
709
|
+
unoptimized: true,
|
|
710
|
+
onError: handleError
|
|
711
|
+
}
|
|
712
|
+
);
|
|
713
|
+
}
|
|
714
|
+
if (failedPriority < 2 && developer) {
|
|
715
|
+
const developerIconFile = getDeveloperIconFile(developer);
|
|
716
|
+
if (developerIconFile) {
|
|
717
|
+
const src = `/icons/models/${developerIconFile}`;
|
|
718
|
+
const handleError = () => setFailedPriority(2);
|
|
719
|
+
if (rounded) {
|
|
720
|
+
return /* @__PURE__ */ jsx(
|
|
721
|
+
"div",
|
|
722
|
+
{
|
|
723
|
+
className: `${getRadiusClass()} overflow-hidden bg-linear-to-br from-black/2 to-black/5 flex items-center justify-center ${className}`,
|
|
724
|
+
style: { width: size, height: size },
|
|
725
|
+
children: /* @__PURE__ */ jsx(
|
|
726
|
+
Image,
|
|
727
|
+
{
|
|
728
|
+
src,
|
|
729
|
+
alt: developer,
|
|
730
|
+
width: size,
|
|
731
|
+
height: size,
|
|
732
|
+
className: "object-cover",
|
|
733
|
+
unoptimized: true,
|
|
734
|
+
onError: handleError
|
|
735
|
+
}
|
|
736
|
+
)
|
|
737
|
+
}
|
|
738
|
+
);
|
|
739
|
+
}
|
|
740
|
+
return /* @__PURE__ */ jsx(
|
|
741
|
+
Image,
|
|
742
|
+
{
|
|
743
|
+
src,
|
|
744
|
+
alt: developer,
|
|
745
|
+
width: size,
|
|
746
|
+
height: size,
|
|
747
|
+
className: `object-contain ${className}`,
|
|
748
|
+
unoptimized: true,
|
|
749
|
+
onError: handleError
|
|
750
|
+
}
|
|
751
|
+
);
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
return /* @__PURE__ */ jsx(ProviderIcon, { provider, size, rounded, className });
|
|
755
|
+
}
|
|
756
|
+
function ModelAvatar({
|
|
757
|
+
iconUrl,
|
|
758
|
+
developer,
|
|
759
|
+
provider,
|
|
760
|
+
size = 32,
|
|
761
|
+
className = ""
|
|
762
|
+
}) {
|
|
763
|
+
return /* @__PURE__ */ jsx(ModelIcon, { iconUrl, developer, provider, size, rounded: true, className });
|
|
764
|
+
}
|
|
765
|
+
function LanguageSwitcher({
|
|
766
|
+
locales,
|
|
767
|
+
currentLocale,
|
|
768
|
+
onChange,
|
|
769
|
+
variant = "icon",
|
|
770
|
+
align = "right",
|
|
771
|
+
label = "Language",
|
|
772
|
+
pending = false,
|
|
773
|
+
className = ""
|
|
774
|
+
}) {
|
|
775
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
776
|
+
const containerRef = useRef(null);
|
|
777
|
+
useEffect(() => {
|
|
778
|
+
const handleClickOutside = (e) => {
|
|
779
|
+
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
780
|
+
setIsOpen(false);
|
|
781
|
+
}
|
|
782
|
+
};
|
|
783
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
784
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
785
|
+
}, []);
|
|
786
|
+
const handleLocaleChange = (newLocale) => {
|
|
787
|
+
if (newLocale === currentLocale || pending) return;
|
|
788
|
+
setIsOpen(false);
|
|
789
|
+
onChange(newLocale);
|
|
790
|
+
};
|
|
791
|
+
const currentLabel = locales.find((l) => l.value === currentLocale)?.label ?? currentLocale;
|
|
792
|
+
return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: `relative ${className}`, children: [
|
|
793
|
+
variant === "pill" ? /* @__PURE__ */ jsxs(
|
|
794
|
+
"button",
|
|
795
|
+
{
|
|
796
|
+
onClick: () => setIsOpen(!isOpen),
|
|
797
|
+
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",
|
|
798
|
+
disabled: pending,
|
|
799
|
+
"aria-label": label,
|
|
800
|
+
children: [
|
|
801
|
+
/* @__PURE__ */ jsx(Globe, { size: 14 }),
|
|
802
|
+
/* @__PURE__ */ jsx("span", { children: currentLabel })
|
|
803
|
+
]
|
|
804
|
+
}
|
|
805
|
+
) : /* @__PURE__ */ jsx(
|
|
806
|
+
"button",
|
|
807
|
+
{
|
|
808
|
+
onClick: () => setIsOpen(!isOpen),
|
|
809
|
+
className: "w-9 h-9 rounded-lg flex items-center justify-center hover:bg-foreground/5 transition-colors disabled:opacity-50",
|
|
810
|
+
disabled: pending,
|
|
811
|
+
"aria-label": label,
|
|
812
|
+
children: /* @__PURE__ */ jsx(Globe, { className: "h-[1.2rem] w-[1.2rem]" })
|
|
813
|
+
}
|
|
814
|
+
),
|
|
815
|
+
isOpen && /* @__PURE__ */ jsx("div", { className: `absolute ${align === "left" ? "left-0" : "right-0"} top-full mt-2 z-50 rounded-2xl border border-white/10 dark:border-white/5 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(
|
|
816
|
+
"button",
|
|
817
|
+
{
|
|
818
|
+
onClick: () => handleLocaleChange(lang.value),
|
|
819
|
+
className: `dropdown-item w-full text-left ${currentLocale === lang.value ? "active" : ""}`,
|
|
820
|
+
children: /* @__PURE__ */ jsx("span", { className: "flex-1", children: lang.label })
|
|
821
|
+
},
|
|
822
|
+
lang.value
|
|
823
|
+
)) }) })
|
|
824
|
+
] });
|
|
825
|
+
}
|
|
826
|
+
function Navbar({
|
|
827
|
+
appName,
|
|
828
|
+
logoSrc = "/favicon.ico",
|
|
829
|
+
links = [],
|
|
830
|
+
currentPath = "/",
|
|
831
|
+
variant = "public",
|
|
832
|
+
labels,
|
|
833
|
+
languageSwitcher,
|
|
834
|
+
themeToggle,
|
|
835
|
+
homeHref = "/",
|
|
836
|
+
loginHref = "/login",
|
|
837
|
+
signupHref = "/signup"
|
|
838
|
+
}) {
|
|
839
|
+
const { Link, Image } = useYunUI();
|
|
840
|
+
const [scrollSection, setScrollSection] = useState("");
|
|
841
|
+
const [menuOpen, setMenuOpen] = useState(false);
|
|
842
|
+
const signIn = labels?.signIn ?? "Sign In";
|
|
843
|
+
const signUp = labels?.signUp ?? "Sign Up";
|
|
844
|
+
const menuLabel = labels?.menu ?? "Menu";
|
|
845
|
+
const activeSection = useMemo(() => {
|
|
846
|
+
return currentPath === "/" ? scrollSection : "";
|
|
847
|
+
}, [currentPath, scrollSection]);
|
|
848
|
+
useEffect(() => {
|
|
849
|
+
if (currentPath !== "/") return;
|
|
850
|
+
const sections = document.querySelectorAll("section[id]");
|
|
851
|
+
if (sections.length === 0) return;
|
|
852
|
+
const handleScroll = () => {
|
|
853
|
+
const scrollPosition = window.scrollY + 150;
|
|
854
|
+
let currentSection = "";
|
|
855
|
+
sections.forEach((section) => {
|
|
856
|
+
const sectionTop = section.offsetTop;
|
|
857
|
+
const sectionHeight = section.offsetHeight;
|
|
858
|
+
if (scrollPosition >= sectionTop && scrollPosition < sectionTop + sectionHeight) {
|
|
859
|
+
currentSection = `#${section.id}`;
|
|
860
|
+
}
|
|
861
|
+
});
|
|
862
|
+
setScrollSection(currentSection);
|
|
863
|
+
};
|
|
864
|
+
handleScroll();
|
|
865
|
+
let ticking = false;
|
|
866
|
+
const onScroll = () => {
|
|
867
|
+
if (!ticking) {
|
|
868
|
+
window.requestAnimationFrame(() => {
|
|
869
|
+
handleScroll();
|
|
870
|
+
ticking = false;
|
|
871
|
+
});
|
|
872
|
+
ticking = true;
|
|
873
|
+
}
|
|
874
|
+
};
|
|
875
|
+
window.addEventListener("scroll", onScroll, { passive: true });
|
|
876
|
+
return () => window.removeEventListener("scroll", onScroll);
|
|
877
|
+
}, [currentPath]);
|
|
878
|
+
const isActive = (path) => {
|
|
879
|
+
if (currentPath === path) return true;
|
|
880
|
+
if (path.startsWith("/#")) {
|
|
881
|
+
return currentPath === "/" && activeSection === path.slice(1);
|
|
882
|
+
}
|
|
883
|
+
return false;
|
|
884
|
+
};
|
|
885
|
+
return /* @__PURE__ */ jsxs("nav", { className: "fixed top-6 left-1/2 -translate-x-1/2 z-50 px-6 py-2.5 max-w-6xl w-[calc(100%-48px)] bg-background/80 backdrop-blur-xl border border-border rounded-full shadow-md flex items-center justify-between", children: [
|
|
886
|
+
/* @__PURE__ */ jsxs(Link, { href: homeHref, className: "flex items-center gap-2 rounded-lg px-2 py-1 -mx-2 hover:bg-foreground/5 transition-colors duration-200", children: [
|
|
887
|
+
/* @__PURE__ */ jsx(Image, { src: logoSrc, alt: appName, width: 28, height: 28, className: "w-7 h-7" }),
|
|
888
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold text-sm tracking-tight", children: appName })
|
|
889
|
+
] }),
|
|
890
|
+
variant === "public" && /* @__PURE__ */ jsx("div", { className: "hidden md:flex items-center gap-6 lg:gap-8 absolute left-1/2 -translate-x-1/2", children: links.map((link) => /* @__PURE__ */ jsxs(
|
|
891
|
+
Link,
|
|
892
|
+
{
|
|
893
|
+
href: link.href,
|
|
894
|
+
className: "group relative px-2 lg:px-3 py-2 whitespace-nowrap min-w-15 text-center",
|
|
895
|
+
children: [
|
|
896
|
+
/* @__PURE__ */ jsx("span", { className: `text-sm relative z-10 ${isActive(link.href) ? "text-foreground font-medium" : "text-muted-foreground"}`, children: link.label }),
|
|
897
|
+
/* @__PURE__ */ jsx("span", { className: `absolute bottom-1.5 left-1/2 -translate-x-1/2 h-0.5 bg-foreground rounded-full transition-all duration-200 ${isActive(link.href) ? "w-8" : "w-0 group-hover:w-8"}` })
|
|
898
|
+
]
|
|
899
|
+
},
|
|
900
|
+
link.href
|
|
901
|
+
)) }),
|
|
902
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 shrink-0", children: [
|
|
903
|
+
languageSwitcher,
|
|
904
|
+
themeToggle ?? /* @__PURE__ */ jsx(ThemeToggle, { variant: "pill" }),
|
|
905
|
+
variant !== "minimal" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
906
|
+
/* @__PURE__ */ jsx(
|
|
907
|
+
Link,
|
|
908
|
+
{
|
|
909
|
+
href: loginHref,
|
|
910
|
+
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",
|
|
911
|
+
children: signIn
|
|
912
|
+
}
|
|
913
|
+
),
|
|
914
|
+
/* @__PURE__ */ jsxs(
|
|
915
|
+
Link,
|
|
916
|
+
{
|
|
917
|
+
href: signupHref,
|
|
918
|
+
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",
|
|
919
|
+
children: [
|
|
920
|
+
/* @__PURE__ */ jsx("span", { className: "hidden sm:inline", children: signUp }),
|
|
921
|
+
/* @__PURE__ */ jsx("span", { className: "sm:hidden", children: "Sign Up" })
|
|
922
|
+
]
|
|
923
|
+
}
|
|
924
|
+
)
|
|
925
|
+
] }),
|
|
926
|
+
variant === "public" && /* @__PURE__ */ jsx(
|
|
927
|
+
"button",
|
|
928
|
+
{
|
|
929
|
+
type: "button",
|
|
930
|
+
onClick: () => setMenuOpen((o) => !o),
|
|
931
|
+
className: "md:hidden w-9 h-9 rounded-full flex items-center justify-center hover:bg-foreground/5 transition-colors",
|
|
932
|
+
"aria-label": menuLabel,
|
|
933
|
+
"aria-expanded": menuOpen,
|
|
934
|
+
children: menuOpen ? /* @__PURE__ */ jsx(X, { className: "w-5 h-5" }) : /* @__PURE__ */ jsx(Menu, { className: "w-5 h-5" })
|
|
935
|
+
}
|
|
936
|
+
)
|
|
937
|
+
] }),
|
|
938
|
+
variant === "public" && menuOpen && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
939
|
+
/* @__PURE__ */ jsx("div", { className: "md:hidden fixed inset-0 -z-10", onClick: () => setMenuOpen(false) }),
|
|
940
|
+
/* @__PURE__ */ jsxs("div", { className: "md:hidden absolute top-full left-0 right-0 mt-3 p-2 bg-background/95 backdrop-blur-xl border border-border rounded-2xl shadow-lg flex flex-col gap-0.5", children: [
|
|
941
|
+
links.map((link) => /* @__PURE__ */ jsx(
|
|
942
|
+
Link,
|
|
943
|
+
{
|
|
944
|
+
href: link.href,
|
|
945
|
+
onClick: () => setMenuOpen(false),
|
|
946
|
+
className: `px-4 py-2.5 rounded-xl text-sm transition-colors hover:bg-foreground/5 ${isActive(link.href) ? "text-foreground font-medium" : "text-muted-foreground"}`,
|
|
947
|
+
children: link.label
|
|
948
|
+
},
|
|
949
|
+
link.href
|
|
950
|
+
)),
|
|
951
|
+
/* @__PURE__ */ jsx(
|
|
952
|
+
Link,
|
|
953
|
+
{
|
|
954
|
+
href: loginHref,
|
|
955
|
+
onClick: () => setMenuOpen(false),
|
|
956
|
+
className: "px-4 py-2.5 rounded-xl text-sm text-muted-foreground transition-colors hover:bg-foreground/5",
|
|
957
|
+
children: signIn
|
|
958
|
+
}
|
|
959
|
+
)
|
|
960
|
+
] })
|
|
961
|
+
] })
|
|
962
|
+
] });
|
|
963
|
+
}
|
|
964
|
+
var GithubIcon = () => /* @__PURE__ */ jsx("svg", { className: "w-4 h-4", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" }) });
|
|
965
|
+
var InstagramIcon = () => /* @__PURE__ */ jsx("svg", { className: "w-4 h-4", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zm0-2.163c-3.259 0-3.667.014-4.947.072-4.358.2-6.78 2.618-6.98 6.98-.059 1.281-.073 1.689-.073 4.948 0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98 1.281.058 1.689.072 4.948.072 3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98-1.281-.059-1.69-.073-4.949-.073zm0 5.838c-3.403 0-6.162 2.759-6.162 6.162s2.759 6.163 6.162 6.163 6.162-2.759 6.162-6.163c0-3.403-2.759-6.162-6.162-6.162zm0 10.162c-2.209 0-4-1.79-4-4 0-2.209 1.791-4 4-4s4 1.791 4 4c0 2.21-1.791 4-4 4zm6.406-11.845c-.796 0-1.441.645-1.441 1.44s.645 1.44 1.441 1.44c.795 0 1.439-.645 1.439-1.44s-.644-1.44-1.439-1.44z" }) });
|
|
966
|
+
var DiscordIcon = () => /* @__PURE__ */ jsx("svg", { className: "w-4 h-4", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028 14.09 14.09 0 0 0 1.226-1.994.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z" }) });
|
|
967
|
+
function Footer({
|
|
968
|
+
appName,
|
|
969
|
+
logoSrc = "/favicon.ico",
|
|
970
|
+
homeHref = "/",
|
|
971
|
+
tagline,
|
|
972
|
+
sections = [],
|
|
973
|
+
social = [],
|
|
974
|
+
copyright
|
|
975
|
+
}) {
|
|
976
|
+
const { Link, Image } = useYunUI();
|
|
977
|
+
const year = (/* @__PURE__ */ new Date()).getFullYear();
|
|
978
|
+
const copyrightText = copyright ?? `\xA9 ${year} ${appName}. All rights reserved.`;
|
|
979
|
+
return /* @__PURE__ */ jsx("footer", { className: "mt-auto py-6 px-6", children: /* @__PURE__ */ jsx("div", { className: "max-w-6xl mx-auto", children: /* @__PURE__ */ jsxs("div", { className: "card p-6", children: [
|
|
980
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-6", children: [
|
|
981
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
982
|
+
/* @__PURE__ */ jsxs(Link, { href: homeHref, className: "flex items-center gap-2 mb-2", children: [
|
|
983
|
+
/* @__PURE__ */ jsx(Image, { src: logoSrc, alt: appName, width: 24, height: 24 }),
|
|
984
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold", children: appName })
|
|
985
|
+
] }),
|
|
986
|
+
tagline && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: tagline })
|
|
987
|
+
] }),
|
|
988
|
+
sections.map((section) => /* @__PURE__ */ jsxs("div", { children: [
|
|
989
|
+
/* @__PURE__ */ jsx("h4", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-2", children: section.title }),
|
|
990
|
+
/* @__PURE__ */ jsx("ul", { className: "space-y-1.5 text-sm", children: section.links.map((link) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Link, { href: link.href, className: "text-muted-foreground hover:text-foreground transition-colors", children: link.label }) }, link.href)) })
|
|
991
|
+
] }, section.title))
|
|
992
|
+
] }),
|
|
993
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-5 pt-4 border-t border-border flex flex-col sm:flex-row items-center justify-between gap-3 text-xs text-muted-foreground", children: [
|
|
994
|
+
/* @__PURE__ */ jsx("span", { children: copyrightText }),
|
|
995
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-4", children: social.map((link) => /* @__PURE__ */ jsx(
|
|
996
|
+
"a",
|
|
997
|
+
{
|
|
998
|
+
href: link.href,
|
|
999
|
+
target: link.href.startsWith("/") || link.href.startsWith("mailto:") ? void 0 : "_blank",
|
|
1000
|
+
rel: link.href.startsWith("/") || link.href.startsWith("mailto:") ? void 0 : "noopener noreferrer",
|
|
1001
|
+
className: "text-muted-foreground hover:text-foreground transition-colors",
|
|
1002
|
+
"aria-label": link.label,
|
|
1003
|
+
children: link.icon
|
|
1004
|
+
},
|
|
1005
|
+
link.label
|
|
1006
|
+
)) })
|
|
1007
|
+
] })
|
|
1008
|
+
] }) }) });
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
export { CapabilitySelector, DiscordIcon, Footer, GithubIcon, IDBadge, InstagramIcon, LanguageSwitcher, ModelAvatar, ModelCard, ModelIcon, Navbar, ProviderAvatar, ProviderIcon, ProviderNames, ThinkingBlock, getDeveloperIconPath, getIconPath, getProviderIconOptions, getProviderName, normalizeProviderId };
|
|
1012
|
+
//# sourceMappingURL=ai.js.map
|
|
1013
|
+
//# sourceMappingURL=ai.js.map
|