@wso2/am-core-ui 0.0.17 → 0.0.19
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/APIKeysManager-C0phJriD.js +241 -0
- package/dist/CatalogKindListing-DtFI2YMG.js +118 -0
- package/dist/CodeBlock-mB_Loq7I.js +21736 -0
- package/dist/EnvironmentCard-09h1XRxx.js +310 -0
- package/dist/EnvironmentSelector-B7Bl93s2.js +48 -0
- package/dist/MCPLogo-D9IJzzl7.js +30 -0
- package/dist/PolicyListSection-o4k9e8XO.js +2475 -0
- package/dist/ResourceListShell-Cx6mdeqv.js +463 -0
- package/dist/SwaggerSpecViewer-BvkhoKsi.js +106 -0
- package/dist/clipboard-YAzStmkw.js +23 -0
- package/dist/debounce-BV83M53b.js +208 -0
- package/dist/format-BEZZRyE2.js +29 -0
- package/dist/formatDistanceToNow-TErllcH8.js +100 -0
- package/dist/gatewayScripts-D8O45W8u.js +72 -0
- package/dist/highlight-BsUzxSR3.js +454 -0
- package/dist/index-B52h3RHg.js +1290 -0
- package/dist/index-BP5drcF2.js +1265 -0
- package/dist/index-BZ4vxviI.js +7981 -0
- package/dist/index-B_Z0MwXk.js +25012 -0
- package/dist/index-BfjzUWDa.js +1397 -0
- package/dist/{index-CDm_burV.js → index-BnV-PkwM.js} +22 -20
- package/dist/index-CGDYgUCH.js +711 -0
- package/dist/index-COt7nJIf.js +2286 -0
- package/dist/index-CWZjOy1h.js +2247 -0
- package/dist/index-CezvogTQ.js +116 -0
- package/dist/index-CgCWbWzN.js +2342 -0
- package/dist/index-CjCkcuuI.js +322 -0
- package/dist/index-CjXvuf9m.js +1354 -0
- package/dist/index-DD4qF7gq.js +2340 -0
- package/dist/index-DeQ-9KTC.js +737 -0
- package/dist/index-Df6OBy4E.js +3041 -0
- package/dist/index-KRsV2L4V.js +1564 -0
- package/dist/index-PUuASE1F.js +2507 -0
- package/dist/index-PWsNvJB-.js +546 -0
- package/dist/index-UqDmyMSA.js +119 -0
- package/dist/index-_0Pj_ZtW.js +459 -0
- package/dist/{index-DJABKRWO.js → index-sr-mWz4T.js} +31 -30
- package/dist/index.d.ts +496 -200
- package/dist/index.js +462 -439
- package/dist/llmProviderPayload-CzihkdNa.js +332 -0
- package/dist/schemas-DFScWdSL.js +2969 -0
- package/package.json +1 -1
- package/dist/index-B0d-vovv.js +0 -236
- package/dist/index-CCmLfbLS.js +0 -80707
- package/dist/index-qanXZe0s.js +0 -3037
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
import { jsxs as s, jsx as t, Fragment as me } from "react/jsx-runtime";
|
|
2
|
+
import { useState as k, useMemo as B, useEffect as R, useCallback as L } from "react";
|
|
3
|
+
import { Form as o, Typography as U, Box as S, TextField as T, Skeleton as H, CardContent as ue, Collapse as F, InputAdornment as Y, Tooltip as ee, IconButton as te, Autocomplete as ae, Alert as O, Button as re } from "@wso2/oxygen-ui";
|
|
4
|
+
import { Brain as he, Unlock as ye, Lock as ge, EyeOff as ve, Eye as fe } from "@wso2/oxygen-ui-icons-react";
|
|
5
|
+
import { o as xe, c as Ie, s as I, l as $ } from "./schemas-DFScWdSL.js";
|
|
6
|
+
import { c as be } from "react/compiler-runtime";
|
|
7
|
+
import { r as we, p as Ce } from "./index-B_Z0MwXk.js";
|
|
8
|
+
import "@tanstack/react-query";
|
|
9
|
+
import { P as Te } from "./PolicyListSection-o4k9e8XO.js";
|
|
10
|
+
const Ee = /^v\d+\.\d+$/, Se = xe({
|
|
11
|
+
templateId: I().trim().min(1, "Select a provider template"),
|
|
12
|
+
displayName: I().trim().min(1, "Display name is required").min(2, "Display name must be at least 2 characters").max(120, "Display name must be at most 120 characters"),
|
|
13
|
+
version: I().trim().min(1, "Version is required").regex(Ee, "Version must match v<major>.<minor> (e.g., v1.0)"),
|
|
14
|
+
description: I().trim().max(512, "Description cannot exceed 512 characters").optional().or($("")),
|
|
15
|
+
context: I().trim().refine((i) => !i || i !== "/" && /^\/([a-zA-Z0-9_\-/]*[^/])?$/.test(i), "Context must start with / and have no trailing slash; root path (/) is invalid (e.g., /my-provider)").optional().or($("")),
|
|
16
|
+
upstreamUrl: I().trim().refine((i) => !i || I().url().safeParse(i).success, "Enter a valid URL"),
|
|
17
|
+
apiKey: I().trim().optional().or($("")),
|
|
18
|
+
gatewayIds: Ie(I()).optional()
|
|
19
|
+
});
|
|
20
|
+
function Ae(i) {
|
|
21
|
+
const a = be(10), {
|
|
22
|
+
errors: m,
|
|
23
|
+
validateForm: g,
|
|
24
|
+
setFieldError: v,
|
|
25
|
+
validateField: c
|
|
26
|
+
} = we(i);
|
|
27
|
+
let b;
|
|
28
|
+
a[0] === Symbol.for("react.memo_cache_sentinel") ? (b = {}, a[0] = b) : b = a[0];
|
|
29
|
+
const [w, A] = k(b);
|
|
30
|
+
let f;
|
|
31
|
+
a[1] !== m || a[2] !== g ? (f = (r) => g(r) ? (A({}), !0) : (A({
|
|
32
|
+
...m
|
|
33
|
+
}), !1), a[1] = m, a[2] = g, a[3] = f) : f = a[3];
|
|
34
|
+
const E = f;
|
|
35
|
+
let p;
|
|
36
|
+
return a[4] !== m || a[5] !== E || a[6] !== w || a[7] !== v || a[8] !== c ? (p = {
|
|
37
|
+
errors: m,
|
|
38
|
+
setFieldError: v,
|
|
39
|
+
validateField: c,
|
|
40
|
+
lastSubmittedValidationErrors: w,
|
|
41
|
+
guardSubmit: E
|
|
42
|
+
}, a[4] = m, a[5] = E, a[6] = w, a[7] = v, a[8] = c, a[9] = p) : p = a[9], p;
|
|
43
|
+
}
|
|
44
|
+
function Le(i) {
|
|
45
|
+
const a = i.toLowerCase().trim().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
46
|
+
return a ? `/${a}` : "";
|
|
47
|
+
}
|
|
48
|
+
const Ue = {
|
|
49
|
+
templateId: "",
|
|
50
|
+
displayName: "",
|
|
51
|
+
version: "v1.0",
|
|
52
|
+
description: "",
|
|
53
|
+
context: "",
|
|
54
|
+
upstreamUrl: "",
|
|
55
|
+
apiKey: "",
|
|
56
|
+
gatewayIds: []
|
|
57
|
+
}, ie = "repeat(auto-fill, minmax(min(100%, 240px), 1fr))", De = ({
|
|
58
|
+
orgId: i,
|
|
59
|
+
templates: a,
|
|
60
|
+
isLoadingTemplates: m,
|
|
61
|
+
missingParamsMessage: g,
|
|
62
|
+
errorMessage: v,
|
|
63
|
+
isSubmitting: c,
|
|
64
|
+
submitLabel: b = "Add provider",
|
|
65
|
+
showAdvancedBasicDetails: w = !0,
|
|
66
|
+
showGuardrails: A = !0,
|
|
67
|
+
showGatewaySelector: f = !0,
|
|
68
|
+
onCancel: E,
|
|
69
|
+
onSubmit: p
|
|
70
|
+
}) => {
|
|
71
|
+
const [r, u] = k(Ue), {
|
|
72
|
+
errors: d,
|
|
73
|
+
setFieldError: h,
|
|
74
|
+
validateField: P,
|
|
75
|
+
lastSubmittedValidationErrors: M,
|
|
76
|
+
guardSubmit: j
|
|
77
|
+
} = Ae(Se), q = B(() => [...a].sort((e, n) => e.name.localeCompare(n.name)), [a]), N = B(() => a.find((e) => e.id === r.templateId) ?? null, [r.templateId, a]), {
|
|
78
|
+
data: X,
|
|
79
|
+
isLoading: W
|
|
80
|
+
} = Ce({
|
|
81
|
+
orgName: i
|
|
82
|
+
}), x = B(() => X?.gateways.filter((e) => e.status === "ACTIVE") ?? [], [X?.gateways]);
|
|
83
|
+
R(() => {
|
|
84
|
+
x.length > 0 && r.gatewayIds?.length === 0 && u({
|
|
85
|
+
...r,
|
|
86
|
+
gatewayIds: [x[0].uuid]
|
|
87
|
+
});
|
|
88
|
+
}, [x]);
|
|
89
|
+
const z = !!N?.hasTemplateUrl, Z = !z, G = !!N?.hasTemplateAuthHeader, [V, D] = k([]), [_, J] = k(!1), [K, ne] = k(!1), oe = L((e) => {
|
|
90
|
+
D((n) => n.some((l) => l.name === e.name && l.version === e.version) ? n : [...n, e]);
|
|
91
|
+
}, []), le = L((e) => {
|
|
92
|
+
D((n) => n.map((l) => l.name === e.name && l.version === e.version ? e : l));
|
|
93
|
+
}, []), de = L((e, n) => {
|
|
94
|
+
D((l) => l.filter((y) => !(y.name === e && y.version === n)));
|
|
95
|
+
}, []);
|
|
96
|
+
R(() => {
|
|
97
|
+
N && u((e) => ({
|
|
98
|
+
...e,
|
|
99
|
+
upstreamUrl: N.endpointUrl ?? ""
|
|
100
|
+
}));
|
|
101
|
+
}, [N]), R(() => {
|
|
102
|
+
const {
|
|
103
|
+
displayName: e,
|
|
104
|
+
context: n
|
|
105
|
+
} = r;
|
|
106
|
+
if (e) {
|
|
107
|
+
const l = Le(e);
|
|
108
|
+
l && (n === "" || l.startsWith(n ?? "")) && (u((y) => ({
|
|
109
|
+
...y,
|
|
110
|
+
context: l
|
|
111
|
+
})), h("context", P("context", l, {
|
|
112
|
+
...r,
|
|
113
|
+
context: l
|
|
114
|
+
})));
|
|
115
|
+
}
|
|
116
|
+
}, [r.displayName]);
|
|
117
|
+
const C = L((e, n) => {
|
|
118
|
+
u((l) => {
|
|
119
|
+
const y = {
|
|
120
|
+
...l,
|
|
121
|
+
[e]: n
|
|
122
|
+
}, pe = P(e, y[e], y);
|
|
123
|
+
return h(e, pe), y;
|
|
124
|
+
});
|
|
125
|
+
}, [h, P]), se = L((e) => {
|
|
126
|
+
J(!1), u((n) => {
|
|
127
|
+
const l = {
|
|
128
|
+
...n,
|
|
129
|
+
templateId: e,
|
|
130
|
+
upstreamUrl: "",
|
|
131
|
+
apiKey: ""
|
|
132
|
+
}, y = P("templateId", e, l);
|
|
133
|
+
return h("templateId", y), h("upstreamUrl", void 0), h("apiKey", void 0), l;
|
|
134
|
+
});
|
|
135
|
+
}, [h, P]), ce = L(() => {
|
|
136
|
+
let e = !1;
|
|
137
|
+
Z && !r.upstreamUrl.trim() && (h("upstreamUrl", "Upstream endpoint is required"), e = !0), G && !r.apiKey?.trim() && (h("apiKey", "API key / credential is required"), e = !0), !e && j(r) && p({
|
|
138
|
+
...r,
|
|
139
|
+
displayName: r.displayName.trim(),
|
|
140
|
+
version: r.version.trim(),
|
|
141
|
+
description: r.description?.trim() ?? "",
|
|
142
|
+
context: r.context?.trim() ?? "",
|
|
143
|
+
upstreamUrl: r.upstreamUrl?.trim() ?? "",
|
|
144
|
+
apiKey: G ? r.apiKey?.trim() ?? "" : "",
|
|
145
|
+
gatewayIds: r.gatewayIds ?? []
|
|
146
|
+
}, V);
|
|
147
|
+
}, [r, j, V, p, G, Z, h]), Q = B(() => {
|
|
148
|
+
const e = Object.entries(M).filter(([, n]) => n);
|
|
149
|
+
return e.length > 0 ? e : null;
|
|
150
|
+
}, [M]);
|
|
151
|
+
return /* @__PURE__ */ s(o.Stack, { spacing: 3, children: [
|
|
152
|
+
g && /* @__PURE__ */ t(U, { color: "error", variant: "body2", children: g }),
|
|
153
|
+
/* @__PURE__ */ s(o.Section, { children: [
|
|
154
|
+
/* @__PURE__ */ t(o.Subheader, { children: "Basic Details" }),
|
|
155
|
+
/* @__PURE__ */ s(o.Stack, { spacing: 2, children: [
|
|
156
|
+
/* @__PURE__ */ s(o.Stack, { direction: {
|
|
157
|
+
xs: "column",
|
|
158
|
+
md: "row"
|
|
159
|
+
}, spacing: 2, useFlexGap: !0, children: [
|
|
160
|
+
/* @__PURE__ */ t(S, { sx: {
|
|
161
|
+
flex: 2
|
|
162
|
+
}, children: /* @__PURE__ */ t(o.ElementWrapper, { label: "Name", name: "displayName", children: /* @__PURE__ */ t(T, { id: "displayName", fullWidth: !0, value: r.displayName, onChange: (e) => C("displayName", e.target.value), placeholder: "Production OpenAI Provider", error: !!d.displayName, helperText: d.displayName }) }) }),
|
|
163
|
+
w && /* @__PURE__ */ t(S, { sx: {
|
|
164
|
+
flex: 1
|
|
165
|
+
}, children: /* @__PURE__ */ t(o.ElementWrapper, { label: "Version", name: "version", children: /* @__PURE__ */ t(T, { id: "version", fullWidth: !0, value: r.version, onChange: (e) => C("version", e.target.value), placeholder: "v1.0", error: !!d.version, helperText: d.version }) }) })
|
|
166
|
+
] }),
|
|
167
|
+
w && /* @__PURE__ */ s(me, { children: [
|
|
168
|
+
/* @__PURE__ */ t(o.ElementWrapper, { label: "Description (optional)", name: "description", children: /* @__PURE__ */ t(T, { id: "description", fullWidth: !0, multiline: !0, rows: 2, value: r.description ?? "", onChange: (e) => C("description", e.target.value), placeholder: "Primary LLM provider for production", error: !!d.description, helperText: d.description }) }),
|
|
169
|
+
/* @__PURE__ */ t(o.ElementWrapper, { label: "Context path (optional)", name: "context", children: /* @__PURE__ */ t(T, { id: "context", fullWidth: !0, value: r.context ?? "", onChange: (e) => C("context", e.target.value), placeholder: "/my-provider", error: !!d.context, helperText: d.context ?? "API context path (must start with /, no trailing slash)" }) })
|
|
170
|
+
] })
|
|
171
|
+
] })
|
|
172
|
+
] }),
|
|
173
|
+
m && /* @__PURE__ */ s(S, { children: [
|
|
174
|
+
/* @__PURE__ */ t(H, { variant: "text", width: 140, height: 20, sx: {
|
|
175
|
+
mb: 1.5
|
|
176
|
+
} }),
|
|
177
|
+
/* @__PURE__ */ t(S, { sx: {
|
|
178
|
+
display: "grid",
|
|
179
|
+
gap: 1.5,
|
|
180
|
+
gridTemplateColumns: ie
|
|
181
|
+
}, children: Array.from({
|
|
182
|
+
length: 8
|
|
183
|
+
}).map((e, n) => /* @__PURE__ */ t(H, { variant: "rounded", height: 72 }, n)) })
|
|
184
|
+
] }),
|
|
185
|
+
/* @__PURE__ */ s(o.Section, { children: [
|
|
186
|
+
/* @__PURE__ */ t(o.Subheader, { children: "Provider Template" }),
|
|
187
|
+
/* @__PURE__ */ s(S, { sx: {
|
|
188
|
+
mt: 1.5,
|
|
189
|
+
display: "grid",
|
|
190
|
+
gap: 1.5,
|
|
191
|
+
gridTemplateColumns: ie
|
|
192
|
+
}, children: [
|
|
193
|
+
q.map((e) => {
|
|
194
|
+
const n = r.templateId === e.id;
|
|
195
|
+
return /* @__PURE__ */ t(o.CardButton, { selected: n, onClick: () => se(e.id), children: /* @__PURE__ */ t(ue, { children: /* @__PURE__ */ s(o.Stack, { direction: "row", spacing: 2, pt: 0.5, alignItems: "center", children: [
|
|
196
|
+
e.image ? /* @__PURE__ */ t(S, { component: "img", src: e.image, alt: e.name, sx: {
|
|
197
|
+
width: 28,
|
|
198
|
+
height: 28,
|
|
199
|
+
objectFit: "contain",
|
|
200
|
+
backgroundColor: "grey.100",
|
|
201
|
+
borderRadius: "20%"
|
|
202
|
+
} }) : /* @__PURE__ */ t(he, { size: 24 }),
|
|
203
|
+
/* @__PURE__ */ s(o.Stack, { spacing: 0.25, children: [
|
|
204
|
+
/* @__PURE__ */ t(U, { variant: "subtitle2", noWrap: !0, children: e.name }),
|
|
205
|
+
e.description && /* @__PURE__ */ t(U, { variant: "caption", color: "text.secondary", noWrap: !0, children: e.description })
|
|
206
|
+
] })
|
|
207
|
+
] }) }) }, e.id);
|
|
208
|
+
}),
|
|
209
|
+
!q.length && !m && /* @__PURE__ */ t(U, { variant: "body2", color: "text.secondary", children: "No provider templates available for this organization." })
|
|
210
|
+
] })
|
|
211
|
+
] }),
|
|
212
|
+
/* @__PURE__ */ t(F, { in: !!r.templateId, children: /* @__PURE__ */ s(o.Section, { children: [
|
|
213
|
+
/* @__PURE__ */ t(o.Subheader, { children: "Runtime Configuration" }),
|
|
214
|
+
/* @__PURE__ */ s(o.Stack, { spacing: 2, children: [
|
|
215
|
+
/* @__PURE__ */ t(o.ElementWrapper, { label: "Endpoint URL", name: "upstreamUrl", children: /* @__PURE__ */ t(
|
|
216
|
+
T,
|
|
217
|
+
{
|
|
218
|
+
id: "upstreamUrl",
|
|
219
|
+
fullWidth: !0,
|
|
220
|
+
value: r.upstreamUrl ?? "",
|
|
221
|
+
onChange: (e) => C("upstreamUrl", e.target.value),
|
|
222
|
+
placeholder: "https://api.openai.com/v1",
|
|
223
|
+
error: !!d.upstreamUrl,
|
|
224
|
+
helperText: d.upstreamUrl,
|
|
225
|
+
slotProps: {
|
|
226
|
+
input: {
|
|
227
|
+
readOnly: z && !_,
|
|
228
|
+
endAdornment: z ? /* @__PURE__ */ t(Y, { position: "end", children: /* @__PURE__ */ t(ee, { title: _ ? "Lock endpoint" : "Unlock to override endpoint", children: /* @__PURE__ */ t(te, { size: "small", onClick: () => J((e) => !e), children: _ ? /* @__PURE__ */ t(ye, { size: 14 }) : /* @__PURE__ */ t(ge, { size: 14 }) }) }) }) : void 0
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
) }),
|
|
233
|
+
/* @__PURE__ */ t(o.ElementWrapper, { label: "API key / Credential", name: "apiKey", children: /* @__PURE__ */ t(T, { id: "apiKey", fullWidth: !0, type: K ? "text" : "password", value: r.apiKey, onChange: (e) => C("apiKey", e.target.value), placeholder: "Enter your API key", error: !!d.apiKey, helperText: d.apiKey, slotProps: {
|
|
234
|
+
input: {
|
|
235
|
+
endAdornment: /* @__PURE__ */ t(Y, { position: "end", children: /* @__PURE__ */ t(ee, { title: K ? "Hide" : "Show", children: /* @__PURE__ */ t(te, { size: "small", edge: "end", "aria-label": K ? "Hide API key" : "Show API key", onClick: () => ne((e) => !e), children: K ? /* @__PURE__ */ t(ve, { size: 16 }) : /* @__PURE__ */ t(fe, { size: 16 }) }) }) })
|
|
236
|
+
}
|
|
237
|
+
} }) })
|
|
238
|
+
] })
|
|
239
|
+
] }) }),
|
|
240
|
+
A && /* @__PURE__ */ t(F, { in: !!r.templateId, children: /* @__PURE__ */ t(Te, { title: "Guardrails", description: "Add safety policies to enforce consistent protections.", addButtonLabel: "Add Guardrail", drawerAddTitle: "Add Guardrail", drawerEditTitle: "Edit Guardrail", drawerAddSubtitle: "Choose a guardrail to configure advanced options.", drawerEditSubtitle: "Update the guardrail configuration.", policyNoun: "guardrail", loadingLabel: "Loading guardrails...", searchPlaceholder: "Search guardrails...", catalogErrorLabel: "Failed to load guardrails.", emptySearchTitle: "No guardrails match your search", emptyCatalogTitle: "No guardrails available", emptyCatalogDescription: "No guardrail policies are available in the catalog.", policies: V, onAdd: oe, onEdit: le, onRemove: de }) }),
|
|
241
|
+
f ? /* @__PURE__ */ t(F, { in: !!r.templateId, children: /* @__PURE__ */ s(o.Section, { children: [
|
|
242
|
+
/* @__PURE__ */ t(o.Subheader, { children: "Deployment Configuration" }),
|
|
243
|
+
/* @__PURE__ */ t(o.ElementWrapper, { label: "Gateway", name: "gatewayIds", children: W ? /* @__PURE__ */ t(H, { variant: "rounded", height: 40 }) : /* @__PURE__ */ t(ae, { multiple: !0, options: x, size: "small", value: x.filter((e) => (r.gatewayIds ?? []).includes(e.uuid)), onChange: (e, n) => {
|
|
244
|
+
C("gatewayIds", n.map((l) => l.uuid));
|
|
245
|
+
}, getOptionLabel: (e) => e.displayName || e.name || e.uuid, renderInput: (e) => /* @__PURE__ */ t(T, { ...e, placeholder: "Select gateway(s)", error: !!d.gatewayIds, helperText: d.gatewayIds }) }) })
|
|
246
|
+
] }) }) : /* @__PURE__ */ s(F, { in: !!r.templateId, children: [
|
|
247
|
+
!W && x.length === 0 && /* @__PURE__ */ t(O, { severity: "warning", children: "No active gateway is configured for this organization. Ask an admin to configure one before creating an LLM provider." }),
|
|
248
|
+
!W && x.length > 1 && /* @__PURE__ */ t(o.ElementWrapper, { label: "Gateway", name: "gatewayIds", children: /* @__PURE__ */ t(ae, { options: x, size: "small", value: x.find((e) => (r.gatewayIds ?? []).includes(e.uuid)) ?? null, onChange: (e, n) => {
|
|
249
|
+
C("gatewayIds", n ? [n.uuid] : []);
|
|
250
|
+
}, getOptionLabel: (e) => e.displayName || e.name || e.uuid, renderInput: (e) => /* @__PURE__ */ t(T, { ...e, placeholder: "Select gateway", error: !!d.gatewayIds, helperText: d.gatewayIds }) }) })
|
|
251
|
+
] }),
|
|
252
|
+
v && /* @__PURE__ */ t(O, { severity: "error", children: /* @__PURE__ */ t(U, { variant: "body2", children: v }) }),
|
|
253
|
+
Q && /* @__PURE__ */ t(O, { severity: "error", children: /* @__PURE__ */ s(U, { variant: "body2", component: "span", children: [
|
|
254
|
+
"Please fix the following:",
|
|
255
|
+
" ",
|
|
256
|
+
Q.map(([, e]) => e).join("; ")
|
|
257
|
+
] }) }),
|
|
258
|
+
/* @__PURE__ */ s(S, { sx: {
|
|
259
|
+
mt: 2,
|
|
260
|
+
display: "flex",
|
|
261
|
+
gap: 1
|
|
262
|
+
}, children: [
|
|
263
|
+
/* @__PURE__ */ t(re, { variant: "outlined", onClick: E, children: "Cancel" }),
|
|
264
|
+
/* @__PURE__ */ t(re, { variant: "contained", onClick: ce, disabled: c || !r.gatewayIds || r.gatewayIds?.length === 0, children: c ? "Creating..." : b })
|
|
265
|
+
] })
|
|
266
|
+
] });
|
|
267
|
+
}, Pe = (i) => i.toLowerCase().trim().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
268
|
+
function _e(i) {
|
|
269
|
+
return i?.map((a) => ({
|
|
270
|
+
id: a.id,
|
|
271
|
+
handle: a.id,
|
|
272
|
+
name: a.name,
|
|
273
|
+
description: a.description,
|
|
274
|
+
image: a.metadata?.logoUrl,
|
|
275
|
+
hasTemplateUrl: !!a.metadata?.endpointUrl,
|
|
276
|
+
endpointUrl: a.metadata?.endpointUrl,
|
|
277
|
+
hasTemplateAuthType: !!a.metadata?.auth?.type,
|
|
278
|
+
hasTemplateAuthHeader: !!a.metadata?.auth?.header,
|
|
279
|
+
authType: a.metadata?.auth?.type,
|
|
280
|
+
authHeader: a.metadata?.auth?.header,
|
|
281
|
+
authValuePrefix: a.metadata?.auth?.valuePrefix
|
|
282
|
+
})) ?? [];
|
|
283
|
+
}
|
|
284
|
+
function Re(i, a, m) {
|
|
285
|
+
const g = i.displayName?.trim() || "", v = Pe(g) || "llm-provider", c = m.find((u) => u.id === i.templateId), b = c?.handle || c?.name || i.templateId, w = a.length > 0 ? a.map((u) => ({
|
|
286
|
+
name: u.name,
|
|
287
|
+
version: u.version,
|
|
288
|
+
paths: [{
|
|
289
|
+
path: "/*",
|
|
290
|
+
methods: ["*"],
|
|
291
|
+
params: u.settings ?? {}
|
|
292
|
+
}]
|
|
293
|
+
})) : void 0, A = i.context?.trim() || "", f = c?.authType ?? "bearer", E = c?.authHeader ?? "Authorization", p = i.apiKey?.trim() ?? "", r = p ? c?.authValuePrefix ? `${c.authValuePrefix}${p}` : f === "bearer" ? `Bearer ${p}` : p : "";
|
|
294
|
+
return {
|
|
295
|
+
id: v,
|
|
296
|
+
name: g || v,
|
|
297
|
+
version: i.version.trim(),
|
|
298
|
+
context: A,
|
|
299
|
+
template: b,
|
|
300
|
+
upstream: {
|
|
301
|
+
main: {
|
|
302
|
+
url: i.upstreamUrl?.trim(),
|
|
303
|
+
auth: i.apiKey ? {
|
|
304
|
+
type: f,
|
|
305
|
+
header: E,
|
|
306
|
+
value: r
|
|
307
|
+
} : void 0
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
description: i.description?.trim() || void 0,
|
|
311
|
+
security: i.apiKey ? {
|
|
312
|
+
enabled: !0,
|
|
313
|
+
apiKey: {
|
|
314
|
+
enabled: !0,
|
|
315
|
+
key: "X-API-Key",
|
|
316
|
+
in: "header"
|
|
317
|
+
}
|
|
318
|
+
} : void 0,
|
|
319
|
+
policies: w,
|
|
320
|
+
gateways: i.gatewayIds && i.gatewayIds.length > 0 ? i.gatewayIds : void 0,
|
|
321
|
+
accessControl: {
|
|
322
|
+
exceptions: [],
|
|
323
|
+
mode: "allow_all"
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
export {
|
|
328
|
+
De as A,
|
|
329
|
+
Re as b,
|
|
330
|
+
_e as m,
|
|
331
|
+
Pe as t
|
|
332
|
+
};
|