@tombcato/ai-selector-react 0.1.0
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/AIConfigForm.d.ts +17 -0
- package/dist/App.d.ts +2 -0
- package/dist/AuthInput.d.ts +11 -0
- package/dist/BaseUrlInput.d.ts +10 -0
- package/dist/ModelSelect.d.ts +17 -0
- package/dist/ProviderSelect.d.ts +12 -0
- package/dist/SmartText.d.ts +8 -0
- package/dist/index-BDJQBhY0.js +2031 -0
- package/dist/index-BDJQBhY0.js.map +1 -0
- package/dist/index-BseB50dK.js +22 -0
- package/dist/index-BseB50dK.js.map +1 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/index.umd.cjs +31 -0
- package/dist/index.umd.cjs.map +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/useAIConfig.d.ts +40 -0
- package/package.json +44 -0
|
@@ -0,0 +1,2031 @@
|
|
|
1
|
+
import Je, { useState as B, useMemo as de, useRef as Oe, useEffect as se, useCallback as ue } from "react";
|
|
2
|
+
import { Ticker as ja } from "@tombcato/smart-ticker";
|
|
3
|
+
const be = {
|
|
4
|
+
zh: {
|
|
5
|
+
save: "保存配置",
|
|
6
|
+
saved: "保存成功",
|
|
7
|
+
providerLabel: "Provider",
|
|
8
|
+
modelLabel: "Model",
|
|
9
|
+
selectProvider: "选择 Provider...",
|
|
10
|
+
customBaseUrl: "自定义 Base URL",
|
|
11
|
+
apiKeyLabel: "API Key",
|
|
12
|
+
apiKeyPlaceholder: "输入 API Key...",
|
|
13
|
+
testConnection: "测试模型连接",
|
|
14
|
+
testing: "测试中...",
|
|
15
|
+
testSuccess: "连接成功",
|
|
16
|
+
testFailed: "测试连通性失败",
|
|
17
|
+
selectModel: "选择 Model...",
|
|
18
|
+
searchModel: "搜索或自定义模型...",
|
|
19
|
+
useCustom: "使用自定义",
|
|
20
|
+
noModels: "暂无模型数据",
|
|
21
|
+
apiKeyTip: "输入 API Key 后可获取完整模型列表",
|
|
22
|
+
fetchModelsFailed: "拉取模型列表失败,已使用离线模型列表",
|
|
23
|
+
refreshingModels: "列表刷新中...",
|
|
24
|
+
modelListUpdated: "模型列表已刷新",
|
|
25
|
+
preview: "配置预览",
|
|
26
|
+
unselected: "(未选择)"
|
|
27
|
+
},
|
|
28
|
+
en: {
|
|
29
|
+
save: "Save Config",
|
|
30
|
+
saved: "Saved",
|
|
31
|
+
providerLabel: "Provider",
|
|
32
|
+
modelLabel: "Model",
|
|
33
|
+
selectProvider: "Select Provider...",
|
|
34
|
+
customBaseUrl: "Custom Base URL",
|
|
35
|
+
apiKeyLabel: "API Key",
|
|
36
|
+
apiKeyPlaceholder: "Enter API Key...",
|
|
37
|
+
testConnection: "Test Model Connection",
|
|
38
|
+
testing: "Testing...",
|
|
39
|
+
testSuccess: "Connection Successful",
|
|
40
|
+
testFailed: "Connection Failed",
|
|
41
|
+
selectModel: "Select Model...",
|
|
42
|
+
searchModel: "Search or custom models...",
|
|
43
|
+
useCustom: "Use custom",
|
|
44
|
+
noModels: "No models found",
|
|
45
|
+
apiKeyTip: "Enter API Key to fetch full model list",
|
|
46
|
+
fetchModelsFailed: "Failed to fetch model list, using offline models",
|
|
47
|
+
refreshingModels: "Refreshing models...",
|
|
48
|
+
modelListUpdated: "Model list updated",
|
|
49
|
+
preview: "Config Preview",
|
|
50
|
+
unselected: "(Unselected)"
|
|
51
|
+
}
|
|
52
|
+
}, N = "https://registry.npmmirror.com/@lobehub/icons-static-svg/1.77.0/files/icons", d = {
|
|
53
|
+
OPENAI: "openai",
|
|
54
|
+
ANTHROPIC: "anthropic",
|
|
55
|
+
GEMINI: "gemini",
|
|
56
|
+
DEEPSEEK: "deepseek",
|
|
57
|
+
OPENROUTER: "openrouter",
|
|
58
|
+
GROQ: "groq",
|
|
59
|
+
MISTRAL: "mistral",
|
|
60
|
+
MOONSHOT: "moonshot",
|
|
61
|
+
QWEN: "qwen",
|
|
62
|
+
ZHIPU: "zhipu",
|
|
63
|
+
SILICONFLOW: "siliconflow",
|
|
64
|
+
XAI: "xai",
|
|
65
|
+
TOGETHER: "together",
|
|
66
|
+
FIREWORKS: "fireworks",
|
|
67
|
+
DEEPINFRA: "deepinfra",
|
|
68
|
+
PERPLEXITY: "perplexity",
|
|
69
|
+
COHERE: "cohere",
|
|
70
|
+
OLLAMA: "ollama",
|
|
71
|
+
DOUBAO: "doubao",
|
|
72
|
+
MINIMAX: "minimax"
|
|
73
|
+
}, Ee = {
|
|
74
|
+
[d.OPENAI]: {
|
|
75
|
+
id: d.OPENAI,
|
|
76
|
+
name: "OpenAI",
|
|
77
|
+
baseUrl: "https://api.openai.com/v1",
|
|
78
|
+
needsApiKey: !0,
|
|
79
|
+
apiFormat: "openai",
|
|
80
|
+
supportsModelsApi: !0,
|
|
81
|
+
icon: `${N}/openai.svg`
|
|
82
|
+
},
|
|
83
|
+
[d.ANTHROPIC]: {
|
|
84
|
+
id: d.ANTHROPIC,
|
|
85
|
+
name: "Anthropic (Claude)",
|
|
86
|
+
baseUrl: "https://api.anthropic.com/v1",
|
|
87
|
+
needsApiKey: !0,
|
|
88
|
+
apiFormat: "anthropic",
|
|
89
|
+
supportsModelsApi: !1,
|
|
90
|
+
icon: `${N}/anthropic.svg`
|
|
91
|
+
},
|
|
92
|
+
[d.GEMINI]: {
|
|
93
|
+
id: d.GEMINI,
|
|
94
|
+
name: "Google Gemini",
|
|
95
|
+
baseUrl: "https://generativelanguage.googleapis.com/v1beta",
|
|
96
|
+
needsApiKey: !0,
|
|
97
|
+
apiFormat: "gemini",
|
|
98
|
+
supportsModelsApi: !0,
|
|
99
|
+
icon: `${N}/gemini.svg`
|
|
100
|
+
},
|
|
101
|
+
[d.OPENROUTER]: {
|
|
102
|
+
id: d.OPENROUTER,
|
|
103
|
+
name: "OpenRouter",
|
|
104
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
105
|
+
needsApiKey: !0,
|
|
106
|
+
apiFormat: "openai",
|
|
107
|
+
supportsModelsApi: !0,
|
|
108
|
+
icon: `${N}/openrouter.svg`
|
|
109
|
+
},
|
|
110
|
+
[d.DEEPSEEK]: {
|
|
111
|
+
id: d.DEEPSEEK,
|
|
112
|
+
name: "DeepSeek",
|
|
113
|
+
baseUrl: "https://api.deepseek.com",
|
|
114
|
+
needsApiKey: !0,
|
|
115
|
+
apiFormat: "openai",
|
|
116
|
+
supportsModelsApi: !0,
|
|
117
|
+
icon: `${N}/deepseek.svg`
|
|
118
|
+
},
|
|
119
|
+
[d.MOONSHOT]: {
|
|
120
|
+
id: d.MOONSHOT,
|
|
121
|
+
name: "Moonshot (Kimi)",
|
|
122
|
+
baseUrl: "https://api.moonshot.cn/v1",
|
|
123
|
+
needsApiKey: !0,
|
|
124
|
+
apiFormat: "openai",
|
|
125
|
+
supportsModelsApi: !0,
|
|
126
|
+
icon: `${N}/moonshot.svg`
|
|
127
|
+
},
|
|
128
|
+
[d.QWEN]: {
|
|
129
|
+
id: d.QWEN,
|
|
130
|
+
name: "通义千问 (Qwen)",
|
|
131
|
+
baseUrl: "https://dashscope.aliyuncs.com/compatible-mode/v1",
|
|
132
|
+
needsApiKey: !0,
|
|
133
|
+
apiFormat: "openai",
|
|
134
|
+
supportsModelsApi: !0,
|
|
135
|
+
icon: `${N}/qwen.svg`
|
|
136
|
+
},
|
|
137
|
+
[d.ZHIPU]: {
|
|
138
|
+
id: d.ZHIPU,
|
|
139
|
+
name: "智谱 AI (GLM)",
|
|
140
|
+
baseUrl: "https://open.bigmodel.cn/api/paas/v4",
|
|
141
|
+
needsApiKey: !0,
|
|
142
|
+
apiFormat: "openai",
|
|
143
|
+
supportsModelsApi: !0,
|
|
144
|
+
icon: `${N}/zhipu.svg`
|
|
145
|
+
},
|
|
146
|
+
[d.SILICONFLOW]: {
|
|
147
|
+
id: d.SILICONFLOW,
|
|
148
|
+
name: "硅基流动 (siliconflow)",
|
|
149
|
+
baseUrl: "https://api.siliconflow.cn/v1",
|
|
150
|
+
needsApiKey: !0,
|
|
151
|
+
apiFormat: "openai",
|
|
152
|
+
supportsModelsApi: !0,
|
|
153
|
+
icon: `${N}/siliconcloud.svg`
|
|
154
|
+
},
|
|
155
|
+
[d.DOUBAO]: {
|
|
156
|
+
id: d.DOUBAO,
|
|
157
|
+
name: "火山方舟 (Doubao)",
|
|
158
|
+
baseUrl: "https://ark.cn-beijing.volces.com/api/v3",
|
|
159
|
+
needsApiKey: !0,
|
|
160
|
+
apiFormat: "openai",
|
|
161
|
+
supportsModelsApi: !0,
|
|
162
|
+
icon: `${N}/doubao.svg`
|
|
163
|
+
},
|
|
164
|
+
[d.MINIMAX]: {
|
|
165
|
+
id: d.MINIMAX,
|
|
166
|
+
name: "MiniMax",
|
|
167
|
+
baseUrl: "https://api.minimax.io/v1",
|
|
168
|
+
needsApiKey: !0,
|
|
169
|
+
apiFormat: "openai",
|
|
170
|
+
supportsModelsApi: !1,
|
|
171
|
+
icon: `${N}/minimax.svg`
|
|
172
|
+
},
|
|
173
|
+
[d.XAI]: {
|
|
174
|
+
id: d.XAI,
|
|
175
|
+
name: "xAI (Grok)",
|
|
176
|
+
baseUrl: "https://api.x.ai/v1",
|
|
177
|
+
needsApiKey: !0,
|
|
178
|
+
apiFormat: "openai",
|
|
179
|
+
supportsModelsApi: !0,
|
|
180
|
+
icon: `${N}/grok.svg`
|
|
181
|
+
},
|
|
182
|
+
[d.GROQ]: {
|
|
183
|
+
id: d.GROQ,
|
|
184
|
+
name: "Groq",
|
|
185
|
+
baseUrl: "https://api.groq.com/openai/v1",
|
|
186
|
+
needsApiKey: !0,
|
|
187
|
+
apiFormat: "openai",
|
|
188
|
+
supportsModelsApi: !0,
|
|
189
|
+
icon: `${N}/groq.svg`
|
|
190
|
+
},
|
|
191
|
+
[d.MISTRAL]: {
|
|
192
|
+
id: d.MISTRAL,
|
|
193
|
+
name: "Mistral AI",
|
|
194
|
+
baseUrl: "https://api.mistral.ai/v1",
|
|
195
|
+
needsApiKey: !0,
|
|
196
|
+
apiFormat: "openai",
|
|
197
|
+
supportsModelsApi: !0,
|
|
198
|
+
icon: `${N}/mistral.svg`
|
|
199
|
+
},
|
|
200
|
+
[d.TOGETHER]: {
|
|
201
|
+
id: d.TOGETHER,
|
|
202
|
+
name: "Together AI",
|
|
203
|
+
baseUrl: "https://api.together.xyz/v1",
|
|
204
|
+
needsApiKey: !0,
|
|
205
|
+
apiFormat: "openai",
|
|
206
|
+
supportsModelsApi: !0,
|
|
207
|
+
icon: `${N}/together.svg`
|
|
208
|
+
},
|
|
209
|
+
[d.FIREWORKS]: {
|
|
210
|
+
id: d.FIREWORKS,
|
|
211
|
+
name: "Fireworks AI",
|
|
212
|
+
baseUrl: "https://api.fireworks.ai/inference/v1",
|
|
213
|
+
needsApiKey: !0,
|
|
214
|
+
apiFormat: "openai",
|
|
215
|
+
supportsModelsApi: !0,
|
|
216
|
+
icon: `${N}/fireworks.svg`
|
|
217
|
+
},
|
|
218
|
+
[d.DEEPINFRA]: {
|
|
219
|
+
id: d.DEEPINFRA,
|
|
220
|
+
name: "DeepInfra",
|
|
221
|
+
baseUrl: "https://api.deepinfra.com/v1/openai",
|
|
222
|
+
needsApiKey: !0,
|
|
223
|
+
apiFormat: "openai",
|
|
224
|
+
supportsModelsApi: !0,
|
|
225
|
+
icon: `${N}/deepinfra.svg`
|
|
226
|
+
},
|
|
227
|
+
[d.PERPLEXITY]: {
|
|
228
|
+
id: d.PERPLEXITY,
|
|
229
|
+
name: "Perplexity",
|
|
230
|
+
baseUrl: "https://api.perplexity.ai",
|
|
231
|
+
needsApiKey: !0,
|
|
232
|
+
apiFormat: "openai",
|
|
233
|
+
supportsModelsApi: !1,
|
|
234
|
+
icon: `${N}/perplexity.svg`
|
|
235
|
+
},
|
|
236
|
+
[d.COHERE]: {
|
|
237
|
+
id: d.COHERE,
|
|
238
|
+
name: "Cohere",
|
|
239
|
+
baseUrl: "https://api.cohere.com/v2",
|
|
240
|
+
needsApiKey: !0,
|
|
241
|
+
apiFormat: "cohere",
|
|
242
|
+
supportsModelsApi: !0,
|
|
243
|
+
icon: `${N}/cohere.svg`
|
|
244
|
+
},
|
|
245
|
+
[d.OLLAMA]: {
|
|
246
|
+
id: d.OLLAMA,
|
|
247
|
+
name: "Ollama (Local)",
|
|
248
|
+
baseUrl: "http://localhost:11434/v1",
|
|
249
|
+
needsApiKey: !1,
|
|
250
|
+
apiFormat: "openai",
|
|
251
|
+
supportsModelsApi: !0,
|
|
252
|
+
icon: `${N}/ollama.svg`
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
function Za(a) {
|
|
256
|
+
return Ee[a];
|
|
257
|
+
}
|
|
258
|
+
function Ra() {
|
|
259
|
+
return Object.values(Ee);
|
|
260
|
+
}
|
|
261
|
+
function et(a) {
|
|
262
|
+
return Ra().filter((t) => t.apiFormat === a);
|
|
263
|
+
}
|
|
264
|
+
const Ta = {
|
|
265
|
+
[d.OPENAI]: [
|
|
266
|
+
{ id: "gpt-5.2-pro", name: "GPT-5.2 Pro" },
|
|
267
|
+
{ id: "gpt-5.2", name: "GPT-5.2" },
|
|
268
|
+
{ id: "gpt-5", name: "GPT-5" },
|
|
269
|
+
{ id: "gpt-5-mini", name: "GPT-5 Mini" },
|
|
270
|
+
{ id: "gpt-5-nano", name: "GPT-5 Nano" },
|
|
271
|
+
{ id: "gpt-4.1", name: "GPT-4.1" }
|
|
272
|
+
],
|
|
273
|
+
[d.ANTHROPIC]: [
|
|
274
|
+
{ id: "claude-opus-4.5-20251101", name: "Claude Opus 4.5" },
|
|
275
|
+
{ id: "claude-opus-4.5-20251101-thinking", name: "Claude Opus 4.5 Thinking" },
|
|
276
|
+
{ id: "claude-sonnet-4.5-20250929", name: "Claude Sonnet 4.5" },
|
|
277
|
+
{ id: "claude-sonnet-4.5-20250929-thinking", name: "Claude Sonnet 4.5 Thinking" },
|
|
278
|
+
{ id: "claude-haiku-4.5-20251001", name: "Claude Haiku 4.5" },
|
|
279
|
+
{ id: "claude-haiku-4.5-20251001-thinking", name: "Claude Haiku 4.5 Thinking" },
|
|
280
|
+
{ id: "claude-opus-4.1-20250805", name: "Claude Opus 4.1" },
|
|
281
|
+
{ id: "claude-opus-4.1-20250805-thinking", name: "Claude Opus 4.1 Thinking" }
|
|
282
|
+
],
|
|
283
|
+
[d.GEMINI]: [
|
|
284
|
+
{ id: "gemini-3-flash-preview", name: "Gemini 3 Flash Preview" },
|
|
285
|
+
{ id: "gemini-3-pro-preview", name: "Gemini 3 Pro Preview" },
|
|
286
|
+
{ id: "gemini-2.5-pro", name: "Gemini 2.5 Pro" },
|
|
287
|
+
{ id: "gemini-2.5-flash", name: "Gemini 2.5 Flash" },
|
|
288
|
+
{ id: "gemini-2.5-flash-lite", name: "Gemini 2.5 Flash-Lite" }
|
|
289
|
+
],
|
|
290
|
+
[d.DEEPSEEK]: [
|
|
291
|
+
{ id: "deepseek-chat", name: "Deepseek Chat" },
|
|
292
|
+
{ id: "deepseek-reasoner", name: "Deepseek Reasoner" }
|
|
293
|
+
],
|
|
294
|
+
[d.MISTRAL]: [
|
|
295
|
+
{ id: "mistral-large-latest", name: "Mistral Large" },
|
|
296
|
+
{ id: "mistral-medium-latest", name: "Mistral Medium" },
|
|
297
|
+
{ id: "mistral-small-latest", name: "Mistral Small" },
|
|
298
|
+
{ id: "codestral-latest", name: "Codestral" },
|
|
299
|
+
{ id: "devstral-latest", name: "Devstral" },
|
|
300
|
+
{ id: "magistral-medium-latest", name: "Magistral Medium" },
|
|
301
|
+
{ id: "pixtral-large-latest", name: "Pixtral Large" },
|
|
302
|
+
{ id: "pixtral-12b-latest", name: "Pixtral 12B" },
|
|
303
|
+
{ id: "ministral-8b-latest", name: "Ministral 8B" },
|
|
304
|
+
{ id: "ministral-3b-latest", name: "Ministral 3B" }
|
|
305
|
+
],
|
|
306
|
+
[d.GROQ]: [
|
|
307
|
+
{ id: "canopylabs/orpheus-v1-english", name: "Orpheus V1 English" },
|
|
308
|
+
{ id: "canopylabs/orpheus-arabic-saudi", name: "Orpheus Arabic Saudi" },
|
|
309
|
+
{ id: "moonshotai/kimi-k2-instruct", name: "Kimi K2 Instruct" },
|
|
310
|
+
{ id: "groq/compound-mini", name: "Compound Mini" },
|
|
311
|
+
{ id: "llama-3.3-70b-versatile", name: "Llama 3.3 70B Versatile" },
|
|
312
|
+
{ id: "openai/gpt-oss-120b", name: "Gpt Oss 120B" },
|
|
313
|
+
{ id: "qwen/qwen3-32b", name: "Qwen3 32B" },
|
|
314
|
+
{ id: "groq/compound", name: "Compound" },
|
|
315
|
+
{ id: "meta-llama/llama-4-maverick-17b-128e-instruct", name: "Llama 4 Maverick 17B 128E Instruct" }
|
|
316
|
+
],
|
|
317
|
+
[d.XAI]: [
|
|
318
|
+
{ id: "grok-4", name: "Grok 4" },
|
|
319
|
+
{ id: "grok-4-fast", name: "Grok 4 Fast" },
|
|
320
|
+
{ id: "grok-3-latest", name: "Grok 3" },
|
|
321
|
+
{ id: "grok-3-fast", name: "Grok 3 Fast" },
|
|
322
|
+
{ id: "grok-3-mini-latest", name: "Grok 3 Mini" },
|
|
323
|
+
{ id: "grok-3-mini-fast", name: "Grok 3 Mini Fast" },
|
|
324
|
+
{ id: "grok-vision-beta", name: "Grok Vision (Beta)" }
|
|
325
|
+
],
|
|
326
|
+
[d.TOGETHER]: [
|
|
327
|
+
{ id: "Qwen/Qwen2.5-72B-Instruct-Turbo", name: "Qwen2.5 72B Instruct Turbo" },
|
|
328
|
+
{ id: "Qwen/Qwen3-235B-A22B-Thinking-2507", name: "Qwen3 235B A22B Thinking 2507" },
|
|
329
|
+
{ id: "deepseek-ai/DeepSeek-R1", name: "Deepseek R1" },
|
|
330
|
+
{ id: "deepseek-ai/DeepSeek-V3.1", name: "Deepseek V3.1" },
|
|
331
|
+
{ id: "meta-llama/Llama-3.2-3B-Instruct-Turbo", name: "Llama 3.2 3B Instruct Turbo" },
|
|
332
|
+
{ id: "meta-llama/Llama-3.3-70B-Instruct-Turbo", name: "Llama 3.3 70B Instruct Turbo" },
|
|
333
|
+
{ id: "meta-llama/Llama-3.3-70B-Instruct-Turbo-Free", name: "Llama 3.3 70B Instruct Turbo Free" }
|
|
334
|
+
],
|
|
335
|
+
[d.FIREWORKS]: [
|
|
336
|
+
{ id: "accounts/fireworks/models/llama4-scout-instruct-basic", name: "Llama4 Scout Instruct Basic" },
|
|
337
|
+
{ id: "accounts/fireworks/models/qwen3-vl-235b-a22b-thinking", name: "Qwen3 Vl 235B A22B Thinking" },
|
|
338
|
+
{ id: "accounts/fireworks/models/deepseek-v3p2", name: "Deepseek V3P2" },
|
|
339
|
+
{ id: "accounts/fireworks/models/qwen3-vl-30b-a3b-thinking", name: "Qwen3 Vl 30B A3B Thinking" },
|
|
340
|
+
{ id: "accounts/fireworks/models/qwen3-8b", name: "Qwen3 8B" },
|
|
341
|
+
{ id: "accounts/fireworks/models/qwen3-vl-30b-a3b-instruct", name: "Qwen3 Vl 30B A3B Instruct" },
|
|
342
|
+
{ id: "accounts/fireworks/models/qwen2p5-vl-32b-instruct", name: "Qwen2P5 Vl 32B Instruct" },
|
|
343
|
+
{ id: "accounts/fireworks/models/llama4-maverick-instruct-basic", name: "Llama4 Maverick Instruct Basic" },
|
|
344
|
+
{ id: "accounts/fireworks/models/qwen3-235b-a22b-thinking-2507", name: "Qwen3 235B A22B Thinking 2507" },
|
|
345
|
+
{ id: "accounts/fireworks/models/qwen3-coder-480b-a35b-instruct", name: "Qwen3 Coder 480B A35B Instruct" }
|
|
346
|
+
],
|
|
347
|
+
[d.DEEPINFRA]: [
|
|
348
|
+
{ id: "meta-llama/Llama-3.2-11B-Vision-Instruct", name: "Llama 3.2 11B Vision Instruct" },
|
|
349
|
+
{ id: "Qwen/Qwen3-32B", name: "Qwen3 32B" },
|
|
350
|
+
{ id: "NousResearch/Hermes-3-Llama-3.1-70B", name: "Hermes 3 Llama 3.1 70B" },
|
|
351
|
+
{ id: "Qwen/Qwen2.5-72B-Instruct", name: "Qwen2.5 72B Instruct" },
|
|
352
|
+
{ id: "deepseek-ai/DeepSeek-V3-0324", name: "Deepseek V3 0324" },
|
|
353
|
+
{ id: "Qwen/Qwen3-VL-235B-A22B-Instruct", name: "Qwen3 Vl 235B A22B Instruct" },
|
|
354
|
+
{ id: "meta-llama/Llama-3.2-3B-Instruct", name: "Llama 3.2 3B Instruct" },
|
|
355
|
+
{ id: "Qwen/Qwen2.5-VL-32B-Instruct", name: "Qwen2.5 Vl 32B Instruct" },
|
|
356
|
+
{ id: "meta-llama/Meta-Llama-3.1-8B-Instruct", name: "Meta Llama 3.1 8B Instruct" },
|
|
357
|
+
{ id: "Qwen/Qwen3-Coder-480B-A35B-Instruct-Turbo", name: "Qwen3 Coder 480B A35B Instruct Turbo" }
|
|
358
|
+
],
|
|
359
|
+
[d.OPENROUTER]: [
|
|
360
|
+
{ id: "google/gemini-3-flash-preview", name: "Gemini 3 Flash Preview" },
|
|
361
|
+
{ id: "mistralai/mistral-small-creative", name: "Mistral Small Creative" },
|
|
362
|
+
{ id: "openai/gpt-5.2-chat", name: "Gpt 5.2 Chat" },
|
|
363
|
+
{ id: "openai/gpt-5.2-pro", name: "Gpt 5.2 Pro" },
|
|
364
|
+
{ id: "openai/gpt-5.2", name: "Gpt 5.2" },
|
|
365
|
+
{ id: "mistralai/devstral-2512", name: "Devstral 2512" },
|
|
366
|
+
{ id: "openai/gpt-5.1-codex-max", name: "Gpt 5.1 Codex Max" },
|
|
367
|
+
{ id: "mistralai/ministral-14b-2512", name: "Ministral 14B 2512" },
|
|
368
|
+
{ id: "mistralai/ministral-8b-2512", name: "Ministral 8B 2512" },
|
|
369
|
+
{ id: "mistralai/ministral-3b-2512", name: "Ministral 3B 2512" },
|
|
370
|
+
{ id: "mistralai/mistral-large-2512", name: "Mistral Large 2512" },
|
|
371
|
+
{ id: "deepseek/deepseek-v3.2-speciale", name: "Deepseek V3.2 Speciale" }
|
|
372
|
+
],
|
|
373
|
+
[d.PERPLEXITY]: [
|
|
374
|
+
{ id: "codellama-34b-instruct", name: "Codellama 34B Instruct" },
|
|
375
|
+
{ id: "codellama-70b-instruct", name: "Codellama 70B Instruct" },
|
|
376
|
+
{ id: "llama-2-70b-chat", name: "Llama 2 70B Chat" },
|
|
377
|
+
{ id: "llama-3.1-70b-instruct", name: "Llama 3.1 70B Instruct" },
|
|
378
|
+
{ id: "llama-3.1-8b-instruct", name: "Llama 3.1 8B Instruct" },
|
|
379
|
+
{ id: "llama-3.1-sonar-huge-128k-online", name: "Llama 3.1 Sonar Huge 128K Online" },
|
|
380
|
+
{ id: "llama-3.1-sonar-large-128k-chat", name: "Llama 3.1 Sonar Large 128K Chat" },
|
|
381
|
+
{ id: "llama-3.1-sonar-large-128k-online", name: "Llama 3.1 Sonar Large 128K Online" },
|
|
382
|
+
{ id: "llama-3.1-sonar-small-128k-chat", name: "Llama 3.1 Sonar Small 128K Chat" }
|
|
383
|
+
],
|
|
384
|
+
[d.COHERE]: [
|
|
385
|
+
{ id: "command-a-vision-07-2025", name: "Command A Vision 07 2025" },
|
|
386
|
+
{ id: "command-a-reasoning-08-2025", name: "Command A Reasoning 08 2025" },
|
|
387
|
+
{ id: "command-r-08-2024", name: "Command R 08 2024" },
|
|
388
|
+
{ id: "command-r7b-arabic-02-2025", name: "Command R7B Arabic 02 2025" },
|
|
389
|
+
{ id: "command-r7b-12-2024", name: "Command R7B 12 2024" }
|
|
390
|
+
],
|
|
391
|
+
[d.MOONSHOT]: [
|
|
392
|
+
{ id: "moonshot-v1-128k", name: "Moonshot 128K" },
|
|
393
|
+
{ id: "moonshot-v1-32k", name: "Moonshot 32K" },
|
|
394
|
+
{ id: "moonshot-v1-8k", name: "Moonshot 8K" },
|
|
395
|
+
{ id: "kimi-k2-0711-chat", name: "Kimi K2 Chat" },
|
|
396
|
+
{ id: "moonshot-v1-auto", name: "Moonshot Auto" }
|
|
397
|
+
],
|
|
398
|
+
[d.QWEN]: [
|
|
399
|
+
{ id: "qwen-flash", name: "Qwen Flash" },
|
|
400
|
+
{ id: "qwen3-vl-plus-2025-12-19", name: "Qwen3 Vl Plus 2025 12 19" },
|
|
401
|
+
{ id: "qwen3-tts-vd-realtime-2025-12-16", name: "Qwen3 Tts Vd Realtime 2025 12 16" },
|
|
402
|
+
{ id: "qwen-image-edit-plus-2025-12-15", name: "Qwen Image Edit Plus 2025 12 15" },
|
|
403
|
+
{ id: "qwen3-omni-flash-2025-12-01", name: "Qwen3 Omni Flash 2025 12 01" },
|
|
404
|
+
{ id: "qwen3-omni-flash-realtime-2025-12-01", name: "Qwen3 Omni Flash Realtime 2025 12 01" },
|
|
405
|
+
{ id: "qwen3-livetranslate-flash-2025-12-01", name: "Qwen3 Livetranslate Flash 2025 12 01" },
|
|
406
|
+
{ id: "qwen3-livetranslate-flash", name: "Qwen3 Livetranslate Flash" },
|
|
407
|
+
{ id: "qwen-plus-2025-12-01", name: "Qwen Plus 2025 12 01" },
|
|
408
|
+
{ id: "qwen3-tts-vc-realtime-2025-11-27", name: "Qwen3 Tts Vc Realtime 2025 11 27" }
|
|
409
|
+
],
|
|
410
|
+
[d.ZHIPU]: [
|
|
411
|
+
{ id: "glm-4.5", name: "Glm 4.5" },
|
|
412
|
+
{ id: "glm-4.5-air", name: "Glm 4.5 Air" },
|
|
413
|
+
{ id: "glm-4.6", name: "Glm 4.6" },
|
|
414
|
+
{ id: "glm-4.7", name: "Glm 4.7" }
|
|
415
|
+
],
|
|
416
|
+
[d.SILICONFLOW]: [
|
|
417
|
+
{ id: "deepseek-ai/DeepSeek-V3.2", name: "Deepseek V3.2" },
|
|
418
|
+
{ id: "deepseek-ai/DeepSeek-V3.1-Terminus", name: "Deepseek V3.1 Terminus" },
|
|
419
|
+
{ id: "deepseek-ai/DeepSeek-R1", name: "Deepseek R1" },
|
|
420
|
+
{ id: "deepseek-ai/DeepSeek-V3", name: "Deepseek V3" },
|
|
421
|
+
{ id: "zai-org/GLM-4.6V", name: "Glm 4.6V" },
|
|
422
|
+
{ id: "zai-org/GLM-4.6", name: "Glm 4.6" },
|
|
423
|
+
{ id: "Pro/zai-org/GLM-4.7", name: "Glm 4.7" },
|
|
424
|
+
{ id: "Qwen/Qwen3-VL-32B-Instruct", name: "Qwen3 Vl 32B Instruct" }
|
|
425
|
+
],
|
|
426
|
+
[d.OLLAMA]: [
|
|
427
|
+
{ id: "llama3.3", name: "Llama 3.3" },
|
|
428
|
+
{ id: "llama3.2", name: "Llama 3.2" },
|
|
429
|
+
{ id: "qwq", name: "QwQ (推理)" },
|
|
430
|
+
{ id: "qwen3:32b", name: "Qwen3 32B" },
|
|
431
|
+
{ id: "deepseek-r1:32b", name: "DeepSeek R1 32B" },
|
|
432
|
+
{ id: "deepseek-coder-v2", name: "DeepSeek Coder V2" },
|
|
433
|
+
{ id: "gemma3:27b", name: "Gemma 3 27B" },
|
|
434
|
+
{ id: "mistral:7b", name: "Mistral 7B" },
|
|
435
|
+
{ id: "phi4", name: "Phi 4" },
|
|
436
|
+
{ id: "codellama", name: "Code Llama" }
|
|
437
|
+
],
|
|
438
|
+
[d.DOUBAO]: [
|
|
439
|
+
{ id: "doubao-seed-1-8-251215", name: "Doubao 1.8" },
|
|
440
|
+
{ id: "doubao-seed-1-6-251015", name: "Doubao 1.6" },
|
|
441
|
+
{ id: "doubao-seed-1-6-lite-251015", name: "Doubao 1.6 Lite" },
|
|
442
|
+
{ id: "doubao-seed-1-6-flash-250828", name: "Doubao 1.6 Flash" },
|
|
443
|
+
{ id: "doubao-seed-1-6-thinking-250615", name: "Doubao 1.6 Thinking" }
|
|
444
|
+
],
|
|
445
|
+
[d.MINIMAX]: [
|
|
446
|
+
{ id: "MiniMax-M2.1", name: "MiniMax M2.1" },
|
|
447
|
+
{ id: "MiniMax-M2.1-lightning", name: "MiniMax M2.1 Lightning" },
|
|
448
|
+
{ id: "MiniMax-M2", name: "MiniMax M2" }
|
|
449
|
+
]
|
|
450
|
+
};
|
|
451
|
+
function Pe(a) {
|
|
452
|
+
return Ta[a] || [];
|
|
453
|
+
}
|
|
454
|
+
const Aa = (a) => Array.isArray(a == null ? void 0 : a.data) ? a.data.filter((t) => t.id).map((t) => {
|
|
455
|
+
const i = t.name || (t.id.split("/").pop() ?? "").replace(/[-_]/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
|
|
456
|
+
return {
|
|
457
|
+
id: t.id,
|
|
458
|
+
name: i,
|
|
459
|
+
created: t.created || 0
|
|
460
|
+
};
|
|
461
|
+
}).sort((t, i) => (i.created || 0) - (t.created || 0)) : [], Xe = {
|
|
462
|
+
format: "openai",
|
|
463
|
+
getModelsEndpoint: (a) => `${a}/models`,
|
|
464
|
+
getChatEndpoint: (a) => `${a}/chat/completions`,
|
|
465
|
+
buildHeaders: (a) => ({
|
|
466
|
+
"Content-Type": "application/json",
|
|
467
|
+
Authorization: `Bearer ${a}`
|
|
468
|
+
}),
|
|
469
|
+
buildChatPayload: (a, t, i) => ({
|
|
470
|
+
model: a,
|
|
471
|
+
messages: t,
|
|
472
|
+
max_tokens: i
|
|
473
|
+
}),
|
|
474
|
+
parseChatResponse: (a) => {
|
|
475
|
+
var t, i, l;
|
|
476
|
+
return ((l = (i = (t = a.choices) == null ? void 0 : t[0]) == null ? void 0 : i.message) == null ? void 0 : l.content) || "";
|
|
477
|
+
}
|
|
478
|
+
}, Pa = {
|
|
479
|
+
format: "anthropic",
|
|
480
|
+
getChatEndpoint: (a) => `${a}/messages`,
|
|
481
|
+
buildHeaders: (a) => ({
|
|
482
|
+
"Content-Type": "application/json",
|
|
483
|
+
"x-api-key": a,
|
|
484
|
+
"anthropic-version": "2023-06-01"
|
|
485
|
+
}),
|
|
486
|
+
buildChatPayload: (a, t, i) => ({
|
|
487
|
+
model: a,
|
|
488
|
+
messages: t,
|
|
489
|
+
max_tokens: i
|
|
490
|
+
}),
|
|
491
|
+
parseChatResponse: (a) => {
|
|
492
|
+
var t, i;
|
|
493
|
+
return ((i = (t = a.content) == null ? void 0 : t[0]) == null ? void 0 : i.text) || "";
|
|
494
|
+
}
|
|
495
|
+
}, Oa = {
|
|
496
|
+
format: "gemini",
|
|
497
|
+
getModelsEndpoint: (a, t) => `${a}/models?key=${t}`,
|
|
498
|
+
getChatEndpoint: (a, t, i) => `${a}/models/${i}:generateContent?key=${t}`,
|
|
499
|
+
buildHeaders: () => ({
|
|
500
|
+
"Content-Type": "application/json"
|
|
501
|
+
}),
|
|
502
|
+
buildChatPayload: (a, t, i) => ({
|
|
503
|
+
contents: t.map((p) => ({
|
|
504
|
+
role: p.role === "assistant" ? "model" : "user",
|
|
505
|
+
parts: [{ text: p.content }]
|
|
506
|
+
})),
|
|
507
|
+
generationConfig: { maxOutputTokens: i }
|
|
508
|
+
}),
|
|
509
|
+
parseChatResponse: (a) => {
|
|
510
|
+
var t, i, l, p, c;
|
|
511
|
+
return ((c = (p = (l = (i = (t = a.candidates) == null ? void 0 : t[0]) == null ? void 0 : i.content) == null ? void 0 : l.parts) == null ? void 0 : p[0]) == null ? void 0 : c.text) || "";
|
|
512
|
+
},
|
|
513
|
+
// Gemini 返回格式: { models: [{ name: "models/gemini-pro", ... }] }
|
|
514
|
+
parseModelsResponse: (a) => Array.isArray(a.models) ? a.models.filter((t) => {
|
|
515
|
+
var i;
|
|
516
|
+
return (i = t.supportedGenerationMethods) == null ? void 0 : i.includes("generateContent");
|
|
517
|
+
}).map((t) => ({
|
|
518
|
+
id: t.name.replace("models/", ""),
|
|
519
|
+
// "models/gemini-pro" -> "gemini-pro"
|
|
520
|
+
name: t.displayName || t.name.replace("models/", ""),
|
|
521
|
+
created: t.created || 0
|
|
522
|
+
})).sort((t, i) => (i.created || 0) - (t.created || 0)) : []
|
|
523
|
+
}, Ia = {
|
|
524
|
+
format: "cohere",
|
|
525
|
+
getModelsEndpoint: (a) => `${a}/models`,
|
|
526
|
+
getChatEndpoint: (a) => `${a}/chat`,
|
|
527
|
+
buildHeaders: (a) => ({
|
|
528
|
+
"Content-Type": "application/json",
|
|
529
|
+
Authorization: `Bearer ${a}`
|
|
530
|
+
}),
|
|
531
|
+
buildChatPayload: (a, t, i) => {
|
|
532
|
+
const l = t[t.length - 1], p = t.slice(0, -1).map((c) => ({
|
|
533
|
+
role: c.role === "assistant" ? "CHATBOT" : "USER",
|
|
534
|
+
message: c.content
|
|
535
|
+
}));
|
|
536
|
+
return {
|
|
537
|
+
model: a,
|
|
538
|
+
message: l.content,
|
|
539
|
+
chat_history: p,
|
|
540
|
+
max_tokens: i
|
|
541
|
+
};
|
|
542
|
+
},
|
|
543
|
+
parseChatResponse: (a) => a.text || ""
|
|
544
|
+
}, Sa = {
|
|
545
|
+
openai: Xe,
|
|
546
|
+
anthropic: Pa,
|
|
547
|
+
gemini: Oa,
|
|
548
|
+
cohere: Ia
|
|
549
|
+
};
|
|
550
|
+
function Ie(a) {
|
|
551
|
+
return Sa[a] || Xe;
|
|
552
|
+
}
|
|
553
|
+
async function Na(a) {
|
|
554
|
+
var g;
|
|
555
|
+
const { apiFormat: t, baseUrl: i, apiKey: l, model: p, messages: c, maxTokens: b = 2048 } = a, m = Ie(t), s = m.getChatEndpoint(i, l, p), u = m.buildHeaders(l), f = m.buildChatPayload(p, c, b), w = performance.now();
|
|
556
|
+
try {
|
|
557
|
+
const C = await fetch(s, {
|
|
558
|
+
method: "POST",
|
|
559
|
+
headers: u,
|
|
560
|
+
body: JSON.stringify(f)
|
|
561
|
+
}), k = Math.round(performance.now() - w);
|
|
562
|
+
if (!C.ok)
|
|
563
|
+
return {
|
|
564
|
+
success: !1,
|
|
565
|
+
message: ((g = (await C.json().catch(() => ({}))).error) == null ? void 0 : g.message) || `HTTP ${C.status}: ${C.statusText}`,
|
|
566
|
+
latencyMs: k
|
|
567
|
+
};
|
|
568
|
+
const L = await C.json();
|
|
569
|
+
return {
|
|
570
|
+
success: !0,
|
|
571
|
+
content: m.parseChatResponse(L),
|
|
572
|
+
latencyMs: k
|
|
573
|
+
};
|
|
574
|
+
} catch (C) {
|
|
575
|
+
return {
|
|
576
|
+
success: !1,
|
|
577
|
+
message: C instanceof Error ? C.message : "网络错误"
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
async function at(a) {
|
|
582
|
+
const t = await Na({
|
|
583
|
+
apiFormat: a.apiFormat,
|
|
584
|
+
baseUrl: a.baseUrl,
|
|
585
|
+
apiKey: a.apiKey,
|
|
586
|
+
model: a.model,
|
|
587
|
+
messages: [{ role: "user", content: "Hi" }],
|
|
588
|
+
maxTokens: 5
|
|
589
|
+
// 最小 token 数,节省成本
|
|
590
|
+
});
|
|
591
|
+
return {
|
|
592
|
+
success: t.success,
|
|
593
|
+
latencyMs: t.latencyMs,
|
|
594
|
+
message: t.success ? void 0 : t.message
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
async function La(a) {
|
|
598
|
+
const { provider: t, apiKey: i, model: l, baseUrl: p, proxyUrl: c } = a, b = p || t.baseUrl, m = Date.now();
|
|
599
|
+
try {
|
|
600
|
+
if (c) {
|
|
601
|
+
const A = await (await fetch(`${c}/test`, {
|
|
602
|
+
method: "POST",
|
|
603
|
+
headers: { "Content-Type": "application/json" },
|
|
604
|
+
body: JSON.stringify({
|
|
605
|
+
provider_id: t.id,
|
|
606
|
+
api_key: i,
|
|
607
|
+
model: l || "",
|
|
608
|
+
base_url: p || t.baseUrl,
|
|
609
|
+
api_format: t.apiFormat
|
|
610
|
+
})
|
|
611
|
+
})).json();
|
|
612
|
+
return {
|
|
613
|
+
success: A.success,
|
|
614
|
+
latencyMs: A.latency_ms || Date.now() - m,
|
|
615
|
+
message: A.message
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
const s = Ie(t.apiFormat), u = l || "";
|
|
619
|
+
if (!u)
|
|
620
|
+
return {
|
|
621
|
+
success: !1,
|
|
622
|
+
latencyMs: 0,
|
|
623
|
+
message: "请先选择模型 (Please select a model)"
|
|
624
|
+
};
|
|
625
|
+
const f = s.buildHeaders(i), w = s.buildChatPayload(u, [{ role: "user", content: "Hi" }], 5), g = s.getChatEndpoint(b, i, u), C = await fetch(g, {
|
|
626
|
+
method: "POST",
|
|
627
|
+
headers: f,
|
|
628
|
+
body: JSON.stringify(w)
|
|
629
|
+
}), k = Date.now() - m;
|
|
630
|
+
if (C.ok)
|
|
631
|
+
return { success: !0, latencyMs: k, message: "连接成功" };
|
|
632
|
+
{
|
|
633
|
+
const L = await C.text();
|
|
634
|
+
return {
|
|
635
|
+
success: !1,
|
|
636
|
+
latencyMs: k,
|
|
637
|
+
message: `HTTP ${C.status}: ${L.slice(0, 200)}`
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
} catch (s) {
|
|
641
|
+
return {
|
|
642
|
+
success: !1,
|
|
643
|
+
latencyMs: Date.now() - m,
|
|
644
|
+
message: s instanceof Error ? s.message : String(s)
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
async function tt(a) {
|
|
649
|
+
var b;
|
|
650
|
+
const { provider: t, apiKey: i, baseUrl: l, proxyUrl: p, fallbackToStatic: c = !0 } = a;
|
|
651
|
+
if (p)
|
|
652
|
+
try {
|
|
653
|
+
const s = await (await fetch(`${p}/models`, {
|
|
654
|
+
method: "POST",
|
|
655
|
+
headers: { "Content-Type": "application/json" },
|
|
656
|
+
body: JSON.stringify({
|
|
657
|
+
provider_id: t.id,
|
|
658
|
+
api_key: i || void 0,
|
|
659
|
+
base_url: l || t.baseUrl
|
|
660
|
+
})
|
|
661
|
+
})).json();
|
|
662
|
+
if (s.success && ((b = s.models) == null ? void 0 : b.length) > 0)
|
|
663
|
+
return s.models;
|
|
664
|
+
} catch (m) {
|
|
665
|
+
if (console.warn("Failed to fetch models via proxy:", m), !c)
|
|
666
|
+
throw m;
|
|
667
|
+
}
|
|
668
|
+
if (!p && t.supportsModelsApi)
|
|
669
|
+
try {
|
|
670
|
+
const m = Ie(t.apiFormat);
|
|
671
|
+
if (m.getModelsEndpoint) {
|
|
672
|
+
const s = m.getModelsEndpoint(l || t.baseUrl, i || ""), u = m.buildHeaders(i || ""), f = await fetch(s, {
|
|
673
|
+
method: "GET",
|
|
674
|
+
headers: u
|
|
675
|
+
});
|
|
676
|
+
if (f.ok) {
|
|
677
|
+
const w = await f.json();
|
|
678
|
+
return (m.parseModelsResponse || Aa)(w);
|
|
679
|
+
} else if (!c)
|
|
680
|
+
throw new Error(`HTTP ${f.status}`);
|
|
681
|
+
}
|
|
682
|
+
} catch (m) {
|
|
683
|
+
if (console.warn("Failed to fetch models directly:", m), !c)
|
|
684
|
+
throw m;
|
|
685
|
+
}
|
|
686
|
+
if (!c && t.supportsModelsApi)
|
|
687
|
+
throw new Error("Failed to fetch models");
|
|
688
|
+
return Pe(t.id);
|
|
689
|
+
}
|
|
690
|
+
const Ae = "ai_provider_config", _a = {
|
|
691
|
+
get: (a) => typeof window > "u" ? null : localStorage.getItem(a),
|
|
692
|
+
set: (a, t) => {
|
|
693
|
+
typeof window > "u" || localStorage.setItem(a, t);
|
|
694
|
+
},
|
|
695
|
+
remove: (a) => {
|
|
696
|
+
typeof window > "u" || localStorage.removeItem(a);
|
|
697
|
+
}
|
|
698
|
+
};
|
|
699
|
+
function Fa(a = _a, t = {}) {
|
|
700
|
+
const i = t.serialize || JSON.stringify, l = t.deserialize || JSON.parse;
|
|
701
|
+
return {
|
|
702
|
+
/**
|
|
703
|
+
* Save AI config
|
|
704
|
+
*/
|
|
705
|
+
save(p) {
|
|
706
|
+
try {
|
|
707
|
+
const c = i(p);
|
|
708
|
+
a.set(Ae, c);
|
|
709
|
+
} catch (c) {
|
|
710
|
+
console.error("Failed to save config:", c);
|
|
711
|
+
}
|
|
712
|
+
},
|
|
713
|
+
/**
|
|
714
|
+
* Load AI config
|
|
715
|
+
*/
|
|
716
|
+
load() {
|
|
717
|
+
const p = a.get(Ae);
|
|
718
|
+
if (!p)
|
|
719
|
+
return null;
|
|
720
|
+
try {
|
|
721
|
+
return l(p);
|
|
722
|
+
} catch (c) {
|
|
723
|
+
return console.error("Failed to load config:", c), null;
|
|
724
|
+
}
|
|
725
|
+
},
|
|
726
|
+
/**
|
|
727
|
+
* Clear AI config
|
|
728
|
+
*/
|
|
729
|
+
clear() {
|
|
730
|
+
a.remove(Ae);
|
|
731
|
+
}
|
|
732
|
+
};
|
|
733
|
+
}
|
|
734
|
+
function Ze(a) {
|
|
735
|
+
if (!a)
|
|
736
|
+
return {
|
|
737
|
+
providers: Object.values(Ee),
|
|
738
|
+
getModels: (s) => Pe(s)
|
|
739
|
+
};
|
|
740
|
+
const { mode: t, include: i, exclude: l, custom: p } = a;
|
|
741
|
+
let c = [];
|
|
742
|
+
if (t === "default") {
|
|
743
|
+
let s = Object.values(Ee);
|
|
744
|
+
i && i.length > 0 && (s = s.filter((u) => i.includes(u.id))), l && l.length > 0 && (s = s.filter((u) => !l.includes(u.id))), c = [...s];
|
|
745
|
+
}
|
|
746
|
+
const b = {};
|
|
747
|
+
if (p)
|
|
748
|
+
for (const [s, u] of Object.entries(p)) {
|
|
749
|
+
const f = {
|
|
750
|
+
id: s,
|
|
751
|
+
name: u.name,
|
|
752
|
+
baseUrl: u.baseUrl,
|
|
753
|
+
needsApiKey: u.needsApiKey,
|
|
754
|
+
apiFormat: u.apiFormat,
|
|
755
|
+
supportsModelsApi: u.supportsModelsApi ?? !1,
|
|
756
|
+
icon: u.icon
|
|
757
|
+
}, w = c.findIndex((g) => g.id === s);
|
|
758
|
+
w >= 0 ? c[w] = {
|
|
759
|
+
...c[w],
|
|
760
|
+
...f,
|
|
761
|
+
icon: f.icon || c[w].icon
|
|
762
|
+
} : c.push(f), u.models && u.models.length > 0 && (b[s] = u.models);
|
|
763
|
+
}
|
|
764
|
+
return { providers: c, getModels: (s) => b[s] ? b[s] : Pe(s) };
|
|
765
|
+
}
|
|
766
|
+
function rt(a, t) {
|
|
767
|
+
const { providers: i } = Ze(t);
|
|
768
|
+
return i.find((l) => l.id === a) || null;
|
|
769
|
+
}
|
|
770
|
+
function Ba(a = {}) {
|
|
771
|
+
var X, J, Z, ee, ae;
|
|
772
|
+
const [t, i] = B(((X = a.initialConfig) == null ? void 0 : X.providerId) || ""), [l, p] = B(((J = a.initialConfig) == null ? void 0 : J.apiKey) || ""), [c, b] = B(((Z = a.initialConfig) == null ? void 0 : Z.model) || ""), [m, s] = B(((ee = a.initialConfig) == null ? void 0 : ee.modelName) || ""), [u, f] = B(((ae = a.initialConfig) == null ? void 0 : ae.baseUrl) || ""), [w, g] = B([]), [C, k] = B("idle"), [L, A] = B(null), [_, R] = B(!1), [T, Q] = B(null), F = de(
|
|
773
|
+
() => Ze(a.providerConfig),
|
|
774
|
+
[a.providerConfig]
|
|
775
|
+
), P = F.providers, E = de(
|
|
776
|
+
() => P.find((v) => v.id === t) || null,
|
|
777
|
+
[P, t]
|
|
778
|
+
), W = de(() => Fa(void 0, {
|
|
779
|
+
serialize: a.onSerialize,
|
|
780
|
+
deserialize: a.onDeserialize
|
|
781
|
+
}), [a.onSerialize, a.onDeserialize]), Y = Oe(/* @__PURE__ */ new Map());
|
|
782
|
+
se(() => {
|
|
783
|
+
const v = W.load();
|
|
784
|
+
v && (v.providerId && i(v.providerId), v.apiKey && p(v.apiKey), v.model && b(v.model), v.modelName && s(v.modelName), v.baseUrl && f(v.baseUrl));
|
|
785
|
+
}, [W]), se(() => {
|
|
786
|
+
if (!t || !E) {
|
|
787
|
+
g([]), Q(null), R(!1);
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
790
|
+
const v = E.supportsModelsApi && (!E.needsApiKey || !!l), O = u || E.baseUrl, D = `${t}|${O}|${l}`, q = Y.current.get(D);
|
|
791
|
+
if (q) {
|
|
792
|
+
g(q), Q(null), R(!1);
|
|
793
|
+
return;
|
|
794
|
+
}
|
|
795
|
+
if (!v) {
|
|
796
|
+
const K = F.getModels(t);
|
|
797
|
+
g(K), Y.current.set(D, K), Q(null), R(!1);
|
|
798
|
+
return;
|
|
799
|
+
}
|
|
800
|
+
R(!0), Q(null), w.length === 0 && g(F.getModels(t));
|
|
801
|
+
const te = setTimeout(async () => {
|
|
802
|
+
try {
|
|
803
|
+
let K;
|
|
804
|
+
a.modelFetcher ? K = await a.modelFetcher({
|
|
805
|
+
type: "fetchModels",
|
|
806
|
+
providerId: E.id,
|
|
807
|
+
baseUrl: O,
|
|
808
|
+
apiKey: l
|
|
809
|
+
}) : K = await import("./index-BseB50dK.js").then((re) => re.fetchModels({
|
|
810
|
+
provider: E,
|
|
811
|
+
apiKey: l,
|
|
812
|
+
baseUrl: O,
|
|
813
|
+
proxyUrl: a.proxyUrl,
|
|
814
|
+
fallbackToStatic: !1
|
|
815
|
+
})), g(K), Y.current.set(D, K);
|
|
816
|
+
} catch (K) {
|
|
817
|
+
console.warn("Model fetch failed:", K), Q("fetchModelsFailed");
|
|
818
|
+
const re = F.getModels(t);
|
|
819
|
+
g(re);
|
|
820
|
+
} finally {
|
|
821
|
+
R(!1);
|
|
822
|
+
}
|
|
823
|
+
}, 500);
|
|
824
|
+
return () => clearTimeout(te);
|
|
825
|
+
}, [t, E, l, u, F, a.proxyUrl, a.modelFetcher]), se(() => {
|
|
826
|
+
(C === "error" || C === "success") && (k("idle"), A(null));
|
|
827
|
+
}, [l, u]);
|
|
828
|
+
const me = ue(async () => {
|
|
829
|
+
if (!E || E.needsApiKey && !l) return;
|
|
830
|
+
k("testing"), A(null);
|
|
831
|
+
let v;
|
|
832
|
+
if (a.modelFetcher)
|
|
833
|
+
try {
|
|
834
|
+
const O = await a.modelFetcher({
|
|
835
|
+
type: "checkConnection",
|
|
836
|
+
providerId: E.id,
|
|
837
|
+
baseUrl: u || E.baseUrl,
|
|
838
|
+
apiKey: l,
|
|
839
|
+
modelId: c
|
|
840
|
+
});
|
|
841
|
+
v = {
|
|
842
|
+
success: O.success,
|
|
843
|
+
latencyMs: O.latency || O.latencyMs,
|
|
844
|
+
message: O.message
|
|
845
|
+
};
|
|
846
|
+
} catch (O) {
|
|
847
|
+
v = { success: !1, message: O.message || "Unknown error" };
|
|
848
|
+
}
|
|
849
|
+
else
|
|
850
|
+
v = await La({
|
|
851
|
+
provider: E,
|
|
852
|
+
apiKey: l,
|
|
853
|
+
baseUrl: u,
|
|
854
|
+
model: c,
|
|
855
|
+
proxyUrl: a.proxyUrl
|
|
856
|
+
});
|
|
857
|
+
return A(v), k(v.success ? "success" : "error"), setTimeout(() => {
|
|
858
|
+
k("idle");
|
|
859
|
+
}, 2e3), v;
|
|
860
|
+
}, [E, l, u, c, a.proxyUrl, a.modelFetcher]), pe = ue(() => {
|
|
861
|
+
const v = w.find((D) => D.id === c), O = (v == null ? void 0 : v.name) || m || c;
|
|
862
|
+
v != null && v.name && v.name !== m && s(v.name), W.save({
|
|
863
|
+
providerId: t,
|
|
864
|
+
apiKey: l,
|
|
865
|
+
model: c,
|
|
866
|
+
modelName: O,
|
|
867
|
+
baseUrl: u
|
|
868
|
+
});
|
|
869
|
+
}, [t, l, c, m, u, w, W]), ie = ue(() => {
|
|
870
|
+
W.clear(), i(""), p(""), b(""), s(""), f("");
|
|
871
|
+
}, [W]), G = ue((v) => {
|
|
872
|
+
i(v), p(""), b(""), s(""), f(""), k("idle"), A(null);
|
|
873
|
+
}, []), z = ue((v, O) => {
|
|
874
|
+
if (b(v), O)
|
|
875
|
+
s(O);
|
|
876
|
+
else {
|
|
877
|
+
const D = w.find((q) => q.id === v);
|
|
878
|
+
s((D == null ? void 0 : D.name) || v);
|
|
879
|
+
}
|
|
880
|
+
}, [w]), H = de(() => !(!t || !c || E != null && E.needsApiKey && !l), [t, c, E, l]);
|
|
881
|
+
return {
|
|
882
|
+
// State
|
|
883
|
+
config: de(() => ({
|
|
884
|
+
providerId: t,
|
|
885
|
+
apiKey: l,
|
|
886
|
+
model: c,
|
|
887
|
+
modelName: m,
|
|
888
|
+
baseUrl: u || (E == null ? void 0 : E.baseUrl) || ""
|
|
889
|
+
}), [t, l, c, m, u, E]),
|
|
890
|
+
providerId: t,
|
|
891
|
+
apiKey: l,
|
|
892
|
+
model: c,
|
|
893
|
+
modelName: m,
|
|
894
|
+
baseUrl: u,
|
|
895
|
+
models: w,
|
|
896
|
+
testStatus: C,
|
|
897
|
+
testResult: L,
|
|
898
|
+
isFetchingModels: _,
|
|
899
|
+
fetchModelError: T,
|
|
900
|
+
provider: E,
|
|
901
|
+
providers: P,
|
|
902
|
+
isValid: H,
|
|
903
|
+
// Actions
|
|
904
|
+
setProviderId: G,
|
|
905
|
+
setApiKey: p,
|
|
906
|
+
setModel: b,
|
|
907
|
+
selectModel: z,
|
|
908
|
+
setBaseUrl: f,
|
|
909
|
+
runTest: me,
|
|
910
|
+
save: pe,
|
|
911
|
+
clear: ie
|
|
912
|
+
};
|
|
913
|
+
}
|
|
914
|
+
var ke = { exports: {} }, ve = {};
|
|
915
|
+
/**
|
|
916
|
+
* @license React
|
|
917
|
+
* react-jsx-runtime.production.min.js
|
|
918
|
+
*
|
|
919
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
920
|
+
*
|
|
921
|
+
* This source code is licensed under the MIT license found in the
|
|
922
|
+
* LICENSE file in the root directory of this source tree.
|
|
923
|
+
*/
|
|
924
|
+
var He;
|
|
925
|
+
function Ua() {
|
|
926
|
+
if (He) return ve;
|
|
927
|
+
He = 1;
|
|
928
|
+
var a = Je, t = Symbol.for("react.element"), i = Symbol.for("react.fragment"), l = Object.prototype.hasOwnProperty, p = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, c = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
929
|
+
function b(m, s, u) {
|
|
930
|
+
var f, w = {}, g = null, C = null;
|
|
931
|
+
u !== void 0 && (g = "" + u), s.key !== void 0 && (g = "" + s.key), s.ref !== void 0 && (C = s.ref);
|
|
932
|
+
for (f in s) l.call(s, f) && !c.hasOwnProperty(f) && (w[f] = s[f]);
|
|
933
|
+
if (m && m.defaultProps) for (f in s = m.defaultProps, s) w[f] === void 0 && (w[f] = s[f]);
|
|
934
|
+
return { $$typeof: t, type: m, key: g, ref: C, props: w, _owner: p.current };
|
|
935
|
+
}
|
|
936
|
+
return ve.Fragment = i, ve.jsx = b, ve.jsxs = b, ve;
|
|
937
|
+
}
|
|
938
|
+
var ge = {};
|
|
939
|
+
/**
|
|
940
|
+
* @license React
|
|
941
|
+
* react-jsx-runtime.development.js
|
|
942
|
+
*
|
|
943
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
944
|
+
*
|
|
945
|
+
* This source code is licensed under the MIT license found in the
|
|
946
|
+
* LICENSE file in the root directory of this source tree.
|
|
947
|
+
*/
|
|
948
|
+
var qe;
|
|
949
|
+
function Da() {
|
|
950
|
+
return qe || (qe = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
951
|
+
var a = Je, t = Symbol.for("react.element"), i = Symbol.for("react.portal"), l = Symbol.for("react.fragment"), p = Symbol.for("react.strict_mode"), c = Symbol.for("react.profiler"), b = Symbol.for("react.provider"), m = Symbol.for("react.context"), s = Symbol.for("react.forward_ref"), u = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), w = Symbol.for("react.memo"), g = Symbol.for("react.lazy"), C = Symbol.for("react.offscreen"), k = Symbol.iterator, L = "@@iterator";
|
|
952
|
+
function A(e) {
|
|
953
|
+
if (e === null || typeof e != "object")
|
|
954
|
+
return null;
|
|
955
|
+
var n = k && e[k] || e[L];
|
|
956
|
+
return typeof n == "function" ? n : null;
|
|
957
|
+
}
|
|
958
|
+
var _ = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
959
|
+
function R(e) {
|
|
960
|
+
{
|
|
961
|
+
for (var n = arguments.length, o = new Array(n > 1 ? n - 1 : 0), h = 1; h < n; h++)
|
|
962
|
+
o[h - 1] = arguments[h];
|
|
963
|
+
T("error", e, o);
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
function T(e, n, o) {
|
|
967
|
+
{
|
|
968
|
+
var h = _.ReactDebugCurrentFrame, M = h.getStackAddendum();
|
|
969
|
+
M !== "" && (n += "%s", o = o.concat([M]));
|
|
970
|
+
var j = o.map(function(x) {
|
|
971
|
+
return String(x);
|
|
972
|
+
});
|
|
973
|
+
j.unshift("Warning: " + n), Function.prototype.apply.call(console[e], console, j);
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
var Q = !1, F = !1, P = !1, E = !1, W = !1, Y;
|
|
977
|
+
Y = Symbol.for("react.module.reference");
|
|
978
|
+
function me(e) {
|
|
979
|
+
return !!(typeof e == "string" || typeof e == "function" || e === l || e === c || W || e === p || e === u || e === f || E || e === C || Q || F || P || typeof e == "object" && e !== null && (e.$$typeof === g || e.$$typeof === w || e.$$typeof === b || e.$$typeof === m || e.$$typeof === s || // This needs to include all possible module reference object
|
|
980
|
+
// types supported by any Flight configuration anywhere since
|
|
981
|
+
// we don't know which Flight build this will end up being used
|
|
982
|
+
// with.
|
|
983
|
+
e.$$typeof === Y || e.getModuleId !== void 0));
|
|
984
|
+
}
|
|
985
|
+
function pe(e, n, o) {
|
|
986
|
+
var h = e.displayName;
|
|
987
|
+
if (h)
|
|
988
|
+
return h;
|
|
989
|
+
var M = n.displayName || n.name || "";
|
|
990
|
+
return M !== "" ? o + "(" + M + ")" : o;
|
|
991
|
+
}
|
|
992
|
+
function ie(e) {
|
|
993
|
+
return e.displayName || "Context";
|
|
994
|
+
}
|
|
995
|
+
function G(e) {
|
|
996
|
+
if (e == null)
|
|
997
|
+
return null;
|
|
998
|
+
if (typeof e.tag == "number" && R("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
999
|
+
return e.displayName || e.name || null;
|
|
1000
|
+
if (typeof e == "string")
|
|
1001
|
+
return e;
|
|
1002
|
+
switch (e) {
|
|
1003
|
+
case l:
|
|
1004
|
+
return "Fragment";
|
|
1005
|
+
case i:
|
|
1006
|
+
return "Portal";
|
|
1007
|
+
case c:
|
|
1008
|
+
return "Profiler";
|
|
1009
|
+
case p:
|
|
1010
|
+
return "StrictMode";
|
|
1011
|
+
case u:
|
|
1012
|
+
return "Suspense";
|
|
1013
|
+
case f:
|
|
1014
|
+
return "SuspenseList";
|
|
1015
|
+
}
|
|
1016
|
+
if (typeof e == "object")
|
|
1017
|
+
switch (e.$$typeof) {
|
|
1018
|
+
case m:
|
|
1019
|
+
var n = e;
|
|
1020
|
+
return ie(n) + ".Consumer";
|
|
1021
|
+
case b:
|
|
1022
|
+
var o = e;
|
|
1023
|
+
return ie(o._context) + ".Provider";
|
|
1024
|
+
case s:
|
|
1025
|
+
return pe(e, e.render, "ForwardRef");
|
|
1026
|
+
case w:
|
|
1027
|
+
var h = e.displayName || null;
|
|
1028
|
+
return h !== null ? h : G(e.type) || "Memo";
|
|
1029
|
+
case g: {
|
|
1030
|
+
var M = e, j = M._payload, x = M._init;
|
|
1031
|
+
try {
|
|
1032
|
+
return G(x(j));
|
|
1033
|
+
} catch {
|
|
1034
|
+
return null;
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
return null;
|
|
1039
|
+
}
|
|
1040
|
+
var z = Object.assign, H = 0, fe, X, J, Z, ee, ae, v;
|
|
1041
|
+
function O() {
|
|
1042
|
+
}
|
|
1043
|
+
O.__reactDisabledLog = !0;
|
|
1044
|
+
function D() {
|
|
1045
|
+
{
|
|
1046
|
+
if (H === 0) {
|
|
1047
|
+
fe = console.log, X = console.info, J = console.warn, Z = console.error, ee = console.group, ae = console.groupCollapsed, v = console.groupEnd;
|
|
1048
|
+
var e = {
|
|
1049
|
+
configurable: !0,
|
|
1050
|
+
enumerable: !0,
|
|
1051
|
+
value: O,
|
|
1052
|
+
writable: !0
|
|
1053
|
+
};
|
|
1054
|
+
Object.defineProperties(console, {
|
|
1055
|
+
info: e,
|
|
1056
|
+
log: e,
|
|
1057
|
+
warn: e,
|
|
1058
|
+
error: e,
|
|
1059
|
+
group: e,
|
|
1060
|
+
groupCollapsed: e,
|
|
1061
|
+
groupEnd: e
|
|
1062
|
+
});
|
|
1063
|
+
}
|
|
1064
|
+
H++;
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
function q() {
|
|
1068
|
+
{
|
|
1069
|
+
if (H--, H === 0) {
|
|
1070
|
+
var e = {
|
|
1071
|
+
configurable: !0,
|
|
1072
|
+
enumerable: !0,
|
|
1073
|
+
writable: !0
|
|
1074
|
+
};
|
|
1075
|
+
Object.defineProperties(console, {
|
|
1076
|
+
log: z({}, e, {
|
|
1077
|
+
value: fe
|
|
1078
|
+
}),
|
|
1079
|
+
info: z({}, e, {
|
|
1080
|
+
value: X
|
|
1081
|
+
}),
|
|
1082
|
+
warn: z({}, e, {
|
|
1083
|
+
value: J
|
|
1084
|
+
}),
|
|
1085
|
+
error: z({}, e, {
|
|
1086
|
+
value: Z
|
|
1087
|
+
}),
|
|
1088
|
+
group: z({}, e, {
|
|
1089
|
+
value: ee
|
|
1090
|
+
}),
|
|
1091
|
+
groupCollapsed: z({}, e, {
|
|
1092
|
+
value: ae
|
|
1093
|
+
}),
|
|
1094
|
+
groupEnd: z({}, e, {
|
|
1095
|
+
value: v
|
|
1096
|
+
})
|
|
1097
|
+
});
|
|
1098
|
+
}
|
|
1099
|
+
H < 0 && R("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
var oe = _.ReactCurrentDispatcher, te;
|
|
1103
|
+
function K(e, n, o) {
|
|
1104
|
+
{
|
|
1105
|
+
if (te === void 0)
|
|
1106
|
+
try {
|
|
1107
|
+
throw Error();
|
|
1108
|
+
} catch (M) {
|
|
1109
|
+
var h = M.stack.trim().match(/\n( *(at )?)/);
|
|
1110
|
+
te = h && h[1] || "";
|
|
1111
|
+
}
|
|
1112
|
+
return `
|
|
1113
|
+
` + te + e;
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
var re = !1, ye;
|
|
1117
|
+
{
|
|
1118
|
+
var aa = typeof WeakMap == "function" ? WeakMap : Map;
|
|
1119
|
+
ye = new aa();
|
|
1120
|
+
}
|
|
1121
|
+
function Se(e, n) {
|
|
1122
|
+
if (!e || re)
|
|
1123
|
+
return "";
|
|
1124
|
+
{
|
|
1125
|
+
var o = ye.get(e);
|
|
1126
|
+
if (o !== void 0)
|
|
1127
|
+
return o;
|
|
1128
|
+
}
|
|
1129
|
+
var h;
|
|
1130
|
+
re = !0;
|
|
1131
|
+
var M = Error.prepareStackTrace;
|
|
1132
|
+
Error.prepareStackTrace = void 0;
|
|
1133
|
+
var j;
|
|
1134
|
+
j = oe.current, oe.current = null, D();
|
|
1135
|
+
try {
|
|
1136
|
+
if (n) {
|
|
1137
|
+
var x = function() {
|
|
1138
|
+
throw Error();
|
|
1139
|
+
};
|
|
1140
|
+
if (Object.defineProperty(x.prototype, "props", {
|
|
1141
|
+
set: function() {
|
|
1142
|
+
throw Error();
|
|
1143
|
+
}
|
|
1144
|
+
}), typeof Reflect == "object" && Reflect.construct) {
|
|
1145
|
+
try {
|
|
1146
|
+
Reflect.construct(x, []);
|
|
1147
|
+
} catch ($) {
|
|
1148
|
+
h = $;
|
|
1149
|
+
}
|
|
1150
|
+
Reflect.construct(e, [], x);
|
|
1151
|
+
} else {
|
|
1152
|
+
try {
|
|
1153
|
+
x.call();
|
|
1154
|
+
} catch ($) {
|
|
1155
|
+
h = $;
|
|
1156
|
+
}
|
|
1157
|
+
e.call(x.prototype);
|
|
1158
|
+
}
|
|
1159
|
+
} else {
|
|
1160
|
+
try {
|
|
1161
|
+
throw Error();
|
|
1162
|
+
} catch ($) {
|
|
1163
|
+
h = $;
|
|
1164
|
+
}
|
|
1165
|
+
e();
|
|
1166
|
+
}
|
|
1167
|
+
} catch ($) {
|
|
1168
|
+
if ($ && h && typeof $.stack == "string") {
|
|
1169
|
+
for (var y = $.stack.split(`
|
|
1170
|
+
`), U = h.stack.split(`
|
|
1171
|
+
`), I = y.length - 1, S = U.length - 1; I >= 1 && S >= 0 && y[I] !== U[S]; )
|
|
1172
|
+
S--;
|
|
1173
|
+
for (; I >= 1 && S >= 0; I--, S--)
|
|
1174
|
+
if (y[I] !== U[S]) {
|
|
1175
|
+
if (I !== 1 || S !== 1)
|
|
1176
|
+
do
|
|
1177
|
+
if (I--, S--, S < 0 || y[I] !== U[S]) {
|
|
1178
|
+
var V = `
|
|
1179
|
+
` + y[I].replace(" at new ", " at ");
|
|
1180
|
+
return e.displayName && V.includes("<anonymous>") && (V = V.replace("<anonymous>", e.displayName)), typeof e == "function" && ye.set(e, V), V;
|
|
1181
|
+
}
|
|
1182
|
+
while (I >= 1 && S >= 0);
|
|
1183
|
+
break;
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
} finally {
|
|
1187
|
+
re = !1, oe.current = j, q(), Error.prepareStackTrace = M;
|
|
1188
|
+
}
|
|
1189
|
+
var ce = e ? e.displayName || e.name : "", ne = ce ? K(ce) : "";
|
|
1190
|
+
return typeof e == "function" && ye.set(e, ne), ne;
|
|
1191
|
+
}
|
|
1192
|
+
function ta(e, n, o) {
|
|
1193
|
+
return Se(e, !1);
|
|
1194
|
+
}
|
|
1195
|
+
function ra(e) {
|
|
1196
|
+
var n = e.prototype;
|
|
1197
|
+
return !!(n && n.isReactComponent);
|
|
1198
|
+
}
|
|
1199
|
+
function xe(e, n, o) {
|
|
1200
|
+
if (e == null)
|
|
1201
|
+
return "";
|
|
1202
|
+
if (typeof e == "function")
|
|
1203
|
+
return Se(e, ra(e));
|
|
1204
|
+
if (typeof e == "string")
|
|
1205
|
+
return K(e);
|
|
1206
|
+
switch (e) {
|
|
1207
|
+
case u:
|
|
1208
|
+
return K("Suspense");
|
|
1209
|
+
case f:
|
|
1210
|
+
return K("SuspenseList");
|
|
1211
|
+
}
|
|
1212
|
+
if (typeof e == "object")
|
|
1213
|
+
switch (e.$$typeof) {
|
|
1214
|
+
case s:
|
|
1215
|
+
return ta(e.render);
|
|
1216
|
+
case w:
|
|
1217
|
+
return xe(e.type, n, o);
|
|
1218
|
+
case g: {
|
|
1219
|
+
var h = e, M = h._payload, j = h._init;
|
|
1220
|
+
try {
|
|
1221
|
+
return xe(j(M), n, o);
|
|
1222
|
+
} catch {
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
return "";
|
|
1227
|
+
}
|
|
1228
|
+
var he = Object.prototype.hasOwnProperty, Ne = {}, Le = _.ReactDebugCurrentFrame;
|
|
1229
|
+
function we(e) {
|
|
1230
|
+
if (e) {
|
|
1231
|
+
var n = e._owner, o = xe(e.type, e._source, n ? n.type : null);
|
|
1232
|
+
Le.setExtraStackFrame(o);
|
|
1233
|
+
} else
|
|
1234
|
+
Le.setExtraStackFrame(null);
|
|
1235
|
+
}
|
|
1236
|
+
function na(e, n, o, h, M) {
|
|
1237
|
+
{
|
|
1238
|
+
var j = Function.call.bind(he);
|
|
1239
|
+
for (var x in e)
|
|
1240
|
+
if (j(e, x)) {
|
|
1241
|
+
var y = void 0;
|
|
1242
|
+
try {
|
|
1243
|
+
if (typeof e[x] != "function") {
|
|
1244
|
+
var U = Error((h || "React class") + ": " + o + " type `" + x + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[x] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
1245
|
+
throw U.name = "Invariant Violation", U;
|
|
1246
|
+
}
|
|
1247
|
+
y = e[x](n, x, h, o, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
1248
|
+
} catch (I) {
|
|
1249
|
+
y = I;
|
|
1250
|
+
}
|
|
1251
|
+
y && !(y instanceof Error) && (we(M), R("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", h || "React class", o, x, typeof y), we(null)), y instanceof Error && !(y.message in Ne) && (Ne[y.message] = !0, we(M), R("Failed %s type: %s", o, y.message), we(null));
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
var sa = Array.isArray;
|
|
1256
|
+
function Me(e) {
|
|
1257
|
+
return sa(e);
|
|
1258
|
+
}
|
|
1259
|
+
function ia(e) {
|
|
1260
|
+
{
|
|
1261
|
+
var n = typeof Symbol == "function" && Symbol.toStringTag, o = n && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
1262
|
+
return o;
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
function oa(e) {
|
|
1266
|
+
try {
|
|
1267
|
+
return _e(e), !1;
|
|
1268
|
+
} catch {
|
|
1269
|
+
return !0;
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
function _e(e) {
|
|
1273
|
+
return "" + e;
|
|
1274
|
+
}
|
|
1275
|
+
function Fe(e) {
|
|
1276
|
+
if (oa(e))
|
|
1277
|
+
return R("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", ia(e)), _e(e);
|
|
1278
|
+
}
|
|
1279
|
+
var Be = _.ReactCurrentOwner, la = {
|
|
1280
|
+
key: !0,
|
|
1281
|
+
ref: !0,
|
|
1282
|
+
__self: !0,
|
|
1283
|
+
__source: !0
|
|
1284
|
+
}, Ue, De;
|
|
1285
|
+
function ca(e) {
|
|
1286
|
+
if (he.call(e, "ref")) {
|
|
1287
|
+
var n = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
1288
|
+
if (n && n.isReactWarning)
|
|
1289
|
+
return !1;
|
|
1290
|
+
}
|
|
1291
|
+
return e.ref !== void 0;
|
|
1292
|
+
}
|
|
1293
|
+
function da(e) {
|
|
1294
|
+
if (he.call(e, "key")) {
|
|
1295
|
+
var n = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
1296
|
+
if (n && n.isReactWarning)
|
|
1297
|
+
return !1;
|
|
1298
|
+
}
|
|
1299
|
+
return e.key !== void 0;
|
|
1300
|
+
}
|
|
1301
|
+
function ua(e, n) {
|
|
1302
|
+
typeof e.ref == "string" && Be.current;
|
|
1303
|
+
}
|
|
1304
|
+
function ma(e, n) {
|
|
1305
|
+
{
|
|
1306
|
+
var o = function() {
|
|
1307
|
+
Ue || (Ue = !0, R("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", n));
|
|
1308
|
+
};
|
|
1309
|
+
o.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
1310
|
+
get: o,
|
|
1311
|
+
configurable: !0
|
|
1312
|
+
});
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
function pa(e, n) {
|
|
1316
|
+
{
|
|
1317
|
+
var o = function() {
|
|
1318
|
+
De || (De = !0, R("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", n));
|
|
1319
|
+
};
|
|
1320
|
+
o.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
1321
|
+
get: o,
|
|
1322
|
+
configurable: !0
|
|
1323
|
+
});
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
var fa = function(e, n, o, h, M, j, x) {
|
|
1327
|
+
var y = {
|
|
1328
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
1329
|
+
$$typeof: t,
|
|
1330
|
+
// Built-in properties that belong on the element
|
|
1331
|
+
type: e,
|
|
1332
|
+
key: n,
|
|
1333
|
+
ref: o,
|
|
1334
|
+
props: x,
|
|
1335
|
+
// Record the component responsible for creating this element.
|
|
1336
|
+
_owner: j
|
|
1337
|
+
};
|
|
1338
|
+
return y._store = {}, Object.defineProperty(y._store, "validated", {
|
|
1339
|
+
configurable: !1,
|
|
1340
|
+
enumerable: !1,
|
|
1341
|
+
writable: !0,
|
|
1342
|
+
value: !1
|
|
1343
|
+
}), Object.defineProperty(y, "_self", {
|
|
1344
|
+
configurable: !1,
|
|
1345
|
+
enumerable: !1,
|
|
1346
|
+
writable: !1,
|
|
1347
|
+
value: h
|
|
1348
|
+
}), Object.defineProperty(y, "_source", {
|
|
1349
|
+
configurable: !1,
|
|
1350
|
+
enumerable: !1,
|
|
1351
|
+
writable: !1,
|
|
1352
|
+
value: M
|
|
1353
|
+
}), Object.freeze && (Object.freeze(y.props), Object.freeze(y)), y;
|
|
1354
|
+
};
|
|
1355
|
+
function ha(e, n, o, h, M) {
|
|
1356
|
+
{
|
|
1357
|
+
var j, x = {}, y = null, U = null;
|
|
1358
|
+
o !== void 0 && (Fe(o), y = "" + o), da(n) && (Fe(n.key), y = "" + n.key), ca(n) && (U = n.ref, ua(n, M));
|
|
1359
|
+
for (j in n)
|
|
1360
|
+
he.call(n, j) && !la.hasOwnProperty(j) && (x[j] = n[j]);
|
|
1361
|
+
if (e && e.defaultProps) {
|
|
1362
|
+
var I = e.defaultProps;
|
|
1363
|
+
for (j in I)
|
|
1364
|
+
x[j] === void 0 && (x[j] = I[j]);
|
|
1365
|
+
}
|
|
1366
|
+
if (y || U) {
|
|
1367
|
+
var S = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
1368
|
+
y && ma(x, S), U && pa(x, S);
|
|
1369
|
+
}
|
|
1370
|
+
return fa(e, y, U, M, h, Be.current, x);
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
var Ce = _.ReactCurrentOwner, Ke = _.ReactDebugCurrentFrame;
|
|
1374
|
+
function le(e) {
|
|
1375
|
+
if (e) {
|
|
1376
|
+
var n = e._owner, o = xe(e.type, e._source, n ? n.type : null);
|
|
1377
|
+
Ke.setExtraStackFrame(o);
|
|
1378
|
+
} else
|
|
1379
|
+
Ke.setExtraStackFrame(null);
|
|
1380
|
+
}
|
|
1381
|
+
var je;
|
|
1382
|
+
je = !1;
|
|
1383
|
+
function Re(e) {
|
|
1384
|
+
return typeof e == "object" && e !== null && e.$$typeof === t;
|
|
1385
|
+
}
|
|
1386
|
+
function $e() {
|
|
1387
|
+
{
|
|
1388
|
+
if (Ce.current) {
|
|
1389
|
+
var e = G(Ce.current.type);
|
|
1390
|
+
if (e)
|
|
1391
|
+
return `
|
|
1392
|
+
|
|
1393
|
+
Check the render method of \`` + e + "`.";
|
|
1394
|
+
}
|
|
1395
|
+
return "";
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
function va(e) {
|
|
1399
|
+
return "";
|
|
1400
|
+
}
|
|
1401
|
+
var Ge = {};
|
|
1402
|
+
function ga(e) {
|
|
1403
|
+
{
|
|
1404
|
+
var n = $e();
|
|
1405
|
+
if (!n) {
|
|
1406
|
+
var o = typeof e == "string" ? e : e.displayName || e.name;
|
|
1407
|
+
o && (n = `
|
|
1408
|
+
|
|
1409
|
+
Check the top-level render call using <` + o + ">.");
|
|
1410
|
+
}
|
|
1411
|
+
return n;
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
function Ve(e, n) {
|
|
1415
|
+
{
|
|
1416
|
+
if (!e._store || e._store.validated || e.key != null)
|
|
1417
|
+
return;
|
|
1418
|
+
e._store.validated = !0;
|
|
1419
|
+
var o = ga(n);
|
|
1420
|
+
if (Ge[o])
|
|
1421
|
+
return;
|
|
1422
|
+
Ge[o] = !0;
|
|
1423
|
+
var h = "";
|
|
1424
|
+
e && e._owner && e._owner !== Ce.current && (h = " It was passed a child from " + G(e._owner.type) + "."), le(e), R('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', o, h), le(null);
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
function Qe(e, n) {
|
|
1428
|
+
{
|
|
1429
|
+
if (typeof e != "object")
|
|
1430
|
+
return;
|
|
1431
|
+
if (Me(e))
|
|
1432
|
+
for (var o = 0; o < e.length; o++) {
|
|
1433
|
+
var h = e[o];
|
|
1434
|
+
Re(h) && Ve(h, n);
|
|
1435
|
+
}
|
|
1436
|
+
else if (Re(e))
|
|
1437
|
+
e._store && (e._store.validated = !0);
|
|
1438
|
+
else if (e) {
|
|
1439
|
+
var M = A(e);
|
|
1440
|
+
if (typeof M == "function" && M !== e.entries)
|
|
1441
|
+
for (var j = M.call(e), x; !(x = j.next()).done; )
|
|
1442
|
+
Re(x.value) && Ve(x.value, n);
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
function ba(e) {
|
|
1447
|
+
{
|
|
1448
|
+
var n = e.type;
|
|
1449
|
+
if (n == null || typeof n == "string")
|
|
1450
|
+
return;
|
|
1451
|
+
var o;
|
|
1452
|
+
if (typeof n == "function")
|
|
1453
|
+
o = n.propTypes;
|
|
1454
|
+
else if (typeof n == "object" && (n.$$typeof === s || // Note: Memo only checks outer props here.
|
|
1455
|
+
// Inner props are checked in the reconciler.
|
|
1456
|
+
n.$$typeof === w))
|
|
1457
|
+
o = n.propTypes;
|
|
1458
|
+
else
|
|
1459
|
+
return;
|
|
1460
|
+
if (o) {
|
|
1461
|
+
var h = G(n);
|
|
1462
|
+
na(o, e.props, "prop", h, e);
|
|
1463
|
+
} else if (n.PropTypes !== void 0 && !je) {
|
|
1464
|
+
je = !0;
|
|
1465
|
+
var M = G(n);
|
|
1466
|
+
R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", M || "Unknown");
|
|
1467
|
+
}
|
|
1468
|
+
typeof n.getDefaultProps == "function" && !n.getDefaultProps.isReactClassApproved && R("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
function ya(e) {
|
|
1472
|
+
{
|
|
1473
|
+
for (var n = Object.keys(e.props), o = 0; o < n.length; o++) {
|
|
1474
|
+
var h = n[o];
|
|
1475
|
+
if (h !== "children" && h !== "key") {
|
|
1476
|
+
le(e), R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", h), le(null);
|
|
1477
|
+
break;
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
e.ref !== null && (le(e), R("Invalid attribute `ref` supplied to `React.Fragment`."), le(null));
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
var ze = {};
|
|
1484
|
+
function We(e, n, o, h, M, j) {
|
|
1485
|
+
{
|
|
1486
|
+
var x = me(e);
|
|
1487
|
+
if (!x) {
|
|
1488
|
+
var y = "";
|
|
1489
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (y += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
1490
|
+
var U = va();
|
|
1491
|
+
U ? y += U : y += $e();
|
|
1492
|
+
var I;
|
|
1493
|
+
e === null ? I = "null" : Me(e) ? I = "array" : e !== void 0 && e.$$typeof === t ? (I = "<" + (G(e.type) || "Unknown") + " />", y = " Did you accidentally export a JSX literal instead of a component?") : I = typeof e, R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", I, y);
|
|
1494
|
+
}
|
|
1495
|
+
var S = ha(e, n, o, M, j);
|
|
1496
|
+
if (S == null)
|
|
1497
|
+
return S;
|
|
1498
|
+
if (x) {
|
|
1499
|
+
var V = n.children;
|
|
1500
|
+
if (V !== void 0)
|
|
1501
|
+
if (h)
|
|
1502
|
+
if (Me(V)) {
|
|
1503
|
+
for (var ce = 0; ce < V.length; ce++)
|
|
1504
|
+
Qe(V[ce], e);
|
|
1505
|
+
Object.freeze && Object.freeze(V);
|
|
1506
|
+
} else
|
|
1507
|
+
R("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
1508
|
+
else
|
|
1509
|
+
Qe(V, e);
|
|
1510
|
+
}
|
|
1511
|
+
if (he.call(n, "key")) {
|
|
1512
|
+
var ne = G(e), $ = Object.keys(n).filter(function(Ca) {
|
|
1513
|
+
return Ca !== "key";
|
|
1514
|
+
}), Te = $.length > 0 ? "{key: someKey, " + $.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
1515
|
+
if (!ze[ne + Te]) {
|
|
1516
|
+
var Ma = $.length > 0 ? "{" + $.join(": ..., ") + ": ...}" : "{}";
|
|
1517
|
+
R(`A props object containing a "key" prop is being spread into JSX:
|
|
1518
|
+
let props = %s;
|
|
1519
|
+
<%s {...props} />
|
|
1520
|
+
React keys must be passed directly to JSX without using spread:
|
|
1521
|
+
let props = %s;
|
|
1522
|
+
<%s key={someKey} {...props} />`, Te, ne, Ma, ne), ze[ne + Te] = !0;
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
return e === l ? ya(S) : ba(S), S;
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
function xa(e, n, o) {
|
|
1529
|
+
return We(e, n, o, !0);
|
|
1530
|
+
}
|
|
1531
|
+
function wa(e, n, o) {
|
|
1532
|
+
return We(e, n, o, !1);
|
|
1533
|
+
}
|
|
1534
|
+
var ka = wa, Ea = xa;
|
|
1535
|
+
ge.Fragment = l, ge.jsx = ka, ge.jsxs = Ea;
|
|
1536
|
+
})()), ge;
|
|
1537
|
+
}
|
|
1538
|
+
var Ye;
|
|
1539
|
+
function Ka() {
|
|
1540
|
+
return Ye || (Ye = 1, process.env.NODE_ENV === "production" ? ke.exports = Ua() : ke.exports = Da()), ke.exports;
|
|
1541
|
+
}
|
|
1542
|
+
var r = Ka();
|
|
1543
|
+
function ea({ text: a, className: t = "", placeholder: i }) {
|
|
1544
|
+
return !a && i ? /* @__PURE__ */ r.jsx("span", { className: `apmsu-placeholder ${t}`, children: i }) : a ? /* @__PURE__ */ r.jsx("span", { className: `inline-flex min-w-0 ${t}`, children: /* @__PURE__ */ r.jsx(ja, { value: a, charWidth: 0.8, duration: 300 }) }) : null;
|
|
1545
|
+
}
|
|
1546
|
+
function $a({
|
|
1547
|
+
providers: a,
|
|
1548
|
+
selectedProviderId: t,
|
|
1549
|
+
onSelect: i,
|
|
1550
|
+
isOpen: l,
|
|
1551
|
+
setIsOpen: p,
|
|
1552
|
+
disabled: c,
|
|
1553
|
+
language: b = "zh"
|
|
1554
|
+
}) {
|
|
1555
|
+
const m = be[b], s = Oe(null), u = a.find((f) => f.id === t);
|
|
1556
|
+
return se(() => {
|
|
1557
|
+
const f = (w) => {
|
|
1558
|
+
s.current && !s.current.contains(w.target) && p(!1);
|
|
1559
|
+
};
|
|
1560
|
+
return document.addEventListener("mousedown", f), () => document.removeEventListener("mousedown", f);
|
|
1561
|
+
}, [p]), /* @__PURE__ */ r.jsxs("div", { className: "apmsu-field", ref: s, children: [
|
|
1562
|
+
/* @__PURE__ */ r.jsx("label", { className: "apmsu-label", children: m.providerLabel }),
|
|
1563
|
+
/* @__PURE__ */ r.jsxs("div", { className: "relative", children: [
|
|
1564
|
+
/* @__PURE__ */ r.jsxs(
|
|
1565
|
+
"button",
|
|
1566
|
+
{
|
|
1567
|
+
type: "button",
|
|
1568
|
+
onClick: () => !c && p(!l),
|
|
1569
|
+
disabled: c,
|
|
1570
|
+
className: "apmsu-select-trigger",
|
|
1571
|
+
children: [
|
|
1572
|
+
u ? /* @__PURE__ */ r.jsxs("span", { className: "flex items-center gap-2 min-w-0", children: [
|
|
1573
|
+
/* @__PURE__ */ r.jsx(
|
|
1574
|
+
"img",
|
|
1575
|
+
{
|
|
1576
|
+
src: u.icon,
|
|
1577
|
+
alt: u.name,
|
|
1578
|
+
className: "apmsu-provider-icon"
|
|
1579
|
+
}
|
|
1580
|
+
),
|
|
1581
|
+
/* @__PURE__ */ r.jsx(ea, { text: u.name })
|
|
1582
|
+
] }) : /* @__PURE__ */ r.jsx("span", { className: "apmsu-placeholder", children: m.selectProvider }),
|
|
1583
|
+
/* @__PURE__ */ r.jsx(Ga, { isOpen: l })
|
|
1584
|
+
]
|
|
1585
|
+
}
|
|
1586
|
+
),
|
|
1587
|
+
/* @__PURE__ */ r.jsx("div", { className: `apmsu-dropdown max-h-[300px] overflow-auto p-1 origin-top ${l ? "apmsu-dropdown-open" : ""}`, children: a.map((f) => /* @__PURE__ */ r.jsxs(
|
|
1588
|
+
"button",
|
|
1589
|
+
{
|
|
1590
|
+
type: "button",
|
|
1591
|
+
onClick: () => {
|
|
1592
|
+
i(f.id), p(!1);
|
|
1593
|
+
},
|
|
1594
|
+
className: `apmsu-dropdown-item rounded-sm ${t === f.id ? "apmsu-dropdown-item-active" : ""}`,
|
|
1595
|
+
children: [
|
|
1596
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex items-center gap-2 flex-shrink-0", children: [
|
|
1597
|
+
/* @__PURE__ */ r.jsx(
|
|
1598
|
+
"img",
|
|
1599
|
+
{
|
|
1600
|
+
src: f.icon,
|
|
1601
|
+
alt: f.name,
|
|
1602
|
+
className: "apmsu-provider-icon"
|
|
1603
|
+
}
|
|
1604
|
+
),
|
|
1605
|
+
/* @__PURE__ */ r.jsx("span", { className: "font-medium whitespace-nowrap", children: f.name })
|
|
1606
|
+
] }),
|
|
1607
|
+
/* @__PURE__ */ r.jsx("span", { className: "apmsu-hint-text ml-auto text-right truncate flex-1 min-w-0", children: f.baseUrl.replace("https://", "") })
|
|
1608
|
+
]
|
|
1609
|
+
},
|
|
1610
|
+
f.id
|
|
1611
|
+
)) })
|
|
1612
|
+
] })
|
|
1613
|
+
] });
|
|
1614
|
+
}
|
|
1615
|
+
const Ga = ({ isOpen: a }) => /* @__PURE__ */ r.jsx(
|
|
1616
|
+
"svg",
|
|
1617
|
+
{
|
|
1618
|
+
className: `apmsu-chevron ${a ? "rotate-180" : ""}`,
|
|
1619
|
+
fill: "none",
|
|
1620
|
+
stroke: "currentColor",
|
|
1621
|
+
viewBox: "0 0 24 24",
|
|
1622
|
+
children: /* @__PURE__ */ r.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" })
|
|
1623
|
+
}
|
|
1624
|
+
);
|
|
1625
|
+
function Va({
|
|
1626
|
+
provider: a,
|
|
1627
|
+
apiKey: t,
|
|
1628
|
+
onChange: i,
|
|
1629
|
+
testStatus: l,
|
|
1630
|
+
disabled: p,
|
|
1631
|
+
language: c = "zh"
|
|
1632
|
+
}) {
|
|
1633
|
+
const [b, m] = B(!1), s = be[c];
|
|
1634
|
+
if (!a || !a.needsApiKey) return null;
|
|
1635
|
+
const u = () => l === "success" ? "apmsu-input apmsu-input-success" : "apmsu-input apmsu-input-default";
|
|
1636
|
+
return /* @__PURE__ */ r.jsxs("div", { className: "space-y-2", children: [
|
|
1637
|
+
/* @__PURE__ */ r.jsx("label", { className: "apmsu-label", children: s.apiKeyLabel }),
|
|
1638
|
+
/* @__PURE__ */ r.jsxs("div", { className: "relative", children: [
|
|
1639
|
+
/* @__PURE__ */ r.jsx(
|
|
1640
|
+
"input",
|
|
1641
|
+
{
|
|
1642
|
+
type: b ? "text" : "password",
|
|
1643
|
+
value: t,
|
|
1644
|
+
onChange: (f) => i(f.target.value),
|
|
1645
|
+
onFocus: () => m(!0),
|
|
1646
|
+
onBlur: () => m(!1),
|
|
1647
|
+
placeholder: s.apiKeyPlaceholder,
|
|
1648
|
+
disabled: p,
|
|
1649
|
+
className: `${u()} pr-10`
|
|
1650
|
+
}
|
|
1651
|
+
),
|
|
1652
|
+
/* @__PURE__ */ r.jsx("span", { className: "absolute right-3 top-1/2 -translate-y-1/2 flex items-center justify-center", children: b ? /* @__PURE__ */ r.jsxs("svg", { className: "w-4 h-4 text-gray-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: [
|
|
1653
|
+
/* @__PURE__ */ r.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 12a3 3 0 11-6 0 3 3 0 016 0z" }),
|
|
1654
|
+
/* @__PURE__ */ r.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" })
|
|
1655
|
+
] }) : /* @__PURE__ */ r.jsx("svg", { className: "w-4 h-4 text-gray-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ r.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21" }) }) })
|
|
1656
|
+
] })
|
|
1657
|
+
] });
|
|
1658
|
+
}
|
|
1659
|
+
function Qa({
|
|
1660
|
+
provider: a,
|
|
1661
|
+
models: t,
|
|
1662
|
+
selectedModelId: i,
|
|
1663
|
+
onSelect: l,
|
|
1664
|
+
isOpen: p,
|
|
1665
|
+
setIsOpen: c,
|
|
1666
|
+
hasApiKey: b,
|
|
1667
|
+
disabled: m,
|
|
1668
|
+
language: s = "zh",
|
|
1669
|
+
isFetchingModels: u,
|
|
1670
|
+
fetchModelError: f,
|
|
1671
|
+
selectedModelName: w
|
|
1672
|
+
}) {
|
|
1673
|
+
var R;
|
|
1674
|
+
const g = be[s], C = Oe(null), [k, L] = B("");
|
|
1675
|
+
se(() => {
|
|
1676
|
+
const T = (Q) => {
|
|
1677
|
+
C.current && !C.current.contains(Q.target) && (c(!1), L(""));
|
|
1678
|
+
};
|
|
1679
|
+
return document.addEventListener("mousedown", T), () => document.removeEventListener("mousedown", T);
|
|
1680
|
+
}, [c]);
|
|
1681
|
+
const A = t.filter(
|
|
1682
|
+
(T) => T.name.toLowerCase().includes(k.toLowerCase()) || T.id.toLowerCase().includes(k.toLowerCase())
|
|
1683
|
+
), _ = ((R = t.find((T) => T.id === i)) == null ? void 0 : R.name) || w || i;
|
|
1684
|
+
return /* @__PURE__ */ r.jsxs("div", { className: "apmsu-field", ref: C, children: [
|
|
1685
|
+
/* @__PURE__ */ r.jsx("label", { className: "apmsu-label flex items-center justify-between", children: /* @__PURE__ */ r.jsx("span", { children: g.modelLabel }) }),
|
|
1686
|
+
/* @__PURE__ */ r.jsxs("div", { className: "relative", children: [
|
|
1687
|
+
/* @__PURE__ */ r.jsxs(
|
|
1688
|
+
"button",
|
|
1689
|
+
{
|
|
1690
|
+
type: "button",
|
|
1691
|
+
onClick: () => !m && a && c(!p),
|
|
1692
|
+
disabled: m || !a,
|
|
1693
|
+
className: "apmsu-select-trigger",
|
|
1694
|
+
children: [
|
|
1695
|
+
/* @__PURE__ */ r.jsx(
|
|
1696
|
+
ea,
|
|
1697
|
+
{
|
|
1698
|
+
text: _,
|
|
1699
|
+
placeholder: g.selectModel
|
|
1700
|
+
}
|
|
1701
|
+
),
|
|
1702
|
+
/* @__PURE__ */ r.jsx(za, { isOpen: p })
|
|
1703
|
+
]
|
|
1704
|
+
}
|
|
1705
|
+
),
|
|
1706
|
+
/* @__PURE__ */ r.jsxs("div", { className: `apmsu-dropdown origin-top ${p ? "apmsu-dropdown-open" : ""}`, children: [
|
|
1707
|
+
/* @__PURE__ */ r.jsx("div", { className: "p-1.5 apmsu-divider", children: /* @__PURE__ */ r.jsx(
|
|
1708
|
+
"input",
|
|
1709
|
+
{
|
|
1710
|
+
type: "text",
|
|
1711
|
+
value: k,
|
|
1712
|
+
onChange: (T) => L(T.target.value),
|
|
1713
|
+
placeholder: g.searchModel,
|
|
1714
|
+
className: "apmsu-select-trigger",
|
|
1715
|
+
autoFocus: p
|
|
1716
|
+
}
|
|
1717
|
+
) }),
|
|
1718
|
+
/* @__PURE__ */ r.jsxs("div", { className: "max-h-60 overflow-auto", children: [
|
|
1719
|
+
k && !A.some((T) => T.id === k) && /* @__PURE__ */ r.jsx(
|
|
1720
|
+
"button",
|
|
1721
|
+
{
|
|
1722
|
+
type: "button",
|
|
1723
|
+
onClick: () => {
|
|
1724
|
+
l(k), c(!1), L("");
|
|
1725
|
+
},
|
|
1726
|
+
className: "apmsu-dropdown-item bg-blue-50 dark:bg-blue-900/20 border-b",
|
|
1727
|
+
children: /* @__PURE__ */ r.jsxs("span", { className: "text-blue-500", children: [
|
|
1728
|
+
g.useCustom,
|
|
1729
|
+
": ",
|
|
1730
|
+
k
|
|
1731
|
+
] })
|
|
1732
|
+
}
|
|
1733
|
+
),
|
|
1734
|
+
A.map((T) => /* @__PURE__ */ r.jsx(
|
|
1735
|
+
"button",
|
|
1736
|
+
{
|
|
1737
|
+
type: "button",
|
|
1738
|
+
onClick: () => {
|
|
1739
|
+
l(T.id, T.name), c(!1), L("");
|
|
1740
|
+
},
|
|
1741
|
+
className: `apmsu-dropdown-item ${i === T.id ? "apmsu-dropdown-item-active" : ""}`,
|
|
1742
|
+
children: /* @__PURE__ */ r.jsx("span", { children: T.name })
|
|
1743
|
+
},
|
|
1744
|
+
T.id
|
|
1745
|
+
)),
|
|
1746
|
+
A.length === 0 && !k && /* @__PURE__ */ r.jsx("div", { className: "p-4 text-center apmsu-hint-text", children: g.noModels })
|
|
1747
|
+
] })
|
|
1748
|
+
] })
|
|
1749
|
+
] }),
|
|
1750
|
+
(a == null ? void 0 : a.supportsModelsApi) && /* @__PURE__ */ r.jsx("div", { className: "min-h-[20px] flex items-center", children: u ? /* @__PURE__ */ r.jsx("p", { className: "apmsu-hint-text animate-pulse", children: g.refreshingModels }) : f ? /* @__PURE__ */ r.jsx("p", { className: "apmsu-hint-text dark:text-zinc-500", children: g[f] || f }) : a != null && a.needsApiKey && !b ? /* @__PURE__ */ r.jsx("p", { className: "apmsu-hint-text", children: g.apiKeyTip }) : /* @__PURE__ */ r.jsx("p", { className: "apmsu-hint-text", children: g.modelListUpdated }) })
|
|
1751
|
+
] });
|
|
1752
|
+
}
|
|
1753
|
+
const za = ({ isOpen: a }) => /* @__PURE__ */ r.jsx(
|
|
1754
|
+
"svg",
|
|
1755
|
+
{
|
|
1756
|
+
className: `apmsu-chevron ${a ? "rotate-180" : ""}`,
|
|
1757
|
+
fill: "none",
|
|
1758
|
+
stroke: "currentColor",
|
|
1759
|
+
viewBox: "0 0 24 24",
|
|
1760
|
+
children: /* @__PURE__ */ r.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" })
|
|
1761
|
+
}
|
|
1762
|
+
);
|
|
1763
|
+
function Wa({
|
|
1764
|
+
provider: a,
|
|
1765
|
+
baseUrl: t,
|
|
1766
|
+
onChange: i,
|
|
1767
|
+
disabled: l,
|
|
1768
|
+
language: p = "zh"
|
|
1769
|
+
}) {
|
|
1770
|
+
const [c, b] = B(!1), m = be[p];
|
|
1771
|
+
return a ? /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
1772
|
+
/* @__PURE__ */ r.jsxs(
|
|
1773
|
+
"button",
|
|
1774
|
+
{
|
|
1775
|
+
type: "button",
|
|
1776
|
+
onClick: () => b(!c),
|
|
1777
|
+
className: "text-xs text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 flex items-center gap-1 transition-colors",
|
|
1778
|
+
children: [
|
|
1779
|
+
/* @__PURE__ */ r.jsx(
|
|
1780
|
+
"svg",
|
|
1781
|
+
{
|
|
1782
|
+
className: `w-3 h-3 transition-transform ${c ? "rotate-90" : ""}`,
|
|
1783
|
+
fill: "none",
|
|
1784
|
+
stroke: "currentColor",
|
|
1785
|
+
viewBox: "0 0 24 24",
|
|
1786
|
+
children: /* @__PURE__ */ r.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" })
|
|
1787
|
+
}
|
|
1788
|
+
),
|
|
1789
|
+
m.customBaseUrl
|
|
1790
|
+
]
|
|
1791
|
+
}
|
|
1792
|
+
),
|
|
1793
|
+
/* @__PURE__ */ r.jsx(
|
|
1794
|
+
"div",
|
|
1795
|
+
{
|
|
1796
|
+
className: "grid transition-all duration-200 ease-out",
|
|
1797
|
+
style: { gridTemplateRows: c ? "1fr" : "0fr" },
|
|
1798
|
+
children: /* @__PURE__ */ r.jsx("div", { className: "overflow-hidden", children: /* @__PURE__ */ r.jsx(
|
|
1799
|
+
"input",
|
|
1800
|
+
{
|
|
1801
|
+
type: "text",
|
|
1802
|
+
value: t,
|
|
1803
|
+
onChange: (s) => i(s.target.value),
|
|
1804
|
+
placeholder: a.baseUrl,
|
|
1805
|
+
disabled: l,
|
|
1806
|
+
className: "apmsu-input apmsu-input-default"
|
|
1807
|
+
}
|
|
1808
|
+
) })
|
|
1809
|
+
}
|
|
1810
|
+
)
|
|
1811
|
+
] }) : null;
|
|
1812
|
+
}
|
|
1813
|
+
function nt({
|
|
1814
|
+
proxyUrl: a,
|
|
1815
|
+
config: t,
|
|
1816
|
+
initialConfig: i,
|
|
1817
|
+
title: l,
|
|
1818
|
+
showPreview: p = !1,
|
|
1819
|
+
saveButtonText: c,
|
|
1820
|
+
disabled: b = !1,
|
|
1821
|
+
onSave: m,
|
|
1822
|
+
onTestResult: s,
|
|
1823
|
+
onChange: u,
|
|
1824
|
+
onSerialize: f,
|
|
1825
|
+
onDeserialize: w,
|
|
1826
|
+
language: g = "zh",
|
|
1827
|
+
modelFetcher: C
|
|
1828
|
+
}) {
|
|
1829
|
+
const k = de(() => be[g], [g]), {
|
|
1830
|
+
providerId: L,
|
|
1831
|
+
apiKey: A,
|
|
1832
|
+
model: _,
|
|
1833
|
+
modelName: R,
|
|
1834
|
+
baseUrl: T,
|
|
1835
|
+
models: Q,
|
|
1836
|
+
testStatus: F,
|
|
1837
|
+
testResult: P,
|
|
1838
|
+
provider: E,
|
|
1839
|
+
providers: W,
|
|
1840
|
+
isValid: Y,
|
|
1841
|
+
setProviderId: me,
|
|
1842
|
+
setApiKey: pe,
|
|
1843
|
+
selectModel: ie,
|
|
1844
|
+
setBaseUrl: G,
|
|
1845
|
+
runTest: z,
|
|
1846
|
+
save: H,
|
|
1847
|
+
isFetchingModels: fe,
|
|
1848
|
+
fetchModelError: X,
|
|
1849
|
+
config: J
|
|
1850
|
+
} = Ba({
|
|
1851
|
+
proxyUrl: a,
|
|
1852
|
+
providerConfig: t,
|
|
1853
|
+
initialConfig: i,
|
|
1854
|
+
onSerialize: f,
|
|
1855
|
+
onDeserialize: w,
|
|
1856
|
+
modelFetcher: C
|
|
1857
|
+
}), [Z, ee] = B(!1), [ae, v] = B(!1), [O, D] = B("idle"), [q, oe] = B(!1);
|
|
1858
|
+
se(() => {
|
|
1859
|
+
u == null || u({ providerId: L, apiKey: A, model: _, baseUrl: T });
|
|
1860
|
+
}, [L, A, _, T, u]), se(() => {
|
|
1861
|
+
P && (s == null || s(P));
|
|
1862
|
+
}, [P, s]);
|
|
1863
|
+
const te = ue(() => {
|
|
1864
|
+
H(), D("saved"), m == null || m(J), setTimeout(() => D("idle"), 2e3);
|
|
1865
|
+
}, [H, m, J]);
|
|
1866
|
+
return /* @__PURE__ */ r.jsxs("div", { className: "apmsu-card", children: [
|
|
1867
|
+
l && /* @__PURE__ */ r.jsx("h2", { className: "text-lg font-semibold mb-4", children: l }),
|
|
1868
|
+
/* @__PURE__ */ r.jsxs("div", { className: "space-y-3", children: [
|
|
1869
|
+
/* @__PURE__ */ r.jsx(
|
|
1870
|
+
$a,
|
|
1871
|
+
{
|
|
1872
|
+
providers: W,
|
|
1873
|
+
selectedProviderId: L,
|
|
1874
|
+
onSelect: me,
|
|
1875
|
+
isOpen: Z,
|
|
1876
|
+
setIsOpen: ee,
|
|
1877
|
+
disabled: b,
|
|
1878
|
+
language: g
|
|
1879
|
+
}
|
|
1880
|
+
),
|
|
1881
|
+
/* @__PURE__ */ r.jsx(
|
|
1882
|
+
Wa,
|
|
1883
|
+
{
|
|
1884
|
+
provider: E,
|
|
1885
|
+
baseUrl: T,
|
|
1886
|
+
onChange: G,
|
|
1887
|
+
disabled: b,
|
|
1888
|
+
language: g
|
|
1889
|
+
}
|
|
1890
|
+
),
|
|
1891
|
+
/* @__PURE__ */ r.jsx("div", { className: `transition-all duration-500 ease-in-out ${L ? "max-h-[1000px] opacity-100 overflow-visible" : "max-h-0 opacity-0 overflow-hidden"}`, children: /* @__PURE__ */ r.jsxs("div", { className: "space-y-4", children: [
|
|
1892
|
+
/* @__PURE__ */ r.jsx(
|
|
1893
|
+
Va,
|
|
1894
|
+
{
|
|
1895
|
+
provider: E,
|
|
1896
|
+
apiKey: A,
|
|
1897
|
+
onChange: pe,
|
|
1898
|
+
testStatus: F,
|
|
1899
|
+
disabled: b,
|
|
1900
|
+
language: g
|
|
1901
|
+
}
|
|
1902
|
+
),
|
|
1903
|
+
/* @__PURE__ */ r.jsx(
|
|
1904
|
+
Qa,
|
|
1905
|
+
{
|
|
1906
|
+
provider: E,
|
|
1907
|
+
models: Q,
|
|
1908
|
+
selectedModelId: _,
|
|
1909
|
+
onSelect: ie,
|
|
1910
|
+
isOpen: ae,
|
|
1911
|
+
setIsOpen: v,
|
|
1912
|
+
hasApiKey: !!A,
|
|
1913
|
+
disabled: b,
|
|
1914
|
+
language: g,
|
|
1915
|
+
isFetchingModels: fe,
|
|
1916
|
+
fetchModelError: X,
|
|
1917
|
+
selectedModelName: R
|
|
1918
|
+
}
|
|
1919
|
+
)
|
|
1920
|
+
] }) }),
|
|
1921
|
+
/* @__PURE__ */ r.jsxs("div", { className: "pt-2 space-y-2", children: [
|
|
1922
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex gap-2", children: [
|
|
1923
|
+
/* @__PURE__ */ r.jsx(
|
|
1924
|
+
"button",
|
|
1925
|
+
{
|
|
1926
|
+
onClick: () => z(),
|
|
1927
|
+
disabled: !L || !A || !_ || b || F === "testing",
|
|
1928
|
+
className: `apmsu-btn flex-1 ${F === "success" ? "apmsu-btn-success" : F === "error" ? "bg-red-100 dark:bg-red-900/30 text-red-600 dark:text-red-400 hover:bg-red-200 dark:hover:bg-red-900/40" : "apmsu-btn-ghost border border-gray-200 dark:border-zinc-700"}`,
|
|
1929
|
+
children: F === "testing" ? /* @__PURE__ */ r.jsxs("span", { className: "flex items-center justify-center gap-2", children: [
|
|
1930
|
+
/* @__PURE__ */ r.jsx(Ha, {}),
|
|
1931
|
+
k.testing
|
|
1932
|
+
] }) : F === "success" ? /* @__PURE__ */ r.jsxs("span", { className: "flex items-center justify-center gap-2", children: [
|
|
1933
|
+
/* @__PURE__ */ r.jsx(qa, {}),
|
|
1934
|
+
k.testSuccess,
|
|
1935
|
+
" ",
|
|
1936
|
+
(P == null ? void 0 : P.latencyMs) && `${P.latencyMs}ms`
|
|
1937
|
+
] }) : F === "error" ? /* @__PURE__ */ r.jsxs("span", { className: "flex items-center justify-center gap-2", children: [
|
|
1938
|
+
/* @__PURE__ */ r.jsx(Ya, {}),
|
|
1939
|
+
k.testFailed
|
|
1940
|
+
] }) : k.testConnection
|
|
1941
|
+
}
|
|
1942
|
+
),
|
|
1943
|
+
/* @__PURE__ */ r.jsx(
|
|
1944
|
+
"button",
|
|
1945
|
+
{
|
|
1946
|
+
onClick: te,
|
|
1947
|
+
disabled: !Y || b,
|
|
1948
|
+
className: `apmsu-btn flex-1 ${O === "saved" ? "apmsu-btn-success" : "apmsu-btn-primary"}`,
|
|
1949
|
+
children: O === "saved" ? /* @__PURE__ */ r.jsxs("span", { className: "flex items-center justify-center gap-2", children: [
|
|
1950
|
+
/* @__PURE__ */ r.jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ r.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M5 13l4 4L19 7" }) }),
|
|
1951
|
+
k.saved
|
|
1952
|
+
] }) : c || k.save
|
|
1953
|
+
}
|
|
1954
|
+
)
|
|
1955
|
+
] }),
|
|
1956
|
+
/* @__PURE__ */ r.jsx(
|
|
1957
|
+
"div",
|
|
1958
|
+
{
|
|
1959
|
+
className: "grid transition-all duration-200 ease-out",
|
|
1960
|
+
style: { gridTemplateRows: !(P != null && P.success) && (P != null && P.message) && F !== "testing" && F !== "success" ? "1fr" : "0fr" },
|
|
1961
|
+
children: /* @__PURE__ */ r.jsx("div", { className: "overflow-hidden", children: /* @__PURE__ */ r.jsx("div", { className: "p-2 rounded-md bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800", children: /* @__PURE__ */ r.jsx("p", { className: "text-xs text-red-600 dark:text-red-400 line-clamp-3 text-left", children: P == null ? void 0 : P.message }) }) })
|
|
1962
|
+
}
|
|
1963
|
+
)
|
|
1964
|
+
] })
|
|
1965
|
+
] }),
|
|
1966
|
+
p && E && /* @__PURE__ */ r.jsxs("div", { className: "mt-6 border border-gray-200/50 dark:border-zinc-800 rounded-lg overflow-hidden", children: [
|
|
1967
|
+
/* @__PURE__ */ r.jsxs(
|
|
1968
|
+
"button",
|
|
1969
|
+
{
|
|
1970
|
+
type: "button",
|
|
1971
|
+
onClick: () => oe(!q),
|
|
1972
|
+
className: "w-full flex items-center justify-between px-4 py-3 bg-zinc-50 dark:bg-zinc-900/50 hover:bg-zinc-100 dark:hover:bg-zinc-800/50 transition-colors",
|
|
1973
|
+
children: [
|
|
1974
|
+
/* @__PURE__ */ r.jsx("h3", { className: "text-xs font-medium text-gray-500 dark:text-zinc-500 uppercase tracking-wider", children: k.preview }),
|
|
1975
|
+
/* @__PURE__ */ r.jsx(
|
|
1976
|
+
"svg",
|
|
1977
|
+
{
|
|
1978
|
+
className: `w-4 h-4 text-gray-400 transition-transform duration-200 ${q ? "rotate-180" : ""}`,
|
|
1979
|
+
fill: "none",
|
|
1980
|
+
stroke: "currentColor",
|
|
1981
|
+
viewBox: "0 0 24 24",
|
|
1982
|
+
children: /* @__PURE__ */ r.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" })
|
|
1983
|
+
}
|
|
1984
|
+
)
|
|
1985
|
+
]
|
|
1986
|
+
}
|
|
1987
|
+
),
|
|
1988
|
+
/* @__PURE__ */ r.jsx(
|
|
1989
|
+
"div",
|
|
1990
|
+
{
|
|
1991
|
+
className: "grid transition-all duration-200 ease-out",
|
|
1992
|
+
style: { gridTemplateRows: q ? "1fr" : "0fr" },
|
|
1993
|
+
children: /* @__PURE__ */ r.jsx("div", { className: "overflow-hidden", children: /* @__PURE__ */ r.jsx("pre", { className: "text-xs text-gray-600 dark:text-zinc-400 font-mono overflow-x-auto leading-relaxed p-4 bg-zinc-50 dark:bg-zinc-900/50", children: JSON.stringify({
|
|
1994
|
+
provider: E.name,
|
|
1995
|
+
apiFormat: E.apiFormat,
|
|
1996
|
+
baseUrl: T || E.baseUrl,
|
|
1997
|
+
model: _ || k.unselected,
|
|
1998
|
+
hasApiKey: !!A
|
|
1999
|
+
}, null, 2) }) })
|
|
2000
|
+
}
|
|
2001
|
+
)
|
|
2002
|
+
] })
|
|
2003
|
+
] });
|
|
2004
|
+
}
|
|
2005
|
+
const Ha = () => /* @__PURE__ */ r.jsxs("svg", { className: "apmsu-icon-spin", viewBox: "0 0 24 24", fill: "none", children: [
|
|
2006
|
+
/* @__PURE__ */ r.jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
2007
|
+
/* @__PURE__ */ r.jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" })
|
|
2008
|
+
] }), qa = () => /* @__PURE__ */ r.jsx("svg", { className: "apmsu-icon-success", fill: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ r.jsx("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" }) }), Ya = () => /* @__PURE__ */ r.jsx("svg", { className: "apmsu-icon-error", fill: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ r.jsx("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" }) });
|
|
2009
|
+
export {
|
|
2010
|
+
nt as A,
|
|
2011
|
+
be as I,
|
|
2012
|
+
Ee as P,
|
|
2013
|
+
Ta as S,
|
|
2014
|
+
d as a,
|
|
2015
|
+
Ra as b,
|
|
2016
|
+
et as c,
|
|
2017
|
+
Pe as d,
|
|
2018
|
+
Fa as e,
|
|
2019
|
+
tt as f,
|
|
2020
|
+
Za as g,
|
|
2021
|
+
rt as h,
|
|
2022
|
+
Ie as i,
|
|
2023
|
+
Na as j,
|
|
2024
|
+
at as k,
|
|
2025
|
+
_a as l,
|
|
2026
|
+
Ze as r,
|
|
2027
|
+
Sa as s,
|
|
2028
|
+
La as t,
|
|
2029
|
+
Ba as u
|
|
2030
|
+
};
|
|
2031
|
+
//# sourceMappingURL=index-BDJQBhY0.js.map
|