@greatapps/greatagents-ui 0.3.23 → 0.3.25
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/index.js +311 -283
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/agents/agent-edit-form.tsx +48 -23
- package/src/components/agents/agent-form-dialog.tsx +5 -3
- package/src/components/agents/agent-objectives-list.tsx +3 -3
- package/src/components/agents/agent-tools-list.tsx +17 -17
- package/src/components/agents/conversation-flow-editor.tsx +41 -42
- package/src/components/tools/tool-form-dialog.tsx +137 -135
package/package.json
CHANGED
|
@@ -100,8 +100,8 @@ export function AgentEditForm({ config, agent, idAccount, open, onOpenChange }:
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
const
|
|
104
|
-
|
|
103
|
+
const formFields = (
|
|
104
|
+
<>
|
|
105
105
|
<div className="flex justify-center">
|
|
106
106
|
<ImageCropUpload
|
|
107
107
|
value={form.photo || null}
|
|
@@ -184,38 +184,63 @@ export function AgentEditForm({ config, agent, idAccount, open, onOpenChange }:
|
|
|
184
184
|
</p>
|
|
185
185
|
</div>
|
|
186
186
|
</div>
|
|
187
|
-
|
|
188
|
-
<SheetFooter>
|
|
189
|
-
<Button
|
|
190
|
-
type="button"
|
|
191
|
-
variant="outline"
|
|
192
|
-
onClick={() => onOpenChange?.(false)}
|
|
193
|
-
disabled={updateAgent.isPending}
|
|
194
|
-
>
|
|
195
|
-
Cancelar
|
|
196
|
-
</Button>
|
|
197
|
-
<Button type="submit" disabled={updateAgent.isPending}>
|
|
198
|
-
{updateAgent.isPending && (
|
|
199
|
-
<Loader2 aria-hidden="true" className="mr-2 h-4 w-4 animate-spin" />
|
|
200
|
-
)}
|
|
201
|
-
Salvar
|
|
202
|
-
</Button>
|
|
203
|
-
</SheetFooter>
|
|
204
|
-
</form>
|
|
187
|
+
</>
|
|
205
188
|
);
|
|
206
189
|
|
|
207
190
|
if (open !== undefined && onOpenChange) {
|
|
208
191
|
return (
|
|
209
192
|
<Sheet open={open} onOpenChange={onOpenChange}>
|
|
210
|
-
<SheetContent className="sm:max-w-md
|
|
193
|
+
<SheetContent className="sm:max-w-md">
|
|
211
194
|
<SheetHeader>
|
|
212
195
|
<SheetTitle>Editar Agente</SheetTitle>
|
|
213
196
|
</SheetHeader>
|
|
214
|
-
{
|
|
197
|
+
<form onSubmit={handleSubmit} className="flex flex-1 flex-col overflow-hidden">
|
|
198
|
+
<div className="flex-1 overflow-y-auto px-4 space-y-4">
|
|
199
|
+
{formFields}
|
|
200
|
+
</div>
|
|
201
|
+
<SheetFooter className="flex-row justify-end border-t">
|
|
202
|
+
<Button
|
|
203
|
+
type="button"
|
|
204
|
+
variant="outline"
|
|
205
|
+
onClick={() => onOpenChange?.(false)}
|
|
206
|
+
disabled={updateAgent.isPending}
|
|
207
|
+
>
|
|
208
|
+
Cancelar
|
|
209
|
+
</Button>
|
|
210
|
+
<Button type="submit" disabled={updateAgent.isPending}>
|
|
211
|
+
{updateAgent.isPending && (
|
|
212
|
+
<Loader2 aria-hidden="true" className="mr-2 h-4 w-4 animate-spin" />
|
|
213
|
+
)}
|
|
214
|
+
Salvar
|
|
215
|
+
</Button>
|
|
216
|
+
</SheetFooter>
|
|
217
|
+
</form>
|
|
215
218
|
</SheetContent>
|
|
216
219
|
</Sheet>
|
|
217
220
|
);
|
|
218
221
|
}
|
|
219
222
|
|
|
220
|
-
return
|
|
223
|
+
return (
|
|
224
|
+
<div className="max-w-lg pt-4">
|
|
225
|
+
<form onSubmit={handleSubmit} className="space-y-4">
|
|
226
|
+
{formFields}
|
|
227
|
+
<div className="flex justify-end gap-2 pt-4 border-t">
|
|
228
|
+
<Button
|
|
229
|
+
type="button"
|
|
230
|
+
variant="outline"
|
|
231
|
+
onClick={() => onOpenChange?.(false)}
|
|
232
|
+
disabled={updateAgent.isPending}
|
|
233
|
+
>
|
|
234
|
+
Cancelar
|
|
235
|
+
</Button>
|
|
236
|
+
<Button type="submit" disabled={updateAgent.isPending}>
|
|
237
|
+
{updateAgent.isPending && (
|
|
238
|
+
<Loader2 aria-hidden="true" className="mr-2 h-4 w-4 animate-spin" />
|
|
239
|
+
)}
|
|
240
|
+
Salvar
|
|
241
|
+
</Button>
|
|
242
|
+
</div>
|
|
243
|
+
</form>
|
|
244
|
+
</div>
|
|
245
|
+
);
|
|
221
246
|
}
|
|
@@ -135,13 +135,14 @@ export function AgentFormDialog({
|
|
|
135
135
|
|
|
136
136
|
return (
|
|
137
137
|
<Sheet open={open} onOpenChange={onOpenChange}>
|
|
138
|
-
<SheetContent className="sm:max-w-
|
|
138
|
+
<SheetContent className="sm:max-w-md">
|
|
139
139
|
<SheetHeader>
|
|
140
140
|
<SheetTitle>
|
|
141
141
|
{isEditing ? "Editar Agente" : "Novo Agente"}
|
|
142
142
|
</SheetTitle>
|
|
143
143
|
</SheetHeader>
|
|
144
|
-
<form onSubmit={handleSubmit} className="
|
|
144
|
+
<form onSubmit={handleSubmit} className="flex flex-1 flex-col overflow-hidden">
|
|
145
|
+
<div className="flex-1 overflow-y-auto px-4 space-y-4">
|
|
145
146
|
<div className="flex justify-center">
|
|
146
147
|
<ImageCropUpload
|
|
147
148
|
value={form.photo || null}
|
|
@@ -224,7 +225,8 @@ export function AgentFormDialog({
|
|
|
224
225
|
</p>
|
|
225
226
|
</div>
|
|
226
227
|
</div>
|
|
227
|
-
|
|
228
|
+
</div>
|
|
229
|
+
<SheetFooter className="flex-row justify-end border-t">
|
|
228
230
|
<Button
|
|
229
231
|
type="button"
|
|
230
232
|
variant="outline"
|
|
@@ -326,13 +326,13 @@ export function AgentObjectivesList({ agent, config }: AgentObjectivesListProps)
|
|
|
326
326
|
|
|
327
327
|
{/* Create/Edit Sheet */}
|
|
328
328
|
<Sheet open={formOpen} onOpenChange={setFormOpen}>
|
|
329
|
-
<SheetContent className="sm:max-w-lg
|
|
329
|
+
<SheetContent className="sm:max-w-lg">
|
|
330
330
|
<SheetHeader>
|
|
331
331
|
<SheetTitle>
|
|
332
332
|
{editTarget ? "Editar Objetivo" : "Novo Objetivo"}
|
|
333
333
|
</SheetTitle>
|
|
334
334
|
</SheetHeader>
|
|
335
|
-
<div className="space-y-4">
|
|
335
|
+
<div className="flex-1 overflow-y-auto px-4 space-y-4">
|
|
336
336
|
<div className="space-y-2">
|
|
337
337
|
<Label htmlFor="objective-title">Título *</Label>
|
|
338
338
|
<Input
|
|
@@ -430,7 +430,7 @@ export function AgentObjectivesList({ agent, config }: AgentObjectivesListProps)
|
|
|
430
430
|
</p>
|
|
431
431
|
</div>
|
|
432
432
|
</div>
|
|
433
|
-
<SheetFooter>
|
|
433
|
+
<SheetFooter className="flex-row justify-end border-t">
|
|
434
434
|
<Button
|
|
435
435
|
variant="outline"
|
|
436
436
|
onClick={() => setFormOpen(false)}
|
|
@@ -27,11 +27,11 @@ import {
|
|
|
27
27
|
PopoverTrigger,
|
|
28
28
|
Input,
|
|
29
29
|
Textarea,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
Sheet,
|
|
31
|
+
SheetContent,
|
|
32
|
+
SheetHeader,
|
|
33
|
+
SheetTitle,
|
|
34
|
+
SheetFooter,
|
|
35
35
|
Label,
|
|
36
36
|
Select,
|
|
37
37
|
SelectContent,
|
|
@@ -291,18 +291,18 @@ export function AgentToolsList({ agent, config }: AgentToolsListProps) {
|
|
|
291
291
|
</div>
|
|
292
292
|
)}
|
|
293
293
|
|
|
294
|
-
{/* Config
|
|
295
|
-
<
|
|
294
|
+
{/* Config sheet for custom_instructions */}
|
|
295
|
+
<Sheet
|
|
296
296
|
open={!!configTarget}
|
|
297
297
|
onOpenChange={(open) => !open && setConfigTarget(null)}
|
|
298
298
|
>
|
|
299
|
-
<
|
|
300
|
-
<
|
|
301
|
-
<
|
|
299
|
+
<SheetContent className="sm:max-w-lg">
|
|
300
|
+
<SheetHeader>
|
|
301
|
+
<SheetTitle>
|
|
302
302
|
Instruções da Ferramenta
|
|
303
|
-
</
|
|
304
|
-
</
|
|
305
|
-
<div className="space-y-4">
|
|
303
|
+
</SheetTitle>
|
|
304
|
+
</SheetHeader>
|
|
305
|
+
<div className="flex-1 overflow-y-auto px-4 space-y-4">
|
|
306
306
|
{configTarget && getToolInfo(configTarget.id_tool)?.type !== "none" && (
|
|
307
307
|
<div className="space-y-2">
|
|
308
308
|
<Label htmlFor="tool-credential">Credencial</Label>
|
|
@@ -344,7 +344,7 @@ export function AgentToolsList({ agent, config }: AgentToolsListProps) {
|
|
|
344
344
|
</p>
|
|
345
345
|
</div>
|
|
346
346
|
</div>
|
|
347
|
-
<
|
|
347
|
+
<SheetFooter className="flex-row justify-end border-t">
|
|
348
348
|
<Button
|
|
349
349
|
variant="outline"
|
|
350
350
|
onClick={() => setConfigTarget(null)}
|
|
@@ -357,9 +357,9 @@ export function AgentToolsList({ agent, config }: AgentToolsListProps) {
|
|
|
357
357
|
>
|
|
358
358
|
Salvar
|
|
359
359
|
</Button>
|
|
360
|
-
</
|
|
361
|
-
</
|
|
362
|
-
</
|
|
360
|
+
</SheetFooter>
|
|
361
|
+
</SheetContent>
|
|
362
|
+
</Sheet>
|
|
363
363
|
|
|
364
364
|
{/* Remove confirmation */}
|
|
365
365
|
<AlertDialog
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useRef, useState } from "react";
|
|
2
2
|
import type { ConversationFlowStep } from "../../types";
|
|
3
|
-
import { Button,
|
|
3
|
+
import { Button, Textarea } from "@greatapps/greatauth-ui/ui";
|
|
4
4
|
import {
|
|
5
5
|
Sortable,
|
|
6
6
|
SortableContent,
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
SortableOverlay,
|
|
10
10
|
} from "../ui/sortable";
|
|
11
11
|
import { GripVertical, Plus, Trash2 } from "lucide-react";
|
|
12
|
-
import { cn } from "../../lib";
|
|
13
12
|
|
|
14
13
|
interface StepWithKey extends ConversationFlowStep {
|
|
15
14
|
_key: number;
|
|
@@ -105,47 +104,47 @@ export function ConversationFlowEditor({
|
|
|
105
104
|
<SortableItem
|
|
106
105
|
key={step._key}
|
|
107
106
|
value={step._key}
|
|
108
|
-
className="flex
|
|
107
|
+
className="flex flex-col gap-2 rounded-lg border bg-card p-3"
|
|
109
108
|
>
|
|
110
|
-
<
|
|
111
|
-
<
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
</
|
|
109
|
+
<div className="flex items-center gap-2">
|
|
110
|
+
<SortableItemHandle className="shrink-0 cursor-grab text-muted-foreground hover:text-foreground">
|
|
111
|
+
<GripVertical aria-hidden="true" className="h-4 w-4" />
|
|
112
|
+
</SortableItemHandle>
|
|
113
|
+
<span className="shrink-0 text-xs font-medium text-muted-foreground tabular-nums">
|
|
114
|
+
{step.order}.
|
|
115
|
+
</span>
|
|
116
|
+
<span className="flex-1 text-sm font-medium truncate">{step.instruction || "Nova etapa"}</span>
|
|
117
|
+
<Button
|
|
118
|
+
type="button"
|
|
119
|
+
variant="ghost"
|
|
120
|
+
size="icon"
|
|
121
|
+
aria-label="Remover etapa"
|
|
122
|
+
className="shrink-0 text-muted-foreground hover:text-destructive"
|
|
123
|
+
onClick={() => handleRemove(step._key)}
|
|
124
|
+
>
|
|
125
|
+
<Trash2 className="h-4 w-4" />
|
|
126
|
+
</Button>
|
|
127
|
+
</div>
|
|
128
|
+
<div className="space-y-2 pl-8">
|
|
129
|
+
<Textarea
|
|
130
|
+
value={step.instruction}
|
|
131
|
+
onChange={(e) =>
|
|
132
|
+
handleFieldChange(step._key, "instruction", e.target.value)
|
|
133
|
+
}
|
|
134
|
+
placeholder="Descreva o que o agente deve fazer nesta etapa..."
|
|
135
|
+
className="min-h-[2.5rem] resize-none"
|
|
136
|
+
rows={2}
|
|
137
|
+
/>
|
|
138
|
+
<Textarea
|
|
139
|
+
value={step.example ?? ""}
|
|
140
|
+
onChange={(e) =>
|
|
141
|
+
handleFieldChange(step._key, "example", e.target.value)
|
|
142
|
+
}
|
|
143
|
+
placeholder="Exemplo de resposta do agente (opcional)"
|
|
144
|
+
className="min-h-[2.5rem] resize-none text-muted-foreground"
|
|
145
|
+
rows={1}
|
|
146
|
+
/>
|
|
147
|
+
</div>
|
|
149
148
|
</SortableItem>
|
|
150
149
|
))}
|
|
151
150
|
</SortableContent>
|
|
@@ -3,11 +3,11 @@ import { useCreateTool, useUpdateTool } from "../../hooks";
|
|
|
3
3
|
import type { Tool } from "../../types";
|
|
4
4
|
import type { GagentsHookConfig } from "../../hooks/types";
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
Sheet,
|
|
7
|
+
SheetContent,
|
|
8
|
+
SheetHeader,
|
|
9
|
+
SheetTitle,
|
|
10
|
+
SheetFooter,
|
|
11
11
|
Button,
|
|
12
12
|
Input,
|
|
13
13
|
Textarea,
|
|
@@ -177,127 +177,128 @@ export function ToolFormDialog({
|
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
return (
|
|
180
|
-
<
|
|
181
|
-
<
|
|
182
|
-
<
|
|
183
|
-
<
|
|
180
|
+
<Sheet open={open} onOpenChange={onOpenChange}>
|
|
181
|
+
<SheetContent className="sm:max-w-lg">
|
|
182
|
+
<SheetHeader>
|
|
183
|
+
<SheetTitle>
|
|
184
184
|
{isEditing ? "Editar Ferramenta" : "Nova Ferramenta"}
|
|
185
|
-
</
|
|
186
|
-
</
|
|
187
|
-
<form onSubmit={handleSubmit} className="
|
|
188
|
-
<div className="space-y-
|
|
189
|
-
<
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
185
|
+
</SheetTitle>
|
|
186
|
+
</SheetHeader>
|
|
187
|
+
<form onSubmit={handleSubmit} className="flex flex-1 flex-col overflow-hidden">
|
|
188
|
+
<div className="flex-1 overflow-y-auto px-4 space-y-4">
|
|
189
|
+
<div className="space-y-2">
|
|
190
|
+
<Label htmlFor="tool-name">Nome *</Label>
|
|
191
|
+
<Input
|
|
192
|
+
id="tool-name"
|
|
193
|
+
name="name"
|
|
194
|
+
value={form.name}
|
|
195
|
+
onChange={(e) => {
|
|
196
|
+
const name = e.target.value;
|
|
197
|
+
setForm((prev) => ({
|
|
198
|
+
...prev,
|
|
199
|
+
name,
|
|
200
|
+
nameError: name.trim() ? false : prev.nameError,
|
|
201
|
+
...(!slugManuallyEdited && !isEditing
|
|
202
|
+
? { slug: slugify(name), slugError: false }
|
|
203
|
+
: {}),
|
|
204
|
+
}));
|
|
205
|
+
}}
|
|
206
|
+
placeholder="Ex: Google Calendar"
|
|
207
|
+
disabled={isPending}
|
|
208
|
+
/>
|
|
209
|
+
{form.nameError && (
|
|
210
|
+
<p className="text-sm text-destructive">Nome é obrigatório</p>
|
|
211
|
+
)}
|
|
212
|
+
</div>
|
|
212
213
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
214
|
+
<div className="space-y-2">
|
|
215
|
+
<Label htmlFor="tool-slug">Slug (identificador único) *</Label>
|
|
216
|
+
<Input
|
|
217
|
+
id="tool-slug"
|
|
218
|
+
name="slug"
|
|
219
|
+
value={form.slug}
|
|
220
|
+
onChange={(e) => {
|
|
221
|
+
setSlugManuallyEdited(true);
|
|
222
|
+
setForm((prev) => ({
|
|
223
|
+
...prev,
|
|
224
|
+
slug: e.target.value,
|
|
225
|
+
slugError: e.target.value.trim() ? false : prev.slugError,
|
|
226
|
+
}));
|
|
227
|
+
}}
|
|
228
|
+
placeholder="Ex: google-calendar"
|
|
229
|
+
disabled={isPending}
|
|
230
|
+
/>
|
|
231
|
+
<p className="text-xs text-muted-foreground">
|
|
232
|
+
Gerado automaticamente a partir do nome. Usado internamente para identificar a ferramenta.
|
|
233
|
+
</p>
|
|
234
|
+
{form.slugError && (
|
|
235
|
+
<p className="text-sm text-destructive">Slug é obrigatório</p>
|
|
236
|
+
)}
|
|
237
|
+
</div>
|
|
237
238
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
239
|
+
<div className="space-y-2">
|
|
240
|
+
<Label htmlFor="tool-type">Tipo de Autenticação *</Label>
|
|
241
|
+
<Select
|
|
242
|
+
value={form.type}
|
|
243
|
+
onValueChange={(value) => {
|
|
244
|
+
setForm((prev) => ({
|
|
245
|
+
...prev,
|
|
246
|
+
type: value,
|
|
247
|
+
typeError: false,
|
|
248
|
+
}));
|
|
249
|
+
}}
|
|
250
|
+
disabled={isPending}
|
|
251
|
+
>
|
|
252
|
+
<SelectTrigger id="tool-type">
|
|
253
|
+
<SelectValue placeholder="Selecione o tipo" />
|
|
254
|
+
</SelectTrigger>
|
|
255
|
+
<SelectContent>
|
|
256
|
+
{TOOL_AUTH_TYPES.map((t) => (
|
|
257
|
+
<SelectItem key={t.value} value={t.value}>
|
|
258
|
+
{t.label}
|
|
259
|
+
</SelectItem>
|
|
260
|
+
))}
|
|
261
|
+
</SelectContent>
|
|
262
|
+
</Select>
|
|
263
|
+
<p className="text-xs text-muted-foreground">
|
|
264
|
+
Define se a ferramenta requer credenciais para funcionar.
|
|
265
|
+
</p>
|
|
266
|
+
{form.typeError && (
|
|
267
|
+
<p className="text-sm text-destructive">Tipo é obrigatório</p>
|
|
268
|
+
)}
|
|
269
|
+
</div>
|
|
269
270
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
271
|
+
<div className="space-y-2">
|
|
272
|
+
<Label htmlFor="tool-description">Descrição</Label>
|
|
273
|
+
<Textarea
|
|
274
|
+
id="tool-description"
|
|
275
|
+
name="description"
|
|
276
|
+
value={form.description}
|
|
277
|
+
onChange={(e) =>
|
|
278
|
+
setForm((prev) => ({ ...prev, description: e.target.value }))
|
|
279
|
+
}
|
|
280
|
+
placeholder="Descri\u00e7\u00e3o da ferramenta\u2026"
|
|
281
|
+
rows={3}
|
|
282
|
+
disabled={isPending}
|
|
283
|
+
/>
|
|
284
|
+
</div>
|
|
284
285
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
286
|
+
<div className="space-y-2">
|
|
287
|
+
<Label htmlFor="tool-function-defs">
|
|
288
|
+
Definições de Função (JSON)
|
|
289
|
+
</Label>
|
|
290
|
+
<Textarea
|
|
291
|
+
id="tool-function-defs"
|
|
292
|
+
name="functionDefs"
|
|
293
|
+
value={form.functionDefinitions}
|
|
294
|
+
onChange={(e) => {
|
|
295
|
+
setForm((prev) => ({
|
|
296
|
+
...prev,
|
|
297
|
+
functionDefinitions: e.target.value,
|
|
298
|
+
jsonError: false,
|
|
299
|
+
}));
|
|
300
|
+
}}
|
|
301
|
+
placeholder={`[
|
|
301
302
|
{
|
|
302
303
|
"type": "function",
|
|
303
304
|
"function": {
|
|
@@ -311,19 +312,20 @@ export function ToolFormDialog({
|
|
|
311
312
|
}
|
|
312
313
|
}
|
|
313
314
|
]`}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
315
|
+
rows={10}
|
|
316
|
+
className="font-mono text-sm"
|
|
317
|
+
disabled={isPending}
|
|
318
|
+
/>
|
|
319
|
+
<p className="text-xs text-muted-foreground">
|
|
320
|
+
Array de definições no formato OpenAI Function Calling.
|
|
321
|
+
</p>
|
|
322
|
+
{form.jsonError && (
|
|
323
|
+
<p className="text-sm text-destructive">JSON inválido</p>
|
|
324
|
+
)}
|
|
325
|
+
</div>
|
|
324
326
|
</div>
|
|
325
327
|
|
|
326
|
-
<
|
|
328
|
+
<SheetFooter className="flex-row justify-end border-t">
|
|
327
329
|
<Button
|
|
328
330
|
type="button"
|
|
329
331
|
variant="outline"
|
|
@@ -338,9 +340,9 @@ export function ToolFormDialog({
|
|
|
338
340
|
) : null}
|
|
339
341
|
{isEditing ? "Salvar" : "Criar"}
|
|
340
342
|
</Button>
|
|
341
|
-
</
|
|
343
|
+
</SheetFooter>
|
|
342
344
|
</form>
|
|
343
|
-
</
|
|
344
|
-
</
|
|
345
|
+
</SheetContent>
|
|
346
|
+
</Sheet>
|
|
345
347
|
);
|
|
346
348
|
}
|