@tombcato/ai-selector-react 0.1.3 → 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/dist/AuthInput.d.ts +1 -1
- package/dist/index.js +164 -165
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +8 -8
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import Ve, { useState as M, useMemo as le, useRef as _e, useEffect as ne, useCallback as ce } from "react";
|
|
2
2
|
import { resolveProviderConfig as gr, createConfigStorage as br, testConnection as yr, I18N as he } from "@tombcato/ai-selector-core";
|
|
3
3
|
import { Ticker as jr } from "@tombcato/smart-ticker";
|
|
4
|
-
function wr(
|
|
4
|
+
function wr(a = {}) {
|
|
5
5
|
var X, G, H, Z, Q;
|
|
6
|
-
const [u, E] = M(((X =
|
|
7
|
-
() => gr(
|
|
8
|
-
[
|
|
6
|
+
const [u, E] = M(((X = a.initialConfig) == null ? void 0 : X.providerId) || ""), [o, C] = M(((G = a.initialConfig) == null ? void 0 : G.apiKey) || ""), [f, b] = M(((H = a.initialConfig) == null ? void 0 : H.model) || ""), [x, l] = M(((Z = a.initialConfig) == null ? void 0 : Z.modelName) || ""), [p, c] = M(((Q = a.initialConfig) == null ? void 0 : Q.baseUrl) || ""), [_, h] = M([]), [A, j] = M("idle"), [I, P] = M(null), [F, w] = M(!1), [k, K] = M(null), O = le(
|
|
7
|
+
() => gr(a.providerConfig),
|
|
8
|
+
[a.providerConfig]
|
|
9
9
|
), R = O.providers, v = le(
|
|
10
10
|
() => R.find((i) => i.id === u) || null,
|
|
11
11
|
[R, u]
|
|
12
12
|
), V = le(() => br(void 0, {
|
|
13
|
-
serialize:
|
|
14
|
-
deserialize:
|
|
15
|
-
}), [
|
|
13
|
+
serialize: a.onSerialize,
|
|
14
|
+
deserialize: a.onDeserialize
|
|
15
|
+
}), [a.onSerialize, a.onDeserialize]), q = _e(/* @__PURE__ */ new Map());
|
|
16
16
|
ne(() => {
|
|
17
17
|
const i = V.load();
|
|
18
|
-
i && (i.providerId && E(i.providerId), i.apiKey && C(i.apiKey), i.model && b(i.model), i.modelName &&
|
|
18
|
+
i && (i.providerId && E(i.providerId), i.apiKey && C(i.apiKey), i.model && b(i.model), i.modelName && l(i.modelName), i.baseUrl && c(i.baseUrl));
|
|
19
19
|
}, [V]), ne(() => {
|
|
20
20
|
if (!u || !v) {
|
|
21
21
|
h([]), K(null), w(!1);
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
|
-
const i = v.supportsModelsApi && (!v.needsApiKey || !!
|
|
24
|
+
const i = v.supportsModelsApi && (!v.needsApiKey || !!o), N = p || v.baseUrl, U = `${u}|${N}|${o}`, J = q.current.get(U);
|
|
25
25
|
if (J) {
|
|
26
26
|
h(J), K(null), w(!1);
|
|
27
27
|
return;
|
|
@@ -35,16 +35,16 @@ function wr(s = {}) {
|
|
|
35
35
|
const ee = setTimeout(async () => {
|
|
36
36
|
try {
|
|
37
37
|
let $;
|
|
38
|
-
|
|
38
|
+
a.modelFetcher ? $ = await a.modelFetcher({
|
|
39
39
|
type: "fetchModels",
|
|
40
40
|
providerId: v.id,
|
|
41
41
|
baseUrl: N,
|
|
42
|
-
apiKey:
|
|
42
|
+
apiKey: o
|
|
43
43
|
}) : $ = await import("@tombcato/ai-selector-core").then((re) => re.fetchModels({
|
|
44
44
|
provider: v,
|
|
45
|
-
apiKey:
|
|
45
|
+
apiKey: o,
|
|
46
46
|
baseUrl: N,
|
|
47
|
-
proxyUrl:
|
|
47
|
+
proxyUrl: a.proxyUrl,
|
|
48
48
|
fallbackToStatic: !1
|
|
49
49
|
})), h($), q.current.set(U, $);
|
|
50
50
|
} catch ($) {
|
|
@@ -56,20 +56,20 @@ function wr(s = {}) {
|
|
|
56
56
|
}
|
|
57
57
|
}, 500);
|
|
58
58
|
return () => clearTimeout(ee);
|
|
59
|
-
}, [u, v,
|
|
59
|
+
}, [u, v, o, p, O, a.proxyUrl, a.modelFetcher]), ne(() => {
|
|
60
60
|
(A === "error" || A === "success") && (j("idle"), P(null));
|
|
61
|
-
}, [
|
|
61
|
+
}, [o, p]);
|
|
62
62
|
const ue = ce(async () => {
|
|
63
|
-
if (!v || v.needsApiKey && !
|
|
63
|
+
if (!v || v.needsApiKey && !o) return;
|
|
64
64
|
j("testing"), P(null);
|
|
65
65
|
let i;
|
|
66
|
-
if (
|
|
66
|
+
if (a.modelFetcher)
|
|
67
67
|
try {
|
|
68
|
-
const N = await
|
|
68
|
+
const N = await a.modelFetcher({
|
|
69
69
|
type: "checkConnection",
|
|
70
70
|
providerId: v.id,
|
|
71
71
|
baseUrl: p || v.baseUrl,
|
|
72
|
-
apiKey:
|
|
72
|
+
apiKey: o,
|
|
73
73
|
modelId: f
|
|
74
74
|
});
|
|
75
75
|
i = {
|
|
@@ -83,46 +83,46 @@ function wr(s = {}) {
|
|
|
83
83
|
else
|
|
84
84
|
i = await yr({
|
|
85
85
|
provider: v,
|
|
86
|
-
apiKey:
|
|
86
|
+
apiKey: o,
|
|
87
87
|
baseUrl: p,
|
|
88
88
|
model: f,
|
|
89
|
-
proxyUrl:
|
|
89
|
+
proxyUrl: a.proxyUrl
|
|
90
90
|
});
|
|
91
91
|
return P(i), j(i.success ? "success" : "error"), setTimeout(() => {
|
|
92
92
|
j("idle");
|
|
93
93
|
}, 2e3), i;
|
|
94
|
-
}, [v,
|
|
94
|
+
}, [v, o, p, f, a.proxyUrl, a.modelFetcher]), de = ce(() => {
|
|
95
95
|
const i = _.find((U) => U.id === f), N = (i == null ? void 0 : i.name) || x || f;
|
|
96
|
-
i != null && i.name && i.name !== x &&
|
|
96
|
+
i != null && i.name && i.name !== x && l(i.name), V.save({
|
|
97
97
|
providerId: u,
|
|
98
|
-
apiKey:
|
|
98
|
+
apiKey: o,
|
|
99
99
|
model: f,
|
|
100
100
|
modelName: N,
|
|
101
101
|
baseUrl: p
|
|
102
102
|
});
|
|
103
|
-
}, [u,
|
|
104
|
-
V.clear(), E(""), C(""), b(""),
|
|
103
|
+
}, [u, o, f, x, p, _, V]), ae = ce(() => {
|
|
104
|
+
V.clear(), E(""), C(""), b(""), l(""), c("");
|
|
105
105
|
}, [V]), z = ce((i) => {
|
|
106
|
-
E(i), C(""), b(""),
|
|
106
|
+
E(i), C(""), b(""), l(""), c(""), j("idle"), P(null);
|
|
107
107
|
}, []), B = ce((i, N) => {
|
|
108
108
|
if (b(i), N)
|
|
109
|
-
|
|
109
|
+
l(N);
|
|
110
110
|
else {
|
|
111
111
|
const U = _.find((J) => J.id === i);
|
|
112
|
-
|
|
112
|
+
l((U == null ? void 0 : U.name) || i);
|
|
113
113
|
}
|
|
114
|
-
}, [_]), Y = le(() => !(!u || !f || v != null && v.needsApiKey && !
|
|
114
|
+
}, [_]), Y = le(() => !(!u || !f || v != null && v.needsApiKey && !o), [u, f, v, o]);
|
|
115
115
|
return {
|
|
116
116
|
// State
|
|
117
117
|
config: le(() => ({
|
|
118
118
|
providerId: u,
|
|
119
|
-
apiKey:
|
|
119
|
+
apiKey: o,
|
|
120
120
|
model: f,
|
|
121
121
|
modelName: x,
|
|
122
122
|
baseUrl: p || (v == null ? void 0 : v.baseUrl) || ""
|
|
123
|
-
}), [u,
|
|
123
|
+
}), [u, o, f, x, p, v]),
|
|
124
124
|
providerId: u,
|
|
125
|
-
apiKey:
|
|
125
|
+
apiKey: o,
|
|
126
126
|
model: f,
|
|
127
127
|
modelName: x,
|
|
128
128
|
baseUrl: p,
|
|
@@ -139,10 +139,10 @@ function wr(s = {}) {
|
|
|
139
139
|
setApiKey: C,
|
|
140
140
|
setModel: b,
|
|
141
141
|
selectModel: B,
|
|
142
|
-
setBaseUrl:
|
|
142
|
+
setBaseUrl: c,
|
|
143
143
|
runTest: ue,
|
|
144
144
|
save: de,
|
|
145
|
-
clear:
|
|
145
|
+
clear: ae
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
148
|
var ye = { exports: {} }, pe = {};
|
|
@@ -159,12 +159,12 @@ var We;
|
|
|
159
159
|
function kr() {
|
|
160
160
|
if (We) return pe;
|
|
161
161
|
We = 1;
|
|
162
|
-
var
|
|
163
|
-
function b(x,
|
|
164
|
-
var
|
|
165
|
-
p !== void 0 && (h = "" + p),
|
|
166
|
-
for (
|
|
167
|
-
if (x && x.defaultProps) for (
|
|
162
|
+
var a = Ve, u = Symbol.for("react.element"), E = Symbol.for("react.fragment"), o = Object.prototype.hasOwnProperty, C = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, f = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
163
|
+
function b(x, l, p) {
|
|
164
|
+
var c, _ = {}, h = null, A = null;
|
|
165
|
+
p !== void 0 && (h = "" + p), l.key !== void 0 && (h = "" + l.key), l.ref !== void 0 && (A = l.ref);
|
|
166
|
+
for (c in l) o.call(l, c) && !f.hasOwnProperty(c) && (_[c] = l[c]);
|
|
167
|
+
if (x && x.defaultProps) for (c in l = x.defaultProps, l) _[c] === void 0 && (_[c] = l[c]);
|
|
168
168
|
return { $$typeof: u, type: x, key: h, ref: A, props: _, _owner: C.current };
|
|
169
169
|
}
|
|
170
170
|
return pe.Fragment = E, pe.jsx = b, pe.jsxs = b, pe;
|
|
@@ -182,24 +182,24 @@ var ve = {};
|
|
|
182
182
|
var Ke;
|
|
183
183
|
function Cr() {
|
|
184
184
|
return Ke || (Ke = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
185
|
-
var
|
|
185
|
+
var a = Ve, u = Symbol.for("react.element"), E = Symbol.for("react.portal"), o = Symbol.for("react.fragment"), C = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), b = Symbol.for("react.provider"), x = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), p = Symbol.for("react.suspense"), c = Symbol.for("react.suspense_list"), _ = Symbol.for("react.memo"), h = Symbol.for("react.lazy"), A = Symbol.for("react.offscreen"), j = Symbol.iterator, I = "@@iterator";
|
|
186
186
|
function P(e) {
|
|
187
187
|
if (e === null || typeof e != "object")
|
|
188
188
|
return null;
|
|
189
189
|
var t = j && e[j] || e[I];
|
|
190
190
|
return typeof t == "function" ? t : null;
|
|
191
191
|
}
|
|
192
|
-
var F =
|
|
192
|
+
var F = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
193
193
|
function w(e) {
|
|
194
194
|
{
|
|
195
|
-
for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0),
|
|
196
|
-
n[
|
|
195
|
+
for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), s = 1; s < t; s++)
|
|
196
|
+
n[s - 1] = arguments[s];
|
|
197
197
|
k("error", e, n);
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
function k(e, t, n) {
|
|
201
201
|
{
|
|
202
|
-
var
|
|
202
|
+
var s = F.ReactDebugCurrentFrame, g = s.getStackAddendum();
|
|
203
203
|
g !== "" && (t += "%s", n = n.concat([g]));
|
|
204
204
|
var y = n.map(function(m) {
|
|
205
205
|
return String(m);
|
|
@@ -210,20 +210,20 @@ function Cr() {
|
|
|
210
210
|
var K = !1, O = !1, R = !1, v = !1, V = !1, q;
|
|
211
211
|
q = Symbol.for("react.module.reference");
|
|
212
212
|
function ue(e) {
|
|
213
|
-
return !!(typeof e == "string" || typeof e == "function" || e ===
|
|
213
|
+
return !!(typeof e == "string" || typeof e == "function" || e === o || e === f || V || e === C || e === p || e === c || v || e === A || K || O || R || typeof e == "object" && e !== null && (e.$$typeof === h || e.$$typeof === _ || e.$$typeof === b || e.$$typeof === x || e.$$typeof === l || // This needs to include all possible module reference object
|
|
214
214
|
// types supported by any Flight configuration anywhere since
|
|
215
215
|
// we don't know which Flight build this will end up being used
|
|
216
216
|
// with.
|
|
217
217
|
e.$$typeof === q || e.getModuleId !== void 0));
|
|
218
218
|
}
|
|
219
219
|
function de(e, t, n) {
|
|
220
|
-
var
|
|
221
|
-
if (
|
|
222
|
-
return
|
|
220
|
+
var s = e.displayName;
|
|
221
|
+
if (s)
|
|
222
|
+
return s;
|
|
223
223
|
var g = t.displayName || t.name || "";
|
|
224
224
|
return g !== "" ? n + "(" + g + ")" : n;
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function ae(e) {
|
|
227
227
|
return e.displayName || "Context";
|
|
228
228
|
}
|
|
229
229
|
function z(e) {
|
|
@@ -234,7 +234,7 @@ function Cr() {
|
|
|
234
234
|
if (typeof e == "string")
|
|
235
235
|
return e;
|
|
236
236
|
switch (e) {
|
|
237
|
-
case
|
|
237
|
+
case o:
|
|
238
238
|
return "Fragment";
|
|
239
239
|
case E:
|
|
240
240
|
return "Portal";
|
|
@@ -244,22 +244,22 @@ function Cr() {
|
|
|
244
244
|
return "StrictMode";
|
|
245
245
|
case p:
|
|
246
246
|
return "Suspense";
|
|
247
|
-
case
|
|
247
|
+
case c:
|
|
248
248
|
return "SuspenseList";
|
|
249
249
|
}
|
|
250
250
|
if (typeof e == "object")
|
|
251
251
|
switch (e.$$typeof) {
|
|
252
252
|
case x:
|
|
253
253
|
var t = e;
|
|
254
|
-
return
|
|
254
|
+
return ae(t) + ".Consumer";
|
|
255
255
|
case b:
|
|
256
256
|
var n = e;
|
|
257
|
-
return
|
|
258
|
-
case
|
|
257
|
+
return ae(n._context) + ".Provider";
|
|
258
|
+
case l:
|
|
259
259
|
return de(e, e.render, "ForwardRef");
|
|
260
260
|
case _:
|
|
261
|
-
var
|
|
262
|
-
return
|
|
261
|
+
var s = e.displayName || null;
|
|
262
|
+
return s !== null ? s : z(e.type) || "Memo";
|
|
263
263
|
case h: {
|
|
264
264
|
var g = e, y = g._payload, m = g._init;
|
|
265
265
|
try {
|
|
@@ -333,15 +333,15 @@ function Cr() {
|
|
|
333
333
|
Y < 0 && w("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
|
-
var
|
|
336
|
+
var se = F.ReactCurrentDispatcher, ee;
|
|
337
337
|
function $(e, t, n) {
|
|
338
338
|
{
|
|
339
339
|
if (ee === void 0)
|
|
340
340
|
try {
|
|
341
341
|
throw Error();
|
|
342
342
|
} catch (g) {
|
|
343
|
-
var
|
|
344
|
-
ee =
|
|
343
|
+
var s = g.stack.trim().match(/\n( *(at )?)/);
|
|
344
|
+
ee = s && s[1] || "";
|
|
345
345
|
}
|
|
346
346
|
return `
|
|
347
347
|
` + ee + e;
|
|
@@ -360,12 +360,12 @@ function Cr() {
|
|
|
360
360
|
if (n !== void 0)
|
|
361
361
|
return n;
|
|
362
362
|
}
|
|
363
|
-
var
|
|
363
|
+
var s;
|
|
364
364
|
re = !0;
|
|
365
365
|
var g = Error.prepareStackTrace;
|
|
366
366
|
Error.prepareStackTrace = void 0;
|
|
367
367
|
var y;
|
|
368
|
-
y =
|
|
368
|
+
y = se.current, se.current = null, U();
|
|
369
369
|
try {
|
|
370
370
|
if (t) {
|
|
371
371
|
var m = function() {
|
|
@@ -379,14 +379,14 @@ function Cr() {
|
|
|
379
379
|
try {
|
|
380
380
|
Reflect.construct(m, []);
|
|
381
381
|
} catch (D) {
|
|
382
|
-
|
|
382
|
+
s = D;
|
|
383
383
|
}
|
|
384
384
|
Reflect.construct(e, [], m);
|
|
385
385
|
} else {
|
|
386
386
|
try {
|
|
387
387
|
m.call();
|
|
388
388
|
} catch (D) {
|
|
389
|
-
|
|
389
|
+
s = D;
|
|
390
390
|
}
|
|
391
391
|
e.call(m.prototype);
|
|
392
392
|
}
|
|
@@ -394,14 +394,14 @@ function Cr() {
|
|
|
394
394
|
try {
|
|
395
395
|
throw Error();
|
|
396
396
|
} catch (D) {
|
|
397
|
-
|
|
397
|
+
s = D;
|
|
398
398
|
}
|
|
399
399
|
e();
|
|
400
400
|
}
|
|
401
401
|
} catch (D) {
|
|
402
|
-
if (D &&
|
|
402
|
+
if (D && s && typeof D.stack == "string") {
|
|
403
403
|
for (var d = D.stack.split(`
|
|
404
|
-
`), L =
|
|
404
|
+
`), L = s.stack.split(`
|
|
405
405
|
`), T = d.length - 1, S = L.length - 1; T >= 1 && S >= 0 && d[T] !== L[S]; )
|
|
406
406
|
S--;
|
|
407
407
|
for (; T >= 1 && S >= 0; T--, S--)
|
|
@@ -418,7 +418,7 @@ function Cr() {
|
|
|
418
418
|
}
|
|
419
419
|
}
|
|
420
420
|
} finally {
|
|
421
|
-
re = !1,
|
|
421
|
+
re = !1, se.current = y, J(), Error.prepareStackTrace = g;
|
|
422
422
|
}
|
|
423
423
|
var oe = e ? e.displayName || e.name : "", te = oe ? $(oe) : "";
|
|
424
424
|
return typeof e == "function" && xe.set(e, te), te;
|
|
@@ -440,17 +440,17 @@ function Cr() {
|
|
|
440
440
|
switch (e) {
|
|
441
441
|
case p:
|
|
442
442
|
return $("Suspense");
|
|
443
|
-
case
|
|
443
|
+
case c:
|
|
444
444
|
return $("SuspenseList");
|
|
445
445
|
}
|
|
446
446
|
if (typeof e == "object")
|
|
447
447
|
switch (e.$$typeof) {
|
|
448
|
-
case
|
|
448
|
+
case l:
|
|
449
449
|
return qe(e.render);
|
|
450
450
|
case _:
|
|
451
451
|
return ge(e.type, t, n);
|
|
452
452
|
case h: {
|
|
453
|
-
var
|
|
453
|
+
var s = e, g = s._payload, y = s._init;
|
|
454
454
|
try {
|
|
455
455
|
return ge(y(g), t, n);
|
|
456
456
|
} catch {
|
|
@@ -467,7 +467,7 @@ function Cr() {
|
|
|
467
467
|
} else
|
|
468
468
|
Te.setExtraStackFrame(null);
|
|
469
469
|
}
|
|
470
|
-
function Xe(e, t, n,
|
|
470
|
+
function Xe(e, t, n, s, g) {
|
|
471
471
|
{
|
|
472
472
|
var y = Function.call.bind(me);
|
|
473
473
|
for (var m in e)
|
|
@@ -475,14 +475,14 @@ function Cr() {
|
|
|
475
475
|
var d = void 0;
|
|
476
476
|
try {
|
|
477
477
|
if (typeof e[m] != "function") {
|
|
478
|
-
var L = Error((
|
|
478
|
+
var L = Error((s || "React class") + ": " + n + " type `" + m + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[m] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
479
479
|
throw L.name = "Invariant Violation", L;
|
|
480
480
|
}
|
|
481
|
-
d = e[m](t, m,
|
|
481
|
+
d = e[m](t, m, s, n, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
482
482
|
} catch (T) {
|
|
483
483
|
d = T;
|
|
484
484
|
}
|
|
485
|
-
d && !(d instanceof Error) && (be(g), w("%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).",
|
|
485
|
+
d && !(d instanceof Error) && (be(g), w("%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).", s || "React class", n, m, typeof d), be(null)), d instanceof Error && !(d.message in Ne) && (Ne[d.message] = !0, be(g), w("Failed %s type: %s", n, d.message), be(null));
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
488
|
}
|
|
@@ -535,7 +535,7 @@ function Cr() {
|
|
|
535
535
|
function nr(e, t) {
|
|
536
536
|
typeof e.ref == "string" && Oe.current;
|
|
537
537
|
}
|
|
538
|
-
function
|
|
538
|
+
function ar(e, t) {
|
|
539
539
|
{
|
|
540
540
|
var n = function() {
|
|
541
541
|
Me || (Me = !0, w("%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)", t));
|
|
@@ -546,7 +546,7 @@ function Cr() {
|
|
|
546
546
|
});
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
|
-
function
|
|
549
|
+
function sr(e, t) {
|
|
550
550
|
{
|
|
551
551
|
var n = function() {
|
|
552
552
|
Fe || (Fe = !0, w("%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)", t));
|
|
@@ -557,7 +557,7 @@ function Cr() {
|
|
|
557
557
|
});
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
|
-
var ir = function(e, t, n,
|
|
560
|
+
var ir = function(e, t, n, s, g, y, m) {
|
|
561
561
|
var d = {
|
|
562
562
|
// This tag allows us to uniquely identify this as a React Element
|
|
563
563
|
$$typeof: u,
|
|
@@ -578,7 +578,7 @@ function Cr() {
|
|
|
578
578
|
configurable: !1,
|
|
579
579
|
enumerable: !1,
|
|
580
580
|
writable: !1,
|
|
581
|
-
value:
|
|
581
|
+
value: s
|
|
582
582
|
}), Object.defineProperty(d, "_source", {
|
|
583
583
|
configurable: !1,
|
|
584
584
|
enumerable: !1,
|
|
@@ -586,7 +586,7 @@ function Cr() {
|
|
|
586
586
|
value: g
|
|
587
587
|
}), Object.freeze && (Object.freeze(d.props), Object.freeze(d)), d;
|
|
588
588
|
};
|
|
589
|
-
function or(e, t, n,
|
|
589
|
+
function or(e, t, n, s, g) {
|
|
590
590
|
{
|
|
591
591
|
var y, m = {}, d = null, L = null;
|
|
592
592
|
n !== void 0 && (Pe(n), d = "" + n), tr(t) && (Pe(t.key), d = "" + t.key), rr(t) && (L = t.ref, nr(t, g));
|
|
@@ -599,9 +599,9 @@ function Cr() {
|
|
|
599
599
|
}
|
|
600
600
|
if (d || L) {
|
|
601
601
|
var S = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
602
|
-
d &&
|
|
602
|
+
d && ar(m, S), L && sr(m, S);
|
|
603
603
|
}
|
|
604
|
-
return ir(e, d, L, g,
|
|
604
|
+
return ir(e, d, L, g, s, Oe.current, m);
|
|
605
605
|
}
|
|
606
606
|
}
|
|
607
607
|
var we = F.ReactCurrentOwner, Le = F.ReactDebugCurrentFrame;
|
|
@@ -654,8 +654,8 @@ Check the top-level render call using <` + n + ">.");
|
|
|
654
654
|
if (Ie[n])
|
|
655
655
|
return;
|
|
656
656
|
Ie[n] = !0;
|
|
657
|
-
var
|
|
658
|
-
e && e._owner && e._owner !== we.current && (
|
|
657
|
+
var s = "";
|
|
658
|
+
e && e._owner && e._owner !== we.current && (s = " It was passed a child from " + z(e._owner.type) + "."), ie(e), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', n, s), ie(null);
|
|
659
659
|
}
|
|
660
660
|
}
|
|
661
661
|
function $e(e, t) {
|
|
@@ -664,8 +664,8 @@ Check the top-level render call using <` + n + ">.");
|
|
|
664
664
|
return;
|
|
665
665
|
if (je(e))
|
|
666
666
|
for (var n = 0; n < e.length; n++) {
|
|
667
|
-
var
|
|
668
|
-
Ce(
|
|
667
|
+
var s = e[n];
|
|
668
|
+
Ce(s) && Ue(s, t);
|
|
669
669
|
}
|
|
670
670
|
else if (Ce(e))
|
|
671
671
|
e._store && (e._store.validated = !0);
|
|
@@ -685,15 +685,15 @@ Check the top-level render call using <` + n + ">.");
|
|
|
685
685
|
var n;
|
|
686
686
|
if (typeof t == "function")
|
|
687
687
|
n = t.propTypes;
|
|
688
|
-
else if (typeof t == "object" && (t.$$typeof ===
|
|
688
|
+
else if (typeof t == "object" && (t.$$typeof === l || // Note: Memo only checks outer props here.
|
|
689
689
|
// Inner props are checked in the reconciler.
|
|
690
690
|
t.$$typeof === _))
|
|
691
691
|
n = t.propTypes;
|
|
692
692
|
else
|
|
693
693
|
return;
|
|
694
694
|
if (n) {
|
|
695
|
-
var
|
|
696
|
-
Xe(n, e.props, "prop",
|
|
695
|
+
var s = z(t);
|
|
696
|
+
Xe(n, e.props, "prop", s, e);
|
|
697
697
|
} else if (t.PropTypes !== void 0 && !ke) {
|
|
698
698
|
ke = !0;
|
|
699
699
|
var g = z(t);
|
|
@@ -705,9 +705,9 @@ Check the top-level render call using <` + n + ">.");
|
|
|
705
705
|
function dr(e) {
|
|
706
706
|
{
|
|
707
707
|
for (var t = Object.keys(e.props), n = 0; n < t.length; n++) {
|
|
708
|
-
var
|
|
709
|
-
if (
|
|
710
|
-
ie(e), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",
|
|
708
|
+
var s = t[n];
|
|
709
|
+
if (s !== "children" && s !== "key") {
|
|
710
|
+
ie(e), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", s), ie(null);
|
|
711
711
|
break;
|
|
712
712
|
}
|
|
713
713
|
}
|
|
@@ -715,7 +715,7 @@ Check the top-level render call using <` + n + ">.");
|
|
|
715
715
|
}
|
|
716
716
|
}
|
|
717
717
|
var De = {};
|
|
718
|
-
function ze(e, t, n,
|
|
718
|
+
function ze(e, t, n, s, g, y) {
|
|
719
719
|
{
|
|
720
720
|
var m = ue(e);
|
|
721
721
|
if (!m) {
|
|
@@ -732,7 +732,7 @@ Check the top-level render call using <` + n + ">.");
|
|
|
732
732
|
if (m) {
|
|
733
733
|
var W = t.children;
|
|
734
734
|
if (W !== void 0)
|
|
735
|
-
if (
|
|
735
|
+
if (s)
|
|
736
736
|
if (je(W)) {
|
|
737
737
|
for (var oe = 0; oe < W.length; oe++)
|
|
738
738
|
$e(W[oe], e);
|
|
@@ -756,7 +756,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
756
756
|
<%s key={someKey} {...props} />`, Ee, te, hr, te), De[te + Ee] = !0;
|
|
757
757
|
}
|
|
758
758
|
}
|
|
759
|
-
return e ===
|
|
759
|
+
return e === o ? dr(S) : ur(S), S;
|
|
760
760
|
}
|
|
761
761
|
}
|
|
762
762
|
function fr(e, t, n) {
|
|
@@ -766,7 +766,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
766
766
|
return ze(e, t, n, !1);
|
|
767
767
|
}
|
|
768
768
|
var pr = mr, vr = fr;
|
|
769
|
-
ve.Fragment =
|
|
769
|
+
ve.Fragment = o, ve.jsx = pr, ve.jsxs = vr;
|
|
770
770
|
})()), ve;
|
|
771
771
|
}
|
|
772
772
|
var Be;
|
|
@@ -774,32 +774,32 @@ function Er() {
|
|
|
774
774
|
return Be || (Be = 1, process.env.NODE_ENV === "production" ? ye.exports = kr() : ye.exports = Cr()), ye.exports;
|
|
775
775
|
}
|
|
776
776
|
var r = Er();
|
|
777
|
-
function Ye({ text:
|
|
778
|
-
return !
|
|
777
|
+
function Ye({ text: a, className: u = "", placeholder: E }) {
|
|
778
|
+
return !a && E ? /* @__PURE__ */ r.jsx("span", { className: `apmsu-placeholder ${u}`, children: E }) : a ? /* @__PURE__ */ r.jsx("span", { className: `inline-flex min-w-0 ${u}`, children: /* @__PURE__ */ r.jsx(jr, { value: a, charWidth: 0.8, duration: 300 }) }) : null;
|
|
779
779
|
}
|
|
780
780
|
function _r({
|
|
781
|
-
providers:
|
|
781
|
+
providers: a,
|
|
782
782
|
selectedProviderId: u,
|
|
783
783
|
onSelect: E,
|
|
784
|
-
isOpen:
|
|
784
|
+
isOpen: o,
|
|
785
785
|
setIsOpen: C,
|
|
786
786
|
disabled: f,
|
|
787
787
|
language: b = "zh"
|
|
788
788
|
}) {
|
|
789
|
-
const x = he[b],
|
|
789
|
+
const x = he[b], l = _e(null), p = a.find((c) => c.id === u);
|
|
790
790
|
return ne(() => {
|
|
791
|
-
const
|
|
792
|
-
|
|
791
|
+
const c = (_) => {
|
|
792
|
+
l.current && !l.current.contains(_.target) && C(!1);
|
|
793
793
|
};
|
|
794
|
-
return document.addEventListener("mousedown",
|
|
795
|
-
}, [C]), /* @__PURE__ */ r.jsxs("div", { className: "apmsu-field", ref:
|
|
794
|
+
return document.addEventListener("mousedown", c), () => document.removeEventListener("mousedown", c);
|
|
795
|
+
}, [C]), /* @__PURE__ */ r.jsxs("div", { className: "apmsu-field", ref: l, children: [
|
|
796
796
|
/* @__PURE__ */ r.jsx("label", { className: "apmsu-label", children: x.providerLabel }),
|
|
797
797
|
/* @__PURE__ */ r.jsxs("div", { className: "relative", children: [
|
|
798
798
|
/* @__PURE__ */ r.jsxs(
|
|
799
799
|
"button",
|
|
800
800
|
{
|
|
801
801
|
type: "button",
|
|
802
|
-
onClick: () => !f && C(!
|
|
802
|
+
onClick: () => !f && C(!o),
|
|
803
803
|
disabled: f,
|
|
804
804
|
className: "apmsu-select-trigger",
|
|
805
805
|
children: [
|
|
@@ -814,42 +814,42 @@ function _r({
|
|
|
814
814
|
),
|
|
815
815
|
/* @__PURE__ */ r.jsx(Ye, { text: p.name })
|
|
816
816
|
] }) : /* @__PURE__ */ r.jsx("span", { className: "apmsu-placeholder", children: x.selectProvider }),
|
|
817
|
-
/* @__PURE__ */ r.jsx(Rr, { isOpen:
|
|
817
|
+
/* @__PURE__ */ r.jsx(Rr, { isOpen: o })
|
|
818
818
|
]
|
|
819
819
|
}
|
|
820
820
|
),
|
|
821
|
-
/* @__PURE__ */ r.jsx("div", { className: `apmsu-dropdown max-h-[300px] overflow-auto p-1 origin-top ${
|
|
821
|
+
/* @__PURE__ */ r.jsx("div", { className: `apmsu-dropdown max-h-[300px] overflow-auto p-1 origin-top ${o ? "apmsu-dropdown-open" : ""}`, children: a.map((c) => /* @__PURE__ */ r.jsxs(
|
|
822
822
|
"button",
|
|
823
823
|
{
|
|
824
824
|
type: "button",
|
|
825
825
|
onClick: () => {
|
|
826
|
-
E(
|
|
826
|
+
E(c.id), C(!1);
|
|
827
827
|
},
|
|
828
|
-
className: `apmsu-dropdown-item rounded-sm ${u ===
|
|
828
|
+
className: `apmsu-dropdown-item rounded-sm ${u === c.id ? "apmsu-dropdown-item-active" : ""}`,
|
|
829
829
|
children: [
|
|
830
830
|
/* @__PURE__ */ r.jsxs("div", { className: "flex items-center gap-2 flex-shrink-0", children: [
|
|
831
831
|
/* @__PURE__ */ r.jsx(
|
|
832
832
|
"img",
|
|
833
833
|
{
|
|
834
|
-
src:
|
|
835
|
-
alt:
|
|
834
|
+
src: c.icon,
|
|
835
|
+
alt: c.name,
|
|
836
836
|
className: "apmsu-provider-icon"
|
|
837
837
|
}
|
|
838
838
|
),
|
|
839
|
-
/* @__PURE__ */ r.jsx("span", { className: "font-medium whitespace-nowrap", children:
|
|
839
|
+
/* @__PURE__ */ r.jsx("span", { className: "font-medium whitespace-nowrap", children: c.name })
|
|
840
840
|
] }),
|
|
841
|
-
/* @__PURE__ */ r.jsx("span", { className: "apmsu-hint-text ml-auto text-right truncate flex-1 min-w-0", children:
|
|
841
|
+
/* @__PURE__ */ r.jsx("span", { className: "apmsu-hint-text ml-auto text-right truncate flex-1 min-w-0", children: c.baseUrl.replace("https://", "") })
|
|
842
842
|
]
|
|
843
843
|
},
|
|
844
|
-
|
|
844
|
+
c.id
|
|
845
845
|
)) })
|
|
846
846
|
] })
|
|
847
847
|
] });
|
|
848
848
|
}
|
|
849
|
-
const Rr = ({ isOpen:
|
|
849
|
+
const Rr = ({ isOpen: a }) => /* @__PURE__ */ r.jsx(
|
|
850
850
|
"svg",
|
|
851
851
|
{
|
|
852
|
-
className: `apmsu-chevron ${
|
|
852
|
+
className: `apmsu-chevron ${a ? "rotate-180" : ""}`,
|
|
853
853
|
fill: "none",
|
|
854
854
|
stroke: "currentColor",
|
|
855
855
|
viewBox: "0 0 24 24",
|
|
@@ -857,33 +857,32 @@ const Rr = ({ isOpen: s }) => /* @__PURE__ */ r.jsx(
|
|
|
857
857
|
}
|
|
858
858
|
);
|
|
859
859
|
function Nr({
|
|
860
|
-
provider:
|
|
860
|
+
provider: a,
|
|
861
861
|
apiKey: u,
|
|
862
862
|
onChange: E,
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
language: f = "zh"
|
|
863
|
+
disabled: o,
|
|
864
|
+
language: C = "zh"
|
|
866
865
|
}) {
|
|
867
|
-
const [
|
|
868
|
-
if (!
|
|
869
|
-
const
|
|
866
|
+
const [f, b] = M(!1), x = he[C];
|
|
867
|
+
if (!a || !a.needsApiKey) return null;
|
|
868
|
+
const l = () => "apmsu-input apmsu-input-default";
|
|
870
869
|
return /* @__PURE__ */ r.jsxs("div", { className: "space-y-2", children: [
|
|
871
|
-
/* @__PURE__ */ r.jsx("label", { className: "apmsu-label", children:
|
|
870
|
+
/* @__PURE__ */ r.jsx("label", { className: "apmsu-label", children: x.apiKeyLabel }),
|
|
872
871
|
/* @__PURE__ */ r.jsxs("div", { className: "relative", children: [
|
|
873
872
|
/* @__PURE__ */ r.jsx(
|
|
874
873
|
"input",
|
|
875
874
|
{
|
|
876
|
-
type:
|
|
875
|
+
type: f ? "text" : "password",
|
|
877
876
|
value: u,
|
|
878
|
-
onChange: (
|
|
879
|
-
onFocus: () =>
|
|
880
|
-
onBlur: () =>
|
|
881
|
-
placeholder:
|
|
882
|
-
disabled:
|
|
883
|
-
className: `${
|
|
877
|
+
onChange: (p) => E(p.target.value),
|
|
878
|
+
onFocus: () => b(!0),
|
|
879
|
+
onBlur: () => b(!1),
|
|
880
|
+
placeholder: x.apiKeyPlaceholder,
|
|
881
|
+
disabled: o,
|
|
882
|
+
className: `${l()} pr-10`
|
|
884
883
|
}
|
|
885
884
|
),
|
|
886
|
-
/* @__PURE__ */ r.jsx("span", { className: "absolute right-3 top-1/2 -translate-y-1/2 flex items-center justify-center", children:
|
|
885
|
+
/* @__PURE__ */ r.jsx("span", { className: "absolute right-3 top-1/2 -translate-y-1/2 flex items-center justify-center", children: f ? /* @__PURE__ */ r.jsxs("svg", { className: "w-4 h-4 text-gray-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: [
|
|
887
886
|
/* @__PURE__ */ r.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 12a3 3 0 11-6 0 3 3 0 016 0z" }),
|
|
888
887
|
/* @__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" })
|
|
889
888
|
] }) : /* @__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" }) }) })
|
|
@@ -891,21 +890,21 @@ function Nr({
|
|
|
891
890
|
] });
|
|
892
891
|
}
|
|
893
892
|
function Tr({
|
|
894
|
-
provider:
|
|
893
|
+
provider: a,
|
|
895
894
|
models: u,
|
|
896
895
|
selectedModelId: E,
|
|
897
|
-
onSelect:
|
|
896
|
+
onSelect: o,
|
|
898
897
|
isOpen: C,
|
|
899
898
|
setIsOpen: f,
|
|
900
899
|
hasApiKey: b,
|
|
901
900
|
disabled: x,
|
|
902
|
-
language:
|
|
901
|
+
language: l = "zh",
|
|
903
902
|
isFetchingModels: p,
|
|
904
|
-
fetchModelError:
|
|
903
|
+
fetchModelError: c,
|
|
905
904
|
selectedModelName: _
|
|
906
905
|
}) {
|
|
907
906
|
var w;
|
|
908
|
-
const h = he[
|
|
907
|
+
const h = he[l], A = _e(null), [j, I] = M("");
|
|
909
908
|
ne(() => {
|
|
910
909
|
const k = (K) => {
|
|
911
910
|
A.current && !A.current.contains(K.target) && (f(!1), I(""));
|
|
@@ -922,8 +921,8 @@ function Tr({
|
|
|
922
921
|
"button",
|
|
923
922
|
{
|
|
924
923
|
type: "button",
|
|
925
|
-
onClick: () => !x &&
|
|
926
|
-
disabled: x || !
|
|
924
|
+
onClick: () => !x && a && f(!C),
|
|
925
|
+
disabled: x || !a,
|
|
927
926
|
className: "apmsu-select-trigger",
|
|
928
927
|
children: [
|
|
929
928
|
/* @__PURE__ */ r.jsx(
|
|
@@ -955,7 +954,7 @@ function Tr({
|
|
|
955
954
|
{
|
|
956
955
|
type: "button",
|
|
957
956
|
onClick: () => {
|
|
958
|
-
|
|
957
|
+
o(j), f(!1), I("");
|
|
959
958
|
},
|
|
960
959
|
className: "apmsu-dropdown-item bg-blue-50 dark:bg-blue-900/20 border-b",
|
|
961
960
|
children: /* @__PURE__ */ r.jsxs("span", { className: "text-blue-500", children: [
|
|
@@ -970,7 +969,7 @@ function Tr({
|
|
|
970
969
|
{
|
|
971
970
|
type: "button",
|
|
972
971
|
onClick: () => {
|
|
973
|
-
|
|
972
|
+
o(k.id, k.name), f(!1), I("");
|
|
974
973
|
},
|
|
975
974
|
className: `apmsu-dropdown-item ${E === k.id ? "apmsu-dropdown-item-active" : ""}`,
|
|
976
975
|
children: /* @__PURE__ */ r.jsx("span", { children: k.name })
|
|
@@ -981,13 +980,13 @@ function Tr({
|
|
|
981
980
|
] })
|
|
982
981
|
] })
|
|
983
982
|
] }),
|
|
984
|
-
(
|
|
983
|
+
(a == null ? void 0 : a.supportsModelsApi) && /* @__PURE__ */ r.jsx("div", { className: "min-h-[20px] flex items-center", children: p ? /* @__PURE__ */ r.jsx("p", { className: "apmsu-hint-text animate-pulse", children: h.refreshingModels }) : c ? /* @__PURE__ */ r.jsx("p", { className: "apmsu-hint-text dark:text-zinc-500", children: h[c] || c }) : a != null && a.needsApiKey && !b ? /* @__PURE__ */ r.jsx("p", { className: "apmsu-hint-text", children: h.apiKeyTip }) : /* @__PURE__ */ r.jsx("p", { className: "apmsu-hint-text", children: h.modelListUpdated }) })
|
|
985
984
|
] });
|
|
986
985
|
}
|
|
987
|
-
const Sr = ({ isOpen:
|
|
986
|
+
const Sr = ({ isOpen: a }) => /* @__PURE__ */ r.jsx(
|
|
988
987
|
"svg",
|
|
989
988
|
{
|
|
990
|
-
className: `apmsu-chevron ${
|
|
989
|
+
className: `apmsu-chevron ${a ? "rotate-180" : ""}`,
|
|
991
990
|
fill: "none",
|
|
992
991
|
stroke: "currentColor",
|
|
993
992
|
viewBox: "0 0 24 24",
|
|
@@ -995,14 +994,14 @@ const Sr = ({ isOpen: s }) => /* @__PURE__ */ r.jsx(
|
|
|
995
994
|
}
|
|
996
995
|
);
|
|
997
996
|
function Pr({
|
|
998
|
-
provider:
|
|
997
|
+
provider: a,
|
|
999
998
|
baseUrl: u,
|
|
1000
999
|
onChange: E,
|
|
1001
|
-
disabled:
|
|
1000
|
+
disabled: o,
|
|
1002
1001
|
language: C = "zh"
|
|
1003
1002
|
}) {
|
|
1004
1003
|
const [f, b] = M(!1), x = he[C];
|
|
1005
|
-
return
|
|
1004
|
+
return a ? /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
1006
1005
|
/* @__PURE__ */ r.jsxs(
|
|
1007
1006
|
"button",
|
|
1008
1007
|
{
|
|
@@ -1034,9 +1033,9 @@ function Pr({
|
|
|
1034
1033
|
{
|
|
1035
1034
|
type: "text",
|
|
1036
1035
|
value: u,
|
|
1037
|
-
onChange: (
|
|
1038
|
-
placeholder:
|
|
1039
|
-
disabled:
|
|
1036
|
+
onChange: (l) => E(l.target.value),
|
|
1037
|
+
placeholder: a.baseUrl,
|
|
1038
|
+
disabled: o,
|
|
1040
1039
|
className: "apmsu-input apmsu-input-default"
|
|
1041
1040
|
}
|
|
1042
1041
|
) })
|
|
@@ -1045,17 +1044,17 @@ function Pr({
|
|
|
1045
1044
|
] }) : null;
|
|
1046
1045
|
}
|
|
1047
1046
|
function Ur({
|
|
1048
|
-
proxyUrl:
|
|
1047
|
+
proxyUrl: a,
|
|
1049
1048
|
config: u,
|
|
1050
1049
|
initialConfig: E,
|
|
1051
|
-
title:
|
|
1050
|
+
title: o,
|
|
1052
1051
|
showPreview: C = !1,
|
|
1053
1052
|
saveButtonText: f,
|
|
1054
1053
|
disabled: b = !1,
|
|
1055
1054
|
onSave: x,
|
|
1056
|
-
onTestResult:
|
|
1055
|
+
onTestResult: l,
|
|
1057
1056
|
onChange: p,
|
|
1058
|
-
onSerialize:
|
|
1057
|
+
onSerialize: c,
|
|
1059
1058
|
onDeserialize: _,
|
|
1060
1059
|
language: h = "zh",
|
|
1061
1060
|
modelFetcher: A
|
|
@@ -1074,7 +1073,7 @@ function Ur({
|
|
|
1074
1073
|
isValid: q,
|
|
1075
1074
|
setProviderId: ue,
|
|
1076
1075
|
setApiKey: de,
|
|
1077
|
-
selectModel:
|
|
1076
|
+
selectModel: ae,
|
|
1078
1077
|
setBaseUrl: z,
|
|
1079
1078
|
runTest: B,
|
|
1080
1079
|
save: Y,
|
|
@@ -1082,23 +1081,23 @@ function Ur({
|
|
|
1082
1081
|
fetchModelError: X,
|
|
1083
1082
|
config: G
|
|
1084
1083
|
} = wr({
|
|
1085
|
-
proxyUrl:
|
|
1084
|
+
proxyUrl: a,
|
|
1086
1085
|
providerConfig: u,
|
|
1087
1086
|
initialConfig: E,
|
|
1088
|
-
onSerialize:
|
|
1087
|
+
onSerialize: c,
|
|
1089
1088
|
onDeserialize: _,
|
|
1090
1089
|
modelFetcher: A
|
|
1091
|
-
}), [H, Z] = M(!1), [Q, i] = M(!1), [N, U] = M("idle"), [J,
|
|
1090
|
+
}), [H, Z] = M(!1), [Q, i] = M(!1), [N, U] = M("idle"), [J, se] = M(!1);
|
|
1092
1091
|
ne(() => {
|
|
1093
1092
|
p == null || p({ providerId: I, apiKey: P, model: F, baseUrl: k });
|
|
1094
1093
|
}, [I, P, F, k, p]), ne(() => {
|
|
1095
|
-
R && (
|
|
1096
|
-
}, [R,
|
|
1094
|
+
R && (l == null || l(R));
|
|
1095
|
+
}, [R, l]);
|
|
1097
1096
|
const ee = ce(() => {
|
|
1098
1097
|
Y(), U("saved"), x == null || x(G), setTimeout(() => U("idle"), 2e3);
|
|
1099
1098
|
}, [Y, x, G]);
|
|
1100
1099
|
return /* @__PURE__ */ r.jsxs("div", { className: "apmsu-card", children: [
|
|
1101
|
-
|
|
1100
|
+
o && /* @__PURE__ */ r.jsx("h2", { className: "text-lg font-semibold mb-4", children: o }),
|
|
1102
1101
|
/* @__PURE__ */ r.jsxs("div", { className: "space-y-3", children: [
|
|
1103
1102
|
/* @__PURE__ */ r.jsx(
|
|
1104
1103
|
_r,
|
|
@@ -1140,7 +1139,7 @@ function Ur({
|
|
|
1140
1139
|
provider: v,
|
|
1141
1140
|
models: K,
|
|
1142
1141
|
selectedModelId: F,
|
|
1143
|
-
onSelect:
|
|
1142
|
+
onSelect: ae,
|
|
1144
1143
|
isOpen: Q,
|
|
1145
1144
|
setIsOpen: i,
|
|
1146
1145
|
hasApiKey: !!P,
|
|
@@ -1202,7 +1201,7 @@ function Ur({
|
|
|
1202
1201
|
"button",
|
|
1203
1202
|
{
|
|
1204
1203
|
type: "button",
|
|
1205
|
-
onClick: () =>
|
|
1204
|
+
onClick: () => se(!J),
|
|
1206
1205
|
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",
|
|
1207
1206
|
children: [
|
|
1208
1207
|
/* @__PURE__ */ r.jsx("h3", { className: "text-xs font-medium text-gray-500 dark:text-zinc-500 uppercase tracking-wider", children: j.preview }),
|