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