@greatapps/greatagents-ui 0.3.25 → 0.3.26
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 +16 -61
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/agents/agent-revision-tab.tsx +3 -62
package/package.json
CHANGED
|
@@ -6,12 +6,8 @@ import {
|
|
|
6
6
|
Button,
|
|
7
7
|
Badge,
|
|
8
8
|
Skeleton,
|
|
9
|
-
Dialog,
|
|
10
|
-
DialogContent,
|
|
11
|
-
DialogHeader,
|
|
12
|
-
DialogTitle,
|
|
13
9
|
} from "@greatapps/greatauth-ui/ui";
|
|
14
|
-
import { FileText, RotateCcw, X
|
|
10
|
+
import { FileText, RotateCcw, X } from "lucide-react";
|
|
15
11
|
import { toast } from "sonner";
|
|
16
12
|
|
|
17
13
|
interface AgentRevisionTabProps {
|
|
@@ -19,7 +15,6 @@ interface AgentRevisionTabProps {
|
|
|
19
15
|
config: GagentsHookConfig;
|
|
20
16
|
}
|
|
21
17
|
|
|
22
|
-
const STRUCTURED_MARKERS = ["[IDENTIDADE]", "[MISSÃO]", "[TOM, ESTILO & FORMATO]"];
|
|
23
18
|
|
|
24
19
|
function formatDate(dateStr: string): string {
|
|
25
20
|
const date = new Date(dateStr);
|
|
@@ -107,16 +102,10 @@ function buildAssembledPrompt(agent: Agent): string {
|
|
|
107
102
|
return sections.join("\n\n");
|
|
108
103
|
}
|
|
109
104
|
|
|
110
|
-
function isLegacyVersion(version: PromptVersion): boolean {
|
|
111
|
-
const content = version.prompt_content ?? "";
|
|
112
|
-
return !STRUCTURED_MARKERS.some((marker) => content.includes(marker));
|
|
113
|
-
}
|
|
114
|
-
|
|
115
105
|
export function AgentRevisionTab({ agent, config }: AgentRevisionTabProps) {
|
|
116
106
|
const { data: versionsData, isLoading } = usePromptVersions(config, agent.id);
|
|
117
107
|
|
|
118
108
|
const [compareVersionId, setCompareVersionId] = useState<number | null>(null);
|
|
119
|
-
const [legacyModalVersion, setLegacyModalVersion] = useState<PromptVersion | null>(null);
|
|
120
109
|
|
|
121
110
|
const versions = (versionsData?.data || []) as PromptVersion[];
|
|
122
111
|
const sortedVersions = [...versions].sort(
|
|
@@ -143,12 +132,8 @@ export function AgentRevisionTab({ agent, config }: AgentRevisionTabProps) {
|
|
|
143
132
|
? computeDiff(compareVersion.prompt_content ?? "", currentVersion.prompt_content ?? "")
|
|
144
133
|
: null;
|
|
145
134
|
|
|
146
|
-
function handleRestore(
|
|
147
|
-
|
|
148
|
-
setLegacyModalVersion(version);
|
|
149
|
-
} else {
|
|
150
|
-
toast.info("Restaurar versão estruturada — funcionalidade em desenvolvimento");
|
|
151
|
-
}
|
|
135
|
+
function handleRestore(_version: PromptVersion) {
|
|
136
|
+
toast.info("Restaurar versão — funcionalidade em desenvolvimento");
|
|
152
137
|
}
|
|
153
138
|
|
|
154
139
|
if (isLoading) {
|
|
@@ -319,50 +304,6 @@ export function AgentRevisionTab({ agent, config }: AgentRevisionTabProps) {
|
|
|
319
304
|
)}
|
|
320
305
|
</div>
|
|
321
306
|
|
|
322
|
-
{/* Legacy version modal */}
|
|
323
|
-
<Dialog
|
|
324
|
-
open={!!legacyModalVersion}
|
|
325
|
-
onOpenChange={(open) => {
|
|
326
|
-
if (!open) setLegacyModalVersion(null);
|
|
327
|
-
}}
|
|
328
|
-
>
|
|
329
|
-
<DialogContent className="max-w-2xl">
|
|
330
|
-
<DialogHeader>
|
|
331
|
-
<DialogTitle className="flex items-center gap-2">
|
|
332
|
-
<AlertTriangle className="h-5 w-5 text-amber-500" />
|
|
333
|
-
Versão Legada — v{legacyModalVersion?.version_number}
|
|
334
|
-
</DialogTitle>
|
|
335
|
-
</DialogHeader>
|
|
336
|
-
<div className="space-y-3">
|
|
337
|
-
<div className="rounded-lg border border-amber-500/30 bg-amber-500/5 p-3">
|
|
338
|
-
<p className="text-sm text-amber-700 dark:text-amber-400">
|
|
339
|
-
Esta versão foi criada antes da reestruturação e não pode ser restaurada nos campos estruturados.
|
|
340
|
-
</p>
|
|
341
|
-
</div>
|
|
342
|
-
<div className="max-h-96 overflow-auto rounded-lg border p-4">
|
|
343
|
-
<pre className="whitespace-pre-wrap font-mono text-sm leading-relaxed">
|
|
344
|
-
{legacyModalVersion?.prompt_content ?? ""}
|
|
345
|
-
</pre>
|
|
346
|
-
</div>
|
|
347
|
-
<div className="flex items-center gap-3 text-xs text-muted-foreground">
|
|
348
|
-
<span>
|
|
349
|
-
{(legacyModalVersion?.prompt_content ?? "").length.toLocaleString("pt-BR")} caracteres
|
|
350
|
-
</span>
|
|
351
|
-
{legacyModalVersion?.change_notes && (
|
|
352
|
-
<>
|
|
353
|
-
<span>·</span>
|
|
354
|
-
<span className="italic">{legacyModalVersion.change_notes}</span>
|
|
355
|
-
</>
|
|
356
|
-
)}
|
|
357
|
-
</div>
|
|
358
|
-
</div>
|
|
359
|
-
<div className="flex justify-end pt-2">
|
|
360
|
-
<Button variant="outline" onClick={() => setLegacyModalVersion(null)}>
|
|
361
|
-
Fechar
|
|
362
|
-
</Button>
|
|
363
|
-
</div>
|
|
364
|
-
</DialogContent>
|
|
365
|
-
</Dialog>
|
|
366
307
|
</div>
|
|
367
308
|
);
|
|
368
309
|
}
|