@burdenoff/microfe-botmanor 2026.1029.1 → 2026.1101.1
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/botlit/pages/PromptStudioPage.js +88 -87
- package/dist/botlit/pages/PromptStudioPage.js.map +1 -1
- package/dist/botlit/pages/PromptTemplateDetailPage.js +288 -275
- package/dist/botlit/pages/PromptTemplateDetailPage.js.map +1 -1
- package/dist/botlit/utils/errors.js +18 -0
- package/dist/botlit/utils/errors.js.map +1 -0
- package/package.json +1 -1
|
@@ -7,31 +7,32 @@ import { Button as a } from "../components/Button.js";
|
|
|
7
7
|
import "../permissions/index.js";
|
|
8
8
|
import { Card as o, CardContent as s, CardDescription as c, CardHeader as l, CardTitle as u } from "../components/Card.js";
|
|
9
9
|
import { Badge as d, StatusBadge as ee } from "../components/Badge.js";
|
|
10
|
-
import { isNative as f, nativeCopyText as
|
|
11
|
-
import { EmptyState as
|
|
12
|
-
import { FormField as
|
|
13
|
-
import { toUnion as
|
|
14
|
-
import { promptTemplateExamples as
|
|
10
|
+
import { isNative as f, nativeCopyText as te, nativeImpact as ne, nativeNotify as p, nativeToast as re } from "../../utils/nativeBridge.js";
|
|
11
|
+
import { EmptyState as ie } from "../components/EmptyState.js";
|
|
12
|
+
import { FormField as m, Input as h, Textarea as g } from "../components/Input.js";
|
|
13
|
+
import { toUnion as _ } from "../utils/unions.js";
|
|
14
|
+
import { promptTemplateExamples as v, promptTemplateVariables as ae, useCreatePromptTemplate as oe, useDeletePromptTemplate as se, usePromptTemplate as ce, useRenderPromptTemplate as le, useUpdatePromptTemplate as ue } from "../hooks/usePromptTemplates.js";
|
|
15
15
|
import "../hooks/index.js";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
16
|
+
import { graphqlErrorMessage as de } from "../utils/errors.js";
|
|
17
|
+
import { useMemo as fe, useState as y } from "react";
|
|
18
|
+
import { PagePurpose as pe } from "@burdenoff/fe-libs/ui";
|
|
19
|
+
import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
20
|
+
import { useParams as me } from "react-router";
|
|
21
|
+
import { ArrowLeft as he, Check as ge, Code as C, Copy as _e, Edit3 as ve, Eye as w, FileText as T, Play as E, Save as D, Settings as ye, Trash2 as O, Variable as k } from "lucide-react";
|
|
22
|
+
import { toast as A } from "sonner";
|
|
22
23
|
//#region src/botlit/pages/PromptTemplateDetailPage.tsx
|
|
23
|
-
var
|
|
24
|
+
var j = [
|
|
24
25
|
"string",
|
|
25
26
|
"number",
|
|
26
27
|
"boolean",
|
|
27
28
|
"array",
|
|
28
29
|
"object"
|
|
29
|
-
],
|
|
30
|
+
], be = [
|
|
30
31
|
"PRIVATE",
|
|
31
32
|
"WORKSPACE",
|
|
32
33
|
"PUBLIC"
|
|
33
|
-
],
|
|
34
|
-
let { templateId:
|
|
34
|
+
], M = ({ isNew: M }) => {
|
|
35
|
+
let { templateId: xe } = me(), { navigateTo: N } = e(), { data: P, loading: Se } = ce(M ? void 0 : xe), { create: Ce, loading: we } = oe(), { update: Te, loading: Ee } = ue(), { remove: De, loading: Oe } = se(), { render: ke, loading: Ae } = le(), [F, I] = y("edit"), [L, R] = y(!1), [z, je] = y({}), [B, V] = y(null), [H, U] = y(null), [W, G] = y(!1), [Me, K] = y(!1), [q, J] = y({
|
|
35
36
|
name: "",
|
|
36
37
|
slug: "",
|
|
37
38
|
description: "",
|
|
@@ -39,18 +40,18 @@ var N = [
|
|
|
39
40
|
templateText: "",
|
|
40
41
|
variables: [],
|
|
41
42
|
exampleInputs: [{}]
|
|
42
|
-
}), Y =
|
|
43
|
-
let e =
|
|
43
|
+
}), Y = fe(() => {
|
|
44
|
+
let e = M ? q.templateText : P?.templateText || "", t = /\{\{(\w+)\}\}/g, n = /* @__PURE__ */ new Set(), r;
|
|
44
45
|
for (; (r = t.exec(e)) !== null;) n.add(r[1]);
|
|
45
46
|
return Array.from(n);
|
|
46
47
|
}, [
|
|
47
|
-
|
|
48
|
+
M,
|
|
48
49
|
q.templateText,
|
|
49
|
-
|
|
50
|
-
]),
|
|
50
|
+
P?.templateText
|
|
51
|
+
]), Ne = async () => {
|
|
51
52
|
if (!(!q.name || !q.slug)) {
|
|
52
53
|
try {
|
|
53
|
-
await
|
|
54
|
+
await Ce({
|
|
54
55
|
name: q.name,
|
|
55
56
|
slug: q.slug,
|
|
56
57
|
description: q.description,
|
|
@@ -60,12 +61,12 @@ var N = [
|
|
|
60
61
|
exampleInputs: q.exampleInputs
|
|
61
62
|
});
|
|
62
63
|
} catch (e) {
|
|
63
|
-
|
|
64
|
+
A.error(e instanceof Error ? e.message : "Failed to create prompt template");
|
|
64
65
|
return;
|
|
65
66
|
}
|
|
66
|
-
|
|
67
|
+
A.success(`Template "${q.name}" created`), N("prompt-templates");
|
|
67
68
|
}
|
|
68
|
-
},
|
|
69
|
+
}, Pe = () => {
|
|
69
70
|
J({
|
|
70
71
|
...q,
|
|
71
72
|
variables: [...q.variables, {
|
|
@@ -84,33 +85,41 @@ var N = [
|
|
|
84
85
|
...q,
|
|
85
86
|
variables: n
|
|
86
87
|
});
|
|
87
|
-
},
|
|
88
|
+
}, Fe = (e) => {
|
|
88
89
|
J({
|
|
89
90
|
...q,
|
|
90
91
|
variables: q.variables.filter((t, n) => n !== e)
|
|
91
92
|
});
|
|
92
|
-
}, Ne = async () => {
|
|
93
|
-
I && Oe(await Te({
|
|
94
|
-
templateId: I.id,
|
|
95
|
-
variables: H
|
|
96
|
-
}));
|
|
97
|
-
}, Pe = async () => {
|
|
98
|
-
await p(I?.templateText || q.templateText), V(!0), f() && ne("Copied"), setTimeout(() => V(!1), 2e3);
|
|
99
|
-
}, Fe = () => {
|
|
100
|
-
I && (J({
|
|
101
|
-
name: I.name,
|
|
102
|
-
slug: I.slug,
|
|
103
|
-
description: I.description || "",
|
|
104
|
-
visibility: v(I.visibility, _e, "PRIVATE"),
|
|
105
|
-
templateText: I.templateText,
|
|
106
|
-
variables: b(I),
|
|
107
|
-
exampleInputs: y(I)
|
|
108
|
-
}), G(!0));
|
|
109
93
|
}, Ie = async () => {
|
|
110
|
-
if (
|
|
94
|
+
if (P) {
|
|
95
|
+
U(null);
|
|
96
|
+
try {
|
|
97
|
+
V(await ke({
|
|
98
|
+
templateId: P.id,
|
|
99
|
+
variables: z
|
|
100
|
+
}));
|
|
101
|
+
} catch (e) {
|
|
102
|
+
let t = de(e, "Failed to render prompt template");
|
|
103
|
+
V(null), U(t), A.error(t);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}, Le = async () => {
|
|
107
|
+
await te(P?.templateText || q.templateText), R(!0), f() && re("Copied"), setTimeout(() => R(!1), 2e3);
|
|
108
|
+
}, Re = () => {
|
|
109
|
+
P && (J({
|
|
110
|
+
name: P.name,
|
|
111
|
+
slug: P.slug,
|
|
112
|
+
description: P.description || "",
|
|
113
|
+
visibility: _(P.visibility, be, "PRIVATE"),
|
|
114
|
+
templateText: P.templateText,
|
|
115
|
+
variables: ae(P),
|
|
116
|
+
exampleInputs: v(P)
|
|
117
|
+
}), G(!0));
|
|
118
|
+
}, ze = async () => {
|
|
119
|
+
if (!(!P || !q.name || !q.slug)) {
|
|
111
120
|
try {
|
|
112
|
-
await
|
|
113
|
-
templateId:
|
|
121
|
+
await Te({
|
|
122
|
+
templateId: P.id,
|
|
114
123
|
input: {
|
|
115
124
|
name: q.name,
|
|
116
125
|
slug: q.slug,
|
|
@@ -122,49 +131,49 @@ var N = [
|
|
|
122
131
|
}
|
|
123
132
|
});
|
|
124
133
|
} catch (e) {
|
|
125
|
-
|
|
134
|
+
A.error(e instanceof Error ? e.message : "Failed to update prompt template");
|
|
126
135
|
return;
|
|
127
136
|
}
|
|
128
|
-
|
|
137
|
+
A.success("Template updated"), G(!1);
|
|
129
138
|
}
|
|
130
|
-
},
|
|
131
|
-
if (
|
|
132
|
-
await
|
|
139
|
+
}, Be = async () => {
|
|
140
|
+
if (P) try {
|
|
141
|
+
await De(P.id), f() && p("success"), N("prompt-templates");
|
|
133
142
|
} catch (e) {
|
|
134
|
-
throw f() &&
|
|
143
|
+
throw f() && p("error"), e;
|
|
135
144
|
}
|
|
136
145
|
}, Z = (e) => e.replace(/\{\{(\w+)\}\}/g, "<span class=\"bg-action-primary-bg/20 text-primary px-1 rounded font-mono\">{{$1}}</span>");
|
|
137
|
-
if (
|
|
146
|
+
if (M) return /* @__PURE__ */ x(i, {
|
|
138
147
|
title: "Create Prompt Template",
|
|
139
148
|
description: "Define a reusable prompt template with variables",
|
|
140
|
-
actions: /* @__PURE__ */
|
|
149
|
+
actions: /* @__PURE__ */ S("div", {
|
|
141
150
|
className: "flex gap-2",
|
|
142
|
-
children: [/* @__PURE__ */
|
|
151
|
+
children: [/* @__PURE__ */ x(a, {
|
|
143
152
|
variant: "outline",
|
|
144
|
-
onClick: () =>
|
|
153
|
+
onClick: () => N("prompt-templates"),
|
|
145
154
|
children: "Cancel"
|
|
146
|
-
}), /* @__PURE__ */
|
|
147
|
-
leftIcon: /* @__PURE__ */
|
|
148
|
-
onClick:
|
|
149
|
-
isLoading:
|
|
155
|
+
}), /* @__PURE__ */ x(a, {
|
|
156
|
+
leftIcon: /* @__PURE__ */ x(D, { size: 16 }),
|
|
157
|
+
onClick: Ne,
|
|
158
|
+
isLoading: we,
|
|
150
159
|
disabled: !q.name || !q.slug,
|
|
151
160
|
children: "Create Template"
|
|
152
161
|
})]
|
|
153
162
|
}),
|
|
154
|
-
children: /* @__PURE__ */
|
|
163
|
+
children: /* @__PURE__ */ S("div", {
|
|
155
164
|
className: "grid grid-cols-1 lg:grid-cols-3 gap-6",
|
|
156
|
-
children: [/* @__PURE__ */
|
|
165
|
+
children: [/* @__PURE__ */ S("div", {
|
|
157
166
|
className: "lg:col-span-2 space-y-6",
|
|
158
167
|
children: [
|
|
159
|
-
/* @__PURE__ */
|
|
168
|
+
/* @__PURE__ */ S(o, { children: [/* @__PURE__ */ x(l, { children: /* @__PURE__ */ x(u, { children: "Basic Information" }) }), /* @__PURE__ */ S(s, {
|
|
160
169
|
className: "space-y-4",
|
|
161
170
|
children: [
|
|
162
|
-
/* @__PURE__ */
|
|
171
|
+
/* @__PURE__ */ S("div", {
|
|
163
172
|
className: "grid grid-cols-2 gap-4",
|
|
164
|
-
children: [/* @__PURE__ */
|
|
173
|
+
children: [/* @__PURE__ */ x(m, {
|
|
165
174
|
label: "Template Name",
|
|
166
175
|
required: !0,
|
|
167
|
-
children: /* @__PURE__ */
|
|
176
|
+
children: /* @__PURE__ */ x(h, {
|
|
168
177
|
placeholder: "e.g., Technical Support Template",
|
|
169
178
|
value: q.name,
|
|
170
179
|
onChange: (e) => J({
|
|
@@ -172,11 +181,11 @@ var N = [
|
|
|
172
181
|
name: e.target.value
|
|
173
182
|
})
|
|
174
183
|
})
|
|
175
|
-
}), /* @__PURE__ */
|
|
184
|
+
}), /* @__PURE__ */ x(m, {
|
|
176
185
|
label: "Slug",
|
|
177
186
|
required: !0,
|
|
178
187
|
description: "Unique identifier (lowercase, dashes)",
|
|
179
|
-
children: /* @__PURE__ */
|
|
188
|
+
children: /* @__PURE__ */ x(h, {
|
|
180
189
|
placeholder: "e.g., technical-support",
|
|
181
190
|
value: q.slug,
|
|
182
191
|
onChange: (e) => J({
|
|
@@ -186,9 +195,9 @@ var N = [
|
|
|
186
195
|
})
|
|
187
196
|
})]
|
|
188
197
|
}),
|
|
189
|
-
/* @__PURE__ */
|
|
198
|
+
/* @__PURE__ */ x(m, {
|
|
190
199
|
label: "Description",
|
|
191
|
-
children: /* @__PURE__ */
|
|
200
|
+
children: /* @__PURE__ */ x(g, {
|
|
192
201
|
placeholder: "What is this template used for?",
|
|
193
202
|
value: q.description,
|
|
194
203
|
onChange: (e) => J({
|
|
@@ -198,9 +207,9 @@ var N = [
|
|
|
198
207
|
rows: 2
|
|
199
208
|
})
|
|
200
209
|
}),
|
|
201
|
-
/* @__PURE__ */
|
|
210
|
+
/* @__PURE__ */ x(m, {
|
|
202
211
|
label: "Visibility",
|
|
203
|
-
children: /* @__PURE__ */
|
|
212
|
+
children: /* @__PURE__ */ S("select", {
|
|
204
213
|
className: "flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm",
|
|
205
214
|
value: q.visibility,
|
|
206
215
|
onChange: (e) => J({
|
|
@@ -208,15 +217,15 @@ var N = [
|
|
|
208
217
|
visibility: e.target.value
|
|
209
218
|
}),
|
|
210
219
|
children: [
|
|
211
|
-
/* @__PURE__ */
|
|
220
|
+
/* @__PURE__ */ x("option", {
|
|
212
221
|
value: "PRIVATE",
|
|
213
222
|
children: "Private"
|
|
214
223
|
}),
|
|
215
|
-
/* @__PURE__ */
|
|
224
|
+
/* @__PURE__ */ x("option", {
|
|
216
225
|
value: "WORKSPACE",
|
|
217
226
|
children: "Workspace"
|
|
218
227
|
}),
|
|
219
|
-
/* @__PURE__ */
|
|
228
|
+
/* @__PURE__ */ x("option", {
|
|
220
229
|
value: "PUBLIC",
|
|
221
230
|
children: "Public"
|
|
222
231
|
})
|
|
@@ -225,14 +234,14 @@ var N = [
|
|
|
225
234
|
})
|
|
226
235
|
]
|
|
227
236
|
})] }),
|
|
228
|
-
/* @__PURE__ */
|
|
237
|
+
/* @__PURE__ */ S(o, { children: [/* @__PURE__ */ S(l, { children: [/* @__PURE__ */ S(u, {
|
|
229
238
|
className: "flex items-center gap-2",
|
|
230
|
-
children: [/* @__PURE__ */ C
|
|
231
|
-
}), /* @__PURE__ */
|
|
239
|
+
children: [/* @__PURE__ */ x(C, { size: 18 }), "Template Content"]
|
|
240
|
+
}), /* @__PURE__ */ S(c, { children: [
|
|
232
241
|
"Use ",
|
|
233
242
|
"{{variable_name}}",
|
|
234
243
|
" syntax for variables"
|
|
235
|
-
] })] }), /* @__PURE__ */
|
|
244
|
+
] })] }), /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ x(g, {
|
|
236
245
|
className: "font-mono text-sm min-h-[300px]",
|
|
237
246
|
placeholder: "You are a helpful assistant for {{company_name}}.\n\nYour role is to help users with {{task_type}}.\n\nGuidelines:\n- Be helpful and friendly\n- Provide accurate information\n- Reference: {{docs_url}}",
|
|
238
247
|
value: q.templateText,
|
|
@@ -240,101 +249,101 @@ var N = [
|
|
|
240
249
|
...q,
|
|
241
250
|
templateText: e.target.value
|
|
242
251
|
})
|
|
243
|
-
}), Y.length > 0 && /* @__PURE__ */
|
|
252
|
+
}), Y.length > 0 && /* @__PURE__ */ S("div", {
|
|
244
253
|
className: "mt-3 flex items-center gap-2",
|
|
245
|
-
children: [/* @__PURE__ */
|
|
254
|
+
children: [/* @__PURE__ */ x("span", {
|
|
246
255
|
className: "text-sm text-text-secondary",
|
|
247
256
|
children: "Detected variables:"
|
|
248
|
-
}), Y.map((e) => /* @__PURE__ */
|
|
257
|
+
}), Y.map((e) => /* @__PURE__ */ x(d, {
|
|
249
258
|
variant: "secondary",
|
|
250
259
|
className: "font-mono",
|
|
251
260
|
children: e
|
|
252
261
|
}, e))]
|
|
253
262
|
})] })] }),
|
|
254
|
-
/* @__PURE__ */
|
|
263
|
+
/* @__PURE__ */ S(o, { children: [/* @__PURE__ */ S(l, { children: [/* @__PURE__ */ S(u, {
|
|
255
264
|
className: "flex items-center justify-between",
|
|
256
|
-
children: [/* @__PURE__ */
|
|
265
|
+
children: [/* @__PURE__ */ S("span", {
|
|
257
266
|
className: "flex items-center gap-2",
|
|
258
|
-
children: [/* @__PURE__ */
|
|
259
|
-
}), /* @__PURE__ */
|
|
267
|
+
children: [/* @__PURE__ */ x(k, { size: 18 }), "Variables"]
|
|
268
|
+
}), /* @__PURE__ */ x(a, {
|
|
260
269
|
variant: "outline",
|
|
261
270
|
size: "sm",
|
|
262
|
-
onClick:
|
|
271
|
+
onClick: Pe,
|
|
263
272
|
children: "Add Variable"
|
|
264
273
|
})]
|
|
265
|
-
}), /* @__PURE__ */
|
|
274
|
+
}), /* @__PURE__ */ x(c, { children: "Define the variables used in your template" })] }), /* @__PURE__ */ x(s, { children: q.variables.length > 0 ? /* @__PURE__ */ x("div", {
|
|
266
275
|
className: "space-y-4",
|
|
267
|
-
children: q.variables.map((e, t) => /* @__PURE__ */
|
|
276
|
+
children: q.variables.map((e, t) => /* @__PURE__ */ S("div", {
|
|
268
277
|
className: "p-4 border rounded-lg bg-bg-sunken/30 space-y-3",
|
|
269
|
-
children: [/* @__PURE__ */
|
|
278
|
+
children: [/* @__PURE__ */ S("div", {
|
|
270
279
|
className: "grid grid-cols-4 gap-3",
|
|
271
280
|
children: [
|
|
272
|
-
/* @__PURE__ */
|
|
281
|
+
/* @__PURE__ */ x(m, {
|
|
273
282
|
label: "Name",
|
|
274
|
-
children: /* @__PURE__ */
|
|
283
|
+
children: /* @__PURE__ */ x(h, {
|
|
275
284
|
className: "font-mono",
|
|
276
285
|
placeholder: "variable_name",
|
|
277
286
|
value: e.name,
|
|
278
287
|
onChange: (e) => X(t, { name: e.target.value })
|
|
279
288
|
})
|
|
280
289
|
}),
|
|
281
|
-
/* @__PURE__ */
|
|
290
|
+
/* @__PURE__ */ x(m, {
|
|
282
291
|
label: "Type",
|
|
283
|
-
children: /* @__PURE__ */
|
|
292
|
+
children: /* @__PURE__ */ x("select", {
|
|
284
293
|
className: "flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm",
|
|
285
294
|
value: e.type,
|
|
286
|
-
onChange: (e) => X(t, { type:
|
|
287
|
-
children:
|
|
295
|
+
onChange: (e) => X(t, { type: _(e.target.value, j, "string") }),
|
|
296
|
+
children: j.map((e) => /* @__PURE__ */ x("option", {
|
|
288
297
|
value: e,
|
|
289
298
|
children: e
|
|
290
299
|
}, e))
|
|
291
300
|
})
|
|
292
301
|
}),
|
|
293
|
-
/* @__PURE__ */
|
|
302
|
+
/* @__PURE__ */ x(m, {
|
|
294
303
|
label: "Default Value",
|
|
295
|
-
children: /* @__PURE__ */
|
|
304
|
+
children: /* @__PURE__ */ x(h, {
|
|
296
305
|
placeholder: "Optional",
|
|
297
306
|
value: String(e.defaultValue || ""),
|
|
298
307
|
onChange: (e) => X(t, { defaultValue: e.target.value || void 0 })
|
|
299
308
|
})
|
|
300
309
|
}),
|
|
301
|
-
/* @__PURE__ */
|
|
310
|
+
/* @__PURE__ */ S("div", {
|
|
302
311
|
className: "flex items-end gap-2",
|
|
303
|
-
children: [/* @__PURE__ */
|
|
312
|
+
children: [/* @__PURE__ */ S("label", {
|
|
304
313
|
className: "flex items-center gap-2 h-10",
|
|
305
|
-
children: [/* @__PURE__ */
|
|
314
|
+
children: [/* @__PURE__ */ x("input", {
|
|
306
315
|
type: "checkbox",
|
|
307
316
|
checked: e.required,
|
|
308
317
|
onChange: (e) => X(t, { required: e.target.checked }),
|
|
309
318
|
className: "h-4 w-4"
|
|
310
|
-
}), /* @__PURE__ */
|
|
319
|
+
}), /* @__PURE__ */ x("span", {
|
|
311
320
|
className: "text-sm",
|
|
312
321
|
children: "Required"
|
|
313
322
|
})]
|
|
314
|
-
}), /* @__PURE__ */
|
|
323
|
+
}), /* @__PURE__ */ x(a, {
|
|
315
324
|
variant: "ghost",
|
|
316
325
|
size: "sm",
|
|
317
326
|
className: "text-status-error-text",
|
|
318
|
-
onClick: () =>
|
|
327
|
+
onClick: () => Fe(t),
|
|
319
328
|
children: "Remove"
|
|
320
329
|
})]
|
|
321
330
|
})
|
|
322
331
|
]
|
|
323
|
-
}), /* @__PURE__ */
|
|
332
|
+
}), /* @__PURE__ */ x(m, {
|
|
324
333
|
label: "Description",
|
|
325
|
-
children: /* @__PURE__ */
|
|
334
|
+
children: /* @__PURE__ */ x(h, {
|
|
326
335
|
placeholder: "What is this variable for?",
|
|
327
336
|
value: e.description || "",
|
|
328
337
|
onChange: (e) => X(t, { description: e.target.value })
|
|
329
338
|
})
|
|
330
339
|
})]
|
|
331
340
|
}, t))
|
|
332
|
-
}) : /* @__PURE__ */
|
|
341
|
+
}) : /* @__PURE__ */ S("div", {
|
|
333
342
|
className: "text-center py-8 text-text-secondary",
|
|
334
343
|
children: [
|
|
335
|
-
/* @__PURE__ */
|
|
336
|
-
/* @__PURE__ */
|
|
337
|
-
/* @__PURE__ */
|
|
344
|
+
/* @__PURE__ */ x(k, { className: "h-8 w-8 mx-auto mb-2 opacity-50" }),
|
|
345
|
+
/* @__PURE__ */ x("p", { children: "No variables defined yet" }),
|
|
346
|
+
/* @__PURE__ */ S("p", {
|
|
338
347
|
className: "text-sm",
|
|
339
348
|
children: [
|
|
340
349
|
"Variables are automatically detected from ",
|
|
@@ -345,31 +354,31 @@ var N = [
|
|
|
345
354
|
]
|
|
346
355
|
}) })] })
|
|
347
356
|
]
|
|
348
|
-
}), /* @__PURE__ */
|
|
357
|
+
}), /* @__PURE__ */ S("div", {
|
|
349
358
|
className: "space-y-6",
|
|
350
|
-
children: [/* @__PURE__ */
|
|
359
|
+
children: [/* @__PURE__ */ S(o, { children: [/* @__PURE__ */ x(l, { children: /* @__PURE__ */ S(u, {
|
|
351
360
|
className: "flex items-center gap-2",
|
|
352
|
-
children: [/* @__PURE__ */
|
|
353
|
-
}) }), /* @__PURE__ */
|
|
361
|
+
children: [/* @__PURE__ */ x(w, { size: 18 }), "Preview"]
|
|
362
|
+
}) }), /* @__PURE__ */ x(s, { children: /* @__PURE__ */ x("div", {
|
|
354
363
|
className: "p-4 bg-bg-sunken rounded-lg text-sm whitespace-pre-wrap font-mono",
|
|
355
364
|
dangerouslySetInnerHTML: { __html: Z(q.templateText || "Enter template text...") }
|
|
356
|
-
}) })] }), /* @__PURE__ */
|
|
365
|
+
}) })] }), /* @__PURE__ */ S(o, { children: [/* @__PURE__ */ x(l, { children: /* @__PURE__ */ x(u, { children: "Quick Tips" }) }), /* @__PURE__ */ S(s, {
|
|
357
366
|
className: "text-sm space-y-2",
|
|
358
367
|
children: [
|
|
359
|
-
/* @__PURE__ */
|
|
360
|
-
/* @__PURE__ */
|
|
368
|
+
/* @__PURE__ */ S("p", { children: [
|
|
369
|
+
/* @__PURE__ */ x("strong", { children: "Variables:" }),
|
|
361
370
|
" Use ",
|
|
362
371
|
"{{name}}",
|
|
363
372
|
" syntax"
|
|
364
373
|
] }),
|
|
365
|
-
/* @__PURE__ */
|
|
366
|
-
/* @__PURE__ */
|
|
374
|
+
/* @__PURE__ */ x("p", { children: /* @__PURE__ */ x("strong", { children: "Best Practices:" }) }),
|
|
375
|
+
/* @__PURE__ */ S("ul", {
|
|
367
376
|
className: "list-disc list-inside text-text-secondary space-y-1",
|
|
368
377
|
children: [
|
|
369
|
-
/* @__PURE__ */
|
|
370
|
-
/* @__PURE__ */
|
|
371
|
-
/* @__PURE__ */
|
|
372
|
-
/* @__PURE__ */
|
|
378
|
+
/* @__PURE__ */ x("li", { children: "Use descriptive variable names" }),
|
|
379
|
+
/* @__PURE__ */ x("li", { children: "Provide default values when possible" }),
|
|
380
|
+
/* @__PURE__ */ x("li", { children: "Include example inputs for testing" }),
|
|
381
|
+
/* @__PURE__ */ x("li", { children: "Version your templates for changes" })
|
|
373
382
|
]
|
|
374
383
|
})
|
|
375
384
|
]
|
|
@@ -377,126 +386,126 @@ var N = [
|
|
|
377
386
|
})]
|
|
378
387
|
})
|
|
379
388
|
});
|
|
380
|
-
if (
|
|
389
|
+
if (Se) return /* @__PURE__ */ x(i, {
|
|
381
390
|
title: "Loading...",
|
|
382
|
-
children: /* @__PURE__ */
|
|
391
|
+
children: /* @__PURE__ */ x("div", { className: "h-96 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg" })
|
|
383
392
|
});
|
|
384
|
-
if (!
|
|
393
|
+
if (!P) return /* @__PURE__ */ x(i, {
|
|
385
394
|
title: "Template Not Found",
|
|
386
|
-
children: /* @__PURE__ */
|
|
395
|
+
children: /* @__PURE__ */ x(ie, {
|
|
387
396
|
illustration: "empty-files",
|
|
388
397
|
title: "Template Not Found",
|
|
389
398
|
description: "This prompt template doesn't exist.",
|
|
390
|
-
action: /* @__PURE__ */
|
|
391
|
-
onClick: () =>
|
|
399
|
+
action: /* @__PURE__ */ x(a, {
|
|
400
|
+
onClick: () => N("prompt-templates"),
|
|
392
401
|
children: "Back to Templates"
|
|
393
402
|
})
|
|
394
403
|
})
|
|
395
404
|
});
|
|
396
|
-
let Q =
|
|
397
|
-
return /* @__PURE__ */
|
|
398
|
-
title: /* @__PURE__ */
|
|
405
|
+
let Q = ae(P), $ = v(P);
|
|
406
|
+
return /* @__PURE__ */ x(i, {
|
|
407
|
+
title: /* @__PURE__ */ S("div", {
|
|
399
408
|
className: "flex items-center gap-3",
|
|
400
409
|
children: [
|
|
401
|
-
/* @__PURE__ */
|
|
410
|
+
/* @__PURE__ */ x(a, {
|
|
402
411
|
variant: "ghost",
|
|
403
412
|
size: "icon",
|
|
404
|
-
onClick: () =>
|
|
405
|
-
children: /* @__PURE__ */
|
|
413
|
+
onClick: () => N("prompt-templates"),
|
|
414
|
+
children: /* @__PURE__ */ x(he, { size: 20 })
|
|
406
415
|
}),
|
|
407
|
-
/* @__PURE__ */
|
|
416
|
+
/* @__PURE__ */ x("div", {
|
|
408
417
|
className: "p-2 rounded-lg bg-action-primary-bg/10",
|
|
409
|
-
children: /* @__PURE__ */
|
|
418
|
+
children: /* @__PURE__ */ x(T, { className: "h-6 w-6 text-primary" })
|
|
410
419
|
}),
|
|
411
|
-
/* @__PURE__ */
|
|
420
|
+
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ S("div", {
|
|
412
421
|
className: "flex items-center gap-2",
|
|
413
422
|
children: [
|
|
414
|
-
/* @__PURE__ */
|
|
415
|
-
/* @__PURE__ */
|
|
416
|
-
/* @__PURE__ */
|
|
423
|
+
/* @__PURE__ */ x("span", { children: P.name }),
|
|
424
|
+
/* @__PURE__ */ x(ee, { status: P.status }),
|
|
425
|
+
/* @__PURE__ */ S(d, {
|
|
417
426
|
variant: "secondary",
|
|
418
427
|
className: "font-mono",
|
|
419
|
-
children: ["v",
|
|
428
|
+
children: ["v", P.version]
|
|
420
429
|
})
|
|
421
430
|
]
|
|
422
|
-
}), /* @__PURE__ */
|
|
431
|
+
}), /* @__PURE__ */ S("p", {
|
|
423
432
|
className: "text-sm font-normal text-text-secondary",
|
|
424
433
|
children: [
|
|
425
|
-
|
|
434
|
+
P.slug,
|
|
426
435
|
" - ",
|
|
427
|
-
|
|
436
|
+
P.description
|
|
428
437
|
]
|
|
429
438
|
})] })
|
|
430
439
|
]
|
|
431
440
|
}),
|
|
432
|
-
actions: /* @__PURE__ */
|
|
441
|
+
actions: /* @__PURE__ */ S("div", {
|
|
433
442
|
className: "flex gap-2",
|
|
434
|
-
children: [/* @__PURE__ */
|
|
443
|
+
children: [/* @__PURE__ */ x(a, {
|
|
435
444
|
variant: "outline",
|
|
436
|
-
leftIcon:
|
|
437
|
-
onClick:
|
|
438
|
-
children:
|
|
439
|
-
}), W ? /* @__PURE__ */
|
|
445
|
+
leftIcon: x(L ? ge : _e, { size: 16 }),
|
|
446
|
+
onClick: Le,
|
|
447
|
+
children: L ? "Copied!" : "Copy"
|
|
448
|
+
}), W ? /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(a, {
|
|
440
449
|
variant: "outline",
|
|
441
450
|
onClick: () => G(!1),
|
|
442
451
|
children: "Cancel"
|
|
443
|
-
}), /* @__PURE__ */
|
|
444
|
-
leftIcon: /* @__PURE__ */
|
|
445
|
-
onClick:
|
|
446
|
-
isLoading:
|
|
452
|
+
}), /* @__PURE__ */ x(a, {
|
|
453
|
+
leftIcon: /* @__PURE__ */ x(D, { size: 16 }),
|
|
454
|
+
onClick: ze,
|
|
455
|
+
isLoading: Ee,
|
|
447
456
|
disabled: !q.name || !q.slug,
|
|
448
457
|
children: "Save Changes"
|
|
449
|
-
})] }) :
|
|
458
|
+
})] }) : Me ? /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(a, {
|
|
450
459
|
variant: "outline",
|
|
451
460
|
onClick: () => K(!1),
|
|
452
461
|
children: "Cancel"
|
|
453
|
-
}), /* @__PURE__ */
|
|
462
|
+
}), /* @__PURE__ */ x(a, {
|
|
454
463
|
variant: "destructive",
|
|
455
|
-
leftIcon: /* @__PURE__ */
|
|
464
|
+
leftIcon: /* @__PURE__ */ x(O, { size: 16 }),
|
|
456
465
|
onClick: () => {
|
|
457
|
-
|
|
466
|
+
ne("medium"), Be();
|
|
458
467
|
},
|
|
459
|
-
isLoading:
|
|
468
|
+
isLoading: Oe,
|
|
460
469
|
children: "Confirm Delete"
|
|
461
|
-
})] }) : /* @__PURE__ */
|
|
470
|
+
})] }) : /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(r, {
|
|
462
471
|
permission: n.PROMPT_TEMPLATE_UPDATE,
|
|
463
|
-
children: /* @__PURE__ */
|
|
472
|
+
children: /* @__PURE__ */ x(a, {
|
|
464
473
|
variant: "outline",
|
|
465
|
-
leftIcon: /* @__PURE__ */
|
|
466
|
-
onClick:
|
|
474
|
+
leftIcon: /* @__PURE__ */ x(ve, { size: 16 }),
|
|
475
|
+
onClick: Re,
|
|
467
476
|
children: "Edit Template"
|
|
468
477
|
})
|
|
469
|
-
}), /* @__PURE__ */
|
|
478
|
+
}), /* @__PURE__ */ x(r, {
|
|
470
479
|
permission: n.PROMPT_TEMPLATE_DELETE,
|
|
471
|
-
children: /* @__PURE__ */
|
|
480
|
+
children: /* @__PURE__ */ x(a, {
|
|
472
481
|
variant: "outline",
|
|
473
|
-
leftIcon: /* @__PURE__ */
|
|
482
|
+
leftIcon: /* @__PURE__ */ x(O, { size: 16 }),
|
|
474
483
|
onClick: () => K(!0),
|
|
475
484
|
children: "Delete"
|
|
476
485
|
})
|
|
477
486
|
})] })]
|
|
478
487
|
}),
|
|
479
|
-
children: /* @__PURE__ */
|
|
488
|
+
children: /* @__PURE__ */ S("div", {
|
|
480
489
|
className: "space-y-6",
|
|
481
490
|
children: [
|
|
482
|
-
/* @__PURE__ */
|
|
483
|
-
icon: /* @__PURE__ */
|
|
491
|
+
/* @__PURE__ */ S(pe, {
|
|
492
|
+
icon: /* @__PURE__ */ x(T, { size: 18 }),
|
|
484
493
|
children: [
|
|
485
494
|
"This is a single reusable prompt template — its content with",
|
|
486
495
|
" ",
|
|
487
|
-
/* @__PURE__ */
|
|
496
|
+
/* @__PURE__ */ x("code", { children: "{{variables}}" }),
|
|
488
497
|
", its declared variables and example inputs, and its version history. Edit and preview it here to perfect the instructions, then reuse it across agents so they share consistent, version-controlled behaviour."
|
|
489
498
|
]
|
|
490
499
|
}),
|
|
491
|
-
W && /* @__PURE__ */
|
|
500
|
+
W && /* @__PURE__ */ S(o, { children: [/* @__PURE__ */ S(l, { children: [/* @__PURE__ */ x(u, { children: "Edit Template" }), /* @__PURE__ */ x(c, { children: "Update template details and content" })] }), /* @__PURE__ */ S(s, {
|
|
492
501
|
className: "space-y-4",
|
|
493
502
|
children: [
|
|
494
|
-
/* @__PURE__ */
|
|
503
|
+
/* @__PURE__ */ S("div", {
|
|
495
504
|
className: "grid grid-cols-2 gap-4",
|
|
496
|
-
children: [/* @__PURE__ */
|
|
505
|
+
children: [/* @__PURE__ */ x(m, {
|
|
497
506
|
label: "Template Name",
|
|
498
507
|
required: !0,
|
|
499
|
-
children: /* @__PURE__ */
|
|
508
|
+
children: /* @__PURE__ */ x(h, {
|
|
500
509
|
placeholder: "e.g., Technical Support Template",
|
|
501
510
|
value: q.name,
|
|
502
511
|
onChange: (e) => J({
|
|
@@ -504,11 +513,11 @@ var N = [
|
|
|
504
513
|
name: e.target.value
|
|
505
514
|
})
|
|
506
515
|
})
|
|
507
|
-
}), /* @__PURE__ */
|
|
516
|
+
}), /* @__PURE__ */ x(m, {
|
|
508
517
|
label: "Slug",
|
|
509
518
|
required: !0,
|
|
510
519
|
description: "Unique identifier (lowercase, dashes)",
|
|
511
|
-
children: /* @__PURE__ */
|
|
520
|
+
children: /* @__PURE__ */ x(h, {
|
|
512
521
|
placeholder: "e.g., technical-support",
|
|
513
522
|
value: q.slug,
|
|
514
523
|
onChange: (e) => J({
|
|
@@ -518,9 +527,9 @@ var N = [
|
|
|
518
527
|
})
|
|
519
528
|
})]
|
|
520
529
|
}),
|
|
521
|
-
/* @__PURE__ */
|
|
530
|
+
/* @__PURE__ */ x(m, {
|
|
522
531
|
label: "Description",
|
|
523
|
-
children: /* @__PURE__ */
|
|
532
|
+
children: /* @__PURE__ */ x(g, {
|
|
524
533
|
placeholder: "What is this template used for?",
|
|
525
534
|
value: q.description,
|
|
526
535
|
onChange: (e) => J({
|
|
@@ -530,9 +539,9 @@ var N = [
|
|
|
530
539
|
rows: 2
|
|
531
540
|
})
|
|
532
541
|
}),
|
|
533
|
-
/* @__PURE__ */
|
|
542
|
+
/* @__PURE__ */ x(m, {
|
|
534
543
|
label: "Visibility",
|
|
535
|
-
children: /* @__PURE__ */
|
|
544
|
+
children: /* @__PURE__ */ S("select", {
|
|
536
545
|
className: "flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm",
|
|
537
546
|
value: q.visibility,
|
|
538
547
|
onChange: (e) => J({
|
|
@@ -540,25 +549,25 @@ var N = [
|
|
|
540
549
|
visibility: e.target.value
|
|
541
550
|
}),
|
|
542
551
|
children: [
|
|
543
|
-
/* @__PURE__ */
|
|
552
|
+
/* @__PURE__ */ x("option", {
|
|
544
553
|
value: "PRIVATE",
|
|
545
554
|
children: "Private"
|
|
546
555
|
}),
|
|
547
|
-
/* @__PURE__ */
|
|
556
|
+
/* @__PURE__ */ x("option", {
|
|
548
557
|
value: "WORKSPACE",
|
|
549
558
|
children: "Workspace"
|
|
550
559
|
}),
|
|
551
|
-
/* @__PURE__ */
|
|
560
|
+
/* @__PURE__ */ x("option", {
|
|
552
561
|
value: "PUBLIC",
|
|
553
562
|
children: "Public"
|
|
554
563
|
})
|
|
555
564
|
]
|
|
556
565
|
})
|
|
557
566
|
}),
|
|
558
|
-
/* @__PURE__ */
|
|
567
|
+
/* @__PURE__ */ x(m, {
|
|
559
568
|
label: "Template Content",
|
|
560
569
|
description: "Use {{variable_name}} syntax for variables",
|
|
561
|
-
children: /* @__PURE__ */
|
|
570
|
+
children: /* @__PURE__ */ x(g, {
|
|
562
571
|
className: "font-mono text-sm min-h-[200px]",
|
|
563
572
|
value: q.templateText,
|
|
564
573
|
onChange: (e) => J({
|
|
@@ -567,12 +576,12 @@ var N = [
|
|
|
567
576
|
})
|
|
568
577
|
})
|
|
569
578
|
}),
|
|
570
|
-
Y.length > 0 && /* @__PURE__ */
|
|
579
|
+
Y.length > 0 && /* @__PURE__ */ S("div", {
|
|
571
580
|
className: "flex items-center gap-2",
|
|
572
|
-
children: [/* @__PURE__ */
|
|
581
|
+
children: [/* @__PURE__ */ x("span", {
|
|
573
582
|
className: "text-sm text-text-secondary",
|
|
574
583
|
children: "Detected variables:"
|
|
575
|
-
}), Y.map((e) => /* @__PURE__ */
|
|
584
|
+
}), Y.map((e) => /* @__PURE__ */ x(d, {
|
|
576
585
|
variant: "secondary",
|
|
577
586
|
className: "font-mono",
|
|
578
587
|
children: e
|
|
@@ -580,124 +589,124 @@ var N = [
|
|
|
580
589
|
})
|
|
581
590
|
]
|
|
582
591
|
})] }),
|
|
583
|
-
/* @__PURE__ */
|
|
592
|
+
/* @__PURE__ */ S("div", {
|
|
584
593
|
className: "grid grid-cols-2 md:grid-cols-4 gap-4",
|
|
585
594
|
children: [
|
|
586
|
-
/* @__PURE__ */
|
|
595
|
+
/* @__PURE__ */ x(o, {
|
|
587
596
|
treatment: "glass",
|
|
588
597
|
glow: !0,
|
|
589
|
-
children: /* @__PURE__ */
|
|
598
|
+
children: /* @__PURE__ */ S(s, {
|
|
590
599
|
className: "pt-6 text-center",
|
|
591
|
-
children: [/* @__PURE__ */
|
|
600
|
+
children: [/* @__PURE__ */ x("p", {
|
|
592
601
|
className: "text-3xl font-bold text-text-primary",
|
|
593
602
|
children: Q.length
|
|
594
|
-
}), /* @__PURE__ */
|
|
603
|
+
}), /* @__PURE__ */ x("p", {
|
|
595
604
|
className: "text-sm text-text-secondary",
|
|
596
605
|
children: "Variables"
|
|
597
606
|
})]
|
|
598
607
|
})
|
|
599
608
|
}),
|
|
600
|
-
/* @__PURE__ */
|
|
609
|
+
/* @__PURE__ */ x(o, { children: /* @__PURE__ */ S(s, {
|
|
601
610
|
className: "pt-6 text-center",
|
|
602
|
-
children: [/* @__PURE__ */
|
|
611
|
+
children: [/* @__PURE__ */ x("p", {
|
|
603
612
|
className: "text-3xl font-bold text-text-primary",
|
|
604
613
|
children: $.length
|
|
605
|
-
}), /* @__PURE__ */
|
|
614
|
+
}), /* @__PURE__ */ x("p", {
|
|
606
615
|
className: "text-sm text-text-secondary",
|
|
607
616
|
children: "Examples"
|
|
608
617
|
})]
|
|
609
618
|
}) }),
|
|
610
|
-
/* @__PURE__ */
|
|
619
|
+
/* @__PURE__ */ x(o, { children: /* @__PURE__ */ S(s, {
|
|
611
620
|
className: "pt-6 text-center",
|
|
612
|
-
children: [/* @__PURE__ */
|
|
621
|
+
children: [/* @__PURE__ */ x("p", {
|
|
613
622
|
className: "text-3xl font-bold text-text-primary",
|
|
614
|
-
children:
|
|
615
|
-
}), /* @__PURE__ */
|
|
623
|
+
children: P.revision
|
|
624
|
+
}), /* @__PURE__ */ x("p", {
|
|
616
625
|
className: "text-sm text-text-secondary",
|
|
617
626
|
children: "Revision"
|
|
618
627
|
})]
|
|
619
628
|
}) }),
|
|
620
|
-
/* @__PURE__ */
|
|
629
|
+
/* @__PURE__ */ x(o, { children: /* @__PURE__ */ S(s, {
|
|
621
630
|
className: "pt-6 text-center",
|
|
622
|
-
children: [/* @__PURE__ */
|
|
631
|
+
children: [/* @__PURE__ */ x("p", {
|
|
623
632
|
className: "text-lg font-bold text-text-primary capitalize",
|
|
624
|
-
children:
|
|
625
|
-
}), /* @__PURE__ */
|
|
633
|
+
children: P.visibility.toLowerCase()
|
|
634
|
+
}), /* @__PURE__ */ x("p", {
|
|
626
635
|
className: "text-sm text-text-secondary",
|
|
627
636
|
children: "Visibility"
|
|
628
637
|
})]
|
|
629
638
|
}) })
|
|
630
639
|
]
|
|
631
640
|
}),
|
|
632
|
-
/* @__PURE__ */
|
|
641
|
+
/* @__PURE__ */ S("div", {
|
|
633
642
|
className: "flex gap-2 border-b",
|
|
634
643
|
children: [
|
|
635
|
-
/* @__PURE__ */
|
|
636
|
-
variant:
|
|
637
|
-
onClick: () =>
|
|
638
|
-
children: [/* @__PURE__ */ C
|
|
644
|
+
/* @__PURE__ */ S(a, {
|
|
645
|
+
variant: F === "edit" ? "default" : "ghost",
|
|
646
|
+
onClick: () => I("edit"),
|
|
647
|
+
children: [/* @__PURE__ */ x(C, { className: "h-4 w-4 mr-2" }), "Template"]
|
|
639
648
|
}),
|
|
640
|
-
/* @__PURE__ */
|
|
641
|
-
variant:
|
|
642
|
-
onClick: () =>
|
|
643
|
-
children: [/* @__PURE__ */
|
|
649
|
+
/* @__PURE__ */ S(a, {
|
|
650
|
+
variant: F === "preview" ? "default" : "ghost",
|
|
651
|
+
onClick: () => I("preview"),
|
|
652
|
+
children: [/* @__PURE__ */ x(w, { className: "h-4 w-4 mr-2" }), "Preview"]
|
|
644
653
|
}),
|
|
645
|
-
/* @__PURE__ */
|
|
646
|
-
variant:
|
|
647
|
-
onClick: () =>
|
|
648
|
-
children: [/* @__PURE__ */
|
|
654
|
+
/* @__PURE__ */ S(a, {
|
|
655
|
+
variant: F === "test" ? "default" : "ghost",
|
|
656
|
+
onClick: () => I("test"),
|
|
657
|
+
children: [/* @__PURE__ */ x(E, { className: "h-4 w-4 mr-2" }), "Test"]
|
|
649
658
|
})
|
|
650
659
|
]
|
|
651
660
|
}),
|
|
652
|
-
|
|
661
|
+
F === "edit" && /* @__PURE__ */ S("div", {
|
|
653
662
|
className: "grid grid-cols-1 lg:grid-cols-3 gap-6",
|
|
654
|
-
children: [/* @__PURE__ */
|
|
663
|
+
children: [/* @__PURE__ */ x("div", {
|
|
655
664
|
className: "lg:col-span-2",
|
|
656
|
-
children: /* @__PURE__ */
|
|
665
|
+
children: /* @__PURE__ */ S(o, { children: [/* @__PURE__ */ x(l, { children: /* @__PURE__ */ x(u, { children: "Template Content" }) }), /* @__PURE__ */ x(s, { children: /* @__PURE__ */ x("div", {
|
|
657
666
|
className: "p-4 bg-bg-sunken rounded-lg font-mono text-sm whitespace-pre-wrap",
|
|
658
|
-
children: /* @__PURE__ */
|
|
667
|
+
children: /* @__PURE__ */ x("div", { dangerouslySetInnerHTML: { __html: Z(P.templateText) } })
|
|
659
668
|
}) })] })
|
|
660
|
-
}), /* @__PURE__ */
|
|
669
|
+
}), /* @__PURE__ */ x("div", { children: /* @__PURE__ */ S(o, { children: [/* @__PURE__ */ x(l, { children: /* @__PURE__ */ S(u, {
|
|
661
670
|
className: "flex items-center gap-2",
|
|
662
671
|
children: [
|
|
663
|
-
/* @__PURE__ */
|
|
672
|
+
/* @__PURE__ */ x(k, { size: 18 }),
|
|
664
673
|
"Variables (",
|
|
665
674
|
Q.length,
|
|
666
675
|
")"
|
|
667
676
|
]
|
|
668
|
-
}) }), /* @__PURE__ */
|
|
677
|
+
}) }), /* @__PURE__ */ x(s, { children: Q.length > 0 ? /* @__PURE__ */ x("div", {
|
|
669
678
|
className: "space-y-3",
|
|
670
|
-
children: Q.map((e, t) => /* @__PURE__ */
|
|
679
|
+
children: Q.map((e, t) => /* @__PURE__ */ S("div", {
|
|
671
680
|
className: "p-3 border rounded-lg",
|
|
672
681
|
children: [
|
|
673
|
-
/* @__PURE__ */
|
|
682
|
+
/* @__PURE__ */ S("div", {
|
|
674
683
|
className: "flex items-center justify-between mb-1",
|
|
675
|
-
children: [/* @__PURE__ */
|
|
684
|
+
children: [/* @__PURE__ */ x("span", {
|
|
676
685
|
className: "font-mono font-medium",
|
|
677
686
|
children: e.name
|
|
678
|
-
}), /* @__PURE__ */
|
|
687
|
+
}), /* @__PURE__ */ S("div", {
|
|
679
688
|
className: "flex gap-1",
|
|
680
|
-
children: [/* @__PURE__ */
|
|
689
|
+
children: [/* @__PURE__ */ x(d, {
|
|
681
690
|
variant: "outline",
|
|
682
691
|
className: "text-xs",
|
|
683
692
|
children: e.type
|
|
684
|
-
}), e.required && /* @__PURE__ */
|
|
693
|
+
}), e.required && /* @__PURE__ */ x(d, {
|
|
685
694
|
variant: "destructive",
|
|
686
695
|
className: "text-xs",
|
|
687
696
|
children: "required"
|
|
688
697
|
})]
|
|
689
698
|
})]
|
|
690
699
|
}),
|
|
691
|
-
e.description && /* @__PURE__ */
|
|
700
|
+
e.description && /* @__PURE__ */ x("p", {
|
|
692
701
|
className: "text-sm text-text-secondary",
|
|
693
702
|
children: e.description
|
|
694
703
|
}),
|
|
695
|
-
e.defaultValue !== void 0 && /* @__PURE__ */
|
|
704
|
+
e.defaultValue !== void 0 && /* @__PURE__ */ S("p", {
|
|
696
705
|
className: "text-xs text-text-secondary mt-1",
|
|
697
706
|
children: [
|
|
698
707
|
"Default:",
|
|
699
708
|
" ",
|
|
700
|
-
/* @__PURE__ */
|
|
709
|
+
/* @__PURE__ */ x("code", {
|
|
701
710
|
className: "bg-bg-sunken px-1",
|
|
702
711
|
children: String(e.defaultValue)
|
|
703
712
|
})
|
|
@@ -705,72 +714,76 @@ var N = [
|
|
|
705
714
|
})
|
|
706
715
|
]
|
|
707
716
|
}, t))
|
|
708
|
-
}) : /* @__PURE__ */
|
|
717
|
+
}) : /* @__PURE__ */ x("p", {
|
|
709
718
|
className: "text-text-secondary text-center py-4",
|
|
710
719
|
children: "No variables defined"
|
|
711
720
|
}) })] }) })]
|
|
712
721
|
}),
|
|
713
|
-
|
|
722
|
+
F === "preview" && /* @__PURE__ */ S(o, { children: [/* @__PURE__ */ S(l, { children: [/* @__PURE__ */ x(u, { children: "Rendered Preview" }), /* @__PURE__ */ x(c, { children: "Preview with example inputs (first example set)" })] }), /* @__PURE__ */ x(s, { children: /* @__PURE__ */ x("div", {
|
|
714
723
|
className: "p-4 bg-bg-sunken rounded-lg font-mono text-sm whitespace-pre-wrap",
|
|
715
|
-
children: $[0] ?
|
|
724
|
+
children: $[0] ? P.templateText.replace(/\{\{(\w+)\}\}/g, (e, t) => {
|
|
716
725
|
let n = $[0][t];
|
|
717
726
|
return n === void 0 ? `{{${t}}}` : String(n);
|
|
718
|
-
}) : /* @__PURE__ */
|
|
727
|
+
}) : /* @__PURE__ */ x("span", {
|
|
719
728
|
className: "text-text-secondary",
|
|
720
729
|
children: "No example inputs defined. Add examples to preview rendered output."
|
|
721
730
|
})
|
|
722
731
|
}) })] }),
|
|
723
|
-
|
|
732
|
+
F === "test" && /* @__PURE__ */ S("div", {
|
|
724
733
|
className: "grid grid-cols-1 lg:grid-cols-2 gap-6",
|
|
725
|
-
children: [/* @__PURE__ */
|
|
734
|
+
children: [/* @__PURE__ */ S(o, { children: [/* @__PURE__ */ S(l, { children: [/* @__PURE__ */ x(u, { children: "Test Inputs" }), /* @__PURE__ */ x(c, { children: "Enter values to test the template" })] }), /* @__PURE__ */ S(s, {
|
|
726
735
|
className: "space-y-4",
|
|
727
|
-
children: [Q.map((e) => /* @__PURE__ */
|
|
736
|
+
children: [Q.map((e) => /* @__PURE__ */ S(m, {
|
|
728
737
|
label: e.name,
|
|
729
738
|
required: e.required,
|
|
730
|
-
children: [/* @__PURE__ */
|
|
739
|
+
children: [/* @__PURE__ */ x(h, {
|
|
731
740
|
placeholder: e.defaultValue ? String(e.defaultValue) : `Enter ${e.name}`,
|
|
732
|
-
value:
|
|
733
|
-
onChange: (t) =>
|
|
734
|
-
...
|
|
741
|
+
value: z[e.name] || "",
|
|
742
|
+
onChange: (t) => je({
|
|
743
|
+
...z,
|
|
735
744
|
[e.name]: t.target.value
|
|
736
745
|
})
|
|
737
|
-
}), e.description && /* @__PURE__ */
|
|
746
|
+
}), e.description && /* @__PURE__ */ x("p", {
|
|
738
747
|
className: "text-xs text-text-secondary mt-1",
|
|
739
748
|
children: e.description
|
|
740
749
|
})]
|
|
741
|
-
}, e.name)), /* @__PURE__ */
|
|
750
|
+
}, e.name)), /* @__PURE__ */ x(r, {
|
|
742
751
|
permission: n.PROMPT_TEMPLATE_EXECUTE,
|
|
743
|
-
children: /* @__PURE__ */
|
|
752
|
+
children: /* @__PURE__ */ x(a, {
|
|
744
753
|
className: "w-full",
|
|
745
|
-
leftIcon: /* @__PURE__ */
|
|
746
|
-
onClick:
|
|
747
|
-
isLoading:
|
|
754
|
+
leftIcon: /* @__PURE__ */ x(E, { size: 16 }),
|
|
755
|
+
onClick: Ie,
|
|
756
|
+
isLoading: Ae,
|
|
748
757
|
children: "Render Template"
|
|
749
758
|
})
|
|
750
759
|
})]
|
|
751
|
-
})] }), /* @__PURE__ */
|
|
760
|
+
})] }), /* @__PURE__ */ S(o, { children: [/* @__PURE__ */ x(l, { children: /* @__PURE__ */ x(u, { children: "Output" }) }), /* @__PURE__ */ x(s, { children: H ? /* @__PURE__ */ x("div", {
|
|
761
|
+
role: "alert",
|
|
762
|
+
className: "flex items-start gap-2 rounded-lg border border-status-error-border/40 bg-status-error-bg/10 px-3 py-2 text-sm text-status-error-text",
|
|
763
|
+
children: /* @__PURE__ */ x("p", { children: H })
|
|
764
|
+
}) : B ? /* @__PURE__ */ x("div", {
|
|
752
765
|
className: "p-4 bg-bg-sunken rounded-lg font-mono text-sm whitespace-pre-wrap",
|
|
753
|
-
children:
|
|
754
|
-
}) : /* @__PURE__ */
|
|
766
|
+
children: B
|
|
767
|
+
}) : /* @__PURE__ */ S("div", {
|
|
755
768
|
className: "p-8 text-center text-text-secondary",
|
|
756
|
-
children: [/* @__PURE__ */
|
|
769
|
+
children: [/* @__PURE__ */ x(E, { className: "h-8 w-8 mx-auto mb-2 opacity-50" }), /* @__PURE__ */ x("p", { children: "Enter inputs and click \"Render Template\" to see output" })]
|
|
757
770
|
}) })] })]
|
|
758
771
|
}),
|
|
759
|
-
$.length > 0 &&
|
|
772
|
+
$.length > 0 && F === "edit" && /* @__PURE__ */ S(o, { children: [/* @__PURE__ */ S(l, { children: [/* @__PURE__ */ x(u, { children: "Example Inputs" }), /* @__PURE__ */ x(c, { children: "Pre-defined inputs for testing and documentation" })] }), /* @__PURE__ */ x(s, { children: /* @__PURE__ */ x("div", {
|
|
760
773
|
className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",
|
|
761
|
-
children: $.map((e, t) => /* @__PURE__ */
|
|
774
|
+
children: $.map((e, t) => /* @__PURE__ */ S("div", {
|
|
762
775
|
className: "p-4 border rounded-lg bg-bg-sunken/30",
|
|
763
|
-
children: [/* @__PURE__ */
|
|
776
|
+
children: [/* @__PURE__ */ S("p", {
|
|
764
777
|
className: "text-sm font-medium mb-2",
|
|
765
778
|
children: ["Example ", t + 1]
|
|
766
|
-
}), /* @__PURE__ */
|
|
779
|
+
}), /* @__PURE__ */ x("div", {
|
|
767
780
|
className: "space-y-1 text-sm",
|
|
768
|
-
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */
|
|
781
|
+
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */ S("div", {
|
|
769
782
|
className: "flex justify-between",
|
|
770
|
-
children: [/* @__PURE__ */
|
|
783
|
+
children: [/* @__PURE__ */ S("span", {
|
|
771
784
|
className: "font-mono text-text-secondary",
|
|
772
785
|
children: [e, ":"]
|
|
773
|
-
}), /* @__PURE__ */
|
|
786
|
+
}), /* @__PURE__ */ x("span", {
|
|
774
787
|
className: "font-mono truncate max-w-[60%]",
|
|
775
788
|
children: String(t)
|
|
776
789
|
})]
|
|
@@ -778,36 +791,36 @@ var N = [
|
|
|
778
791
|
})]
|
|
779
792
|
}, t))
|
|
780
793
|
}) })] }),
|
|
781
|
-
/* @__PURE__ */
|
|
794
|
+
/* @__PURE__ */ S(o, { children: [/* @__PURE__ */ x(l, { children: /* @__PURE__ */ S(u, {
|
|
782
795
|
className: "flex items-center gap-2",
|
|
783
|
-
children: [/* @__PURE__ */
|
|
784
|
-
}) }), /* @__PURE__ */
|
|
796
|
+
children: [/* @__PURE__ */ x(ye, { size: 18 }), "Metadata"]
|
|
797
|
+
}) }), /* @__PURE__ */ x(s, { children: /* @__PURE__ */ S("div", {
|
|
785
798
|
className: "grid grid-cols-2 md:grid-cols-4 gap-6 text-sm",
|
|
786
799
|
children: [
|
|
787
|
-
/* @__PURE__ */
|
|
800
|
+
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
|
|
788
801
|
className: "text-text-secondary",
|
|
789
802
|
children: "Created"
|
|
790
|
-
}), /* @__PURE__ */
|
|
803
|
+
}), /* @__PURE__ */ x("p", {
|
|
791
804
|
className: "font-medium",
|
|
792
|
-
children: t(
|
|
805
|
+
children: t(P.createdAt)
|
|
793
806
|
})] }),
|
|
794
|
-
/* @__PURE__ */
|
|
807
|
+
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
|
|
795
808
|
className: "text-text-secondary",
|
|
796
809
|
children: "Updated"
|
|
797
|
-
}), /* @__PURE__ */
|
|
810
|
+
}), /* @__PURE__ */ x("p", {
|
|
798
811
|
className: "font-medium",
|
|
799
|
-
children: t(
|
|
812
|
+
children: t(P.updatedAt)
|
|
800
813
|
})] }),
|
|
801
|
-
/* @__PURE__ */
|
|
814
|
+
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
|
|
802
815
|
className: "text-text-secondary",
|
|
803
816
|
children: "Tags"
|
|
804
|
-
}), /* @__PURE__ */
|
|
817
|
+
}), /* @__PURE__ */ x("div", {
|
|
805
818
|
className: "flex gap-1",
|
|
806
|
-
children:
|
|
819
|
+
children: P.tags.length > 0 ? P.tags.map((e) => /* @__PURE__ */ x(d, {
|
|
807
820
|
variant: "secondary",
|
|
808
821
|
className: "text-xs",
|
|
809
822
|
children: e
|
|
810
|
-
}, e)) : /* @__PURE__ */
|
|
823
|
+
}, e)) : /* @__PURE__ */ x("span", {
|
|
811
824
|
className: "text-text-secondary",
|
|
812
825
|
children: "None"
|
|
813
826
|
})
|
|
@@ -819,6 +832,6 @@ var N = [
|
|
|
819
832
|
});
|
|
820
833
|
};
|
|
821
834
|
//#endregion
|
|
822
|
-
export {
|
|
835
|
+
export { M as PromptTemplateDetailPage };
|
|
823
836
|
|
|
824
837
|
//# sourceMappingURL=PromptTemplateDetailPage.js.map
|