@apotech-os/support-kit 7.0.0 → 8.0.0
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/README.md +66 -0
- package/dist/{chunk-CQJJZA4F.js → chunk-2UHFKGMI.js} +55 -6
- package/dist/chunk-2UHFKGMI.js.map +1 -0
- package/dist/index.cjs +686 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +51 -5
- package/dist/index.d.ts +51 -5
- package/dist/index.js +651 -38
- package/dist/index.js.map +1 -1
- package/dist/ui/index.cjs +284 -8
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.js +249 -6
- package/dist/ui/index.js.map +1 -1
- package/package.json +11 -11
- package/dist/chunk-CQJJZA4F.js.map +0 -1
package/dist/ui/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EVALUATION_VERDICTS, WHATSAPP_MODES, validateSettings, AGENT_GUARDRAILS, toCategory, DEFAULT_MIN_CONFIDENCE, DEFAULT_ESCALATION_ENABLED, toAuditTags, toAgent, toGeneratedResponse, toResponseComparison, toTriageDecision, isGeneratedResponseStatus, isInvalidatableStatus, toCategoryGroup, NODE_NAMES, settingsToProfile, hasNoDraftNode, outcomeTags, DEFAULT_LLM_PROVIDER, computeWordDiff, requiresFollowup, isSendableVerdict, DEFAULT_MAX_TOOL_CALLS } from '../chunk-
|
|
1
|
+
import { EVALUATION_VERDICTS, WHATSAPP_MODES, validateSettings, AGENT_GUARDRAILS, toCategory, DEFAULT_MIN_CONFIDENCE, DEFAULT_ESCALATION_ENABLED, toAuditTags, toAgent, toGeneratedResponse, toResponseComparison, toTriageDecision, isGeneratedResponseStatus, isInvalidatableStatus, toCategoryGroup, followupIntegrationName, FOLLOWUP_WEBHOOK_TRIGGER, followupWebhookPath, FOLLOWUP_WEBHOOK_FORM, NODE_NAMES, settingsToProfile, hasNoDraftNode, outcomeTags, DEFAULT_LLM_PROVIDER, computeWordDiff, requiresFollowup, isSendableVerdict, DEFAULT_MAX_TOOL_CALLS } from '../chunk-2UHFKGMI.js';
|
|
2
2
|
import { forwardRef, useState, useMemo, useEffect, useRef, useCallback, useId } from 'react';
|
|
3
3
|
import { Textarea, cn, useAppContext, useAppSettings, DateRangeCompare, Link, Card, CardHeader, CardTitle, CardContent, AreaChart, StackedBarChart, Badge, useAppApi, useToast, Button, Select, DataTable, Spinner, Switch, Input, Checkbox, comparisonRange, SidePanel, Modal, Tooltip, buttonVariants, AppInvokeError, CopyButton, relativeDelta, Table, TableHeader, TableRow, TableHead, TableBody, TableCell, downloadBlob } from '@apotech-os/ui-sdk';
|
|
4
4
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
@@ -1362,7 +1362,6 @@ function ticketActions(input) {
|
|
|
1362
1362
|
} else if (job) {
|
|
1363
1363
|
skipped.push(`R\xE9ponse non envoy\xE9e \u2014 ${notSentReason2 ?? "raison inconnue."}`);
|
|
1364
1364
|
}
|
|
1365
|
-
if (job?.outcome === "needs_human") taken.push("Alerte lev\xE9e dans la bo\xEEte de r\xE9ception.");
|
|
1366
1365
|
if (job?.outcome === "awaiting_approval" && !simulated) taken.push("Demande d'approbation cr\xE9\xE9e.");
|
|
1367
1366
|
return { tags, taken, skipped, simulated, unrecorded: job !== void 0 && job.outcome === null };
|
|
1368
1367
|
}
|
|
@@ -3316,6 +3315,25 @@ function CategoriesPage() {
|
|
|
3316
3315
|
toast({ title: "\xC9chec de la mise \xE0 jour", description: describeApiError(err), variant: "error" });
|
|
3317
3316
|
}
|
|
3318
3317
|
}
|
|
3318
|
+
async function toggleFollowupFastResponse(category) {
|
|
3319
|
+
const next = !category.followupFastResponseEnabled;
|
|
3320
|
+
const data = { followupFastResponseEnabled: next };
|
|
3321
|
+
if (!next && category.followupAutoReplyEnabled) data.followupAutoReplyEnabled = false;
|
|
3322
|
+
try {
|
|
3323
|
+
await api.patch(categoryPath(category.id), { data });
|
|
3324
|
+
await refreshCategories();
|
|
3325
|
+
} catch (err) {
|
|
3326
|
+
toast({ title: "\xC9chec de la mise \xE0 jour", description: describeApiError(err), variant: "error" });
|
|
3327
|
+
}
|
|
3328
|
+
}
|
|
3329
|
+
async function toggleFollowupAutoReply(category) {
|
|
3330
|
+
try {
|
|
3331
|
+
await api.patch(categoryPath(category.id), { data: { followupAutoReplyEnabled: !category.followupAutoReplyEnabled } });
|
|
3332
|
+
await refreshCategories();
|
|
3333
|
+
} catch (err) {
|
|
3334
|
+
toast({ title: "\xC9chec de la mise \xE0 jour", description: describeApiError(err), variant: "error" });
|
|
3335
|
+
}
|
|
3336
|
+
}
|
|
3319
3337
|
async function move(category, direction) {
|
|
3320
3338
|
const siblings = byGroup.get(category.groupId ?? UNGROUPED_KEY) ?? [];
|
|
3321
3339
|
const index = siblings.findIndex((c) => c.id === category.id);
|
|
@@ -3386,6 +3404,30 @@ function CategoriesPage() {
|
|
|
3386
3404
|
}
|
|
3387
3405
|
)
|
|
3388
3406
|
] }),
|
|
3407
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
3408
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: "Fast response (suite)" }),
|
|
3409
|
+
/* @__PURE__ */ jsx(
|
|
3410
|
+
Switch,
|
|
3411
|
+
{
|
|
3412
|
+
"aria-label": `Fast response (suite) \u2014 ${category.name}`,
|
|
3413
|
+
checked: category.followupFastResponseEnabled,
|
|
3414
|
+
onCheckedChange: () => void toggleFollowupFastResponse(category),
|
|
3415
|
+
disabled: !canWrite || !category.agentId
|
|
3416
|
+
}
|
|
3417
|
+
)
|
|
3418
|
+
] }),
|
|
3419
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
3420
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: "R\xE9ponse auto (suite)" }),
|
|
3421
|
+
/* @__PURE__ */ jsx(
|
|
3422
|
+
Switch,
|
|
3423
|
+
{
|
|
3424
|
+
"aria-label": `R\xE9ponse auto (suite) \u2014 ${category.name}`,
|
|
3425
|
+
checked: category.followupAutoReplyEnabled,
|
|
3426
|
+
onCheckedChange: () => void toggleFollowupAutoReply(category),
|
|
3427
|
+
disabled: !canWrite || !category.followupFastResponseEnabled || !category.agentId
|
|
3428
|
+
}
|
|
3429
|
+
)
|
|
3430
|
+
] }),
|
|
3389
3431
|
category.extraTags.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex gap-1", children: category.extraTags.map((tag) => /* @__PURE__ */ jsx(Badge, { variant: "outline", children: tag }, tag)) }),
|
|
3390
3432
|
canWrite && /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
3391
3433
|
/* @__PURE__ */ jsx(
|
|
@@ -3959,6 +4001,87 @@ function SourceViewField({ views, value, onChange, disabled }) {
|
|
|
3959
4001
|
}
|
|
3960
4002
|
);
|
|
3961
4003
|
}
|
|
4004
|
+
function FollowupWebhookCard({ scopeTag, onScopeTagChange, canWrite }) {
|
|
4005
|
+
const { appSlug } = useAppContext();
|
|
4006
|
+
const scopeId = useId();
|
|
4007
|
+
return /* @__PURE__ */ jsx(Card, { id: "webhook-suite", children: /* @__PURE__ */ jsxs(CardContent, { className: "space-y-4 p-4", children: [
|
|
4008
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4009
|
+
/* @__PURE__ */ jsx("h2", { className: "font-medium", children: "R\xE9ponses aux messages suivants" }),
|
|
4010
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Quand un client r\xE9pond sur un ticket d\xE9j\xE0 trait\xE9, l'agent peut g\xE9n\xE9rer une nouvelle r\xE9ponse. Chaque cat\xE9gorie d\xE9cide si elle suit le fil (page Cat\xE9gories)." })
|
|
4011
|
+
] }),
|
|
4012
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4013
|
+
/* @__PURE__ */ jsx("label", { htmlFor: scopeId, className: "mb-1 block text-sm font-medium", children: "Tag de p\xE9rim\xE8tre webhook" }),
|
|
4014
|
+
/* @__PURE__ */ jsx(
|
|
4015
|
+
Input,
|
|
4016
|
+
{
|
|
4017
|
+
id: scopeId,
|
|
4018
|
+
value: scopeTag,
|
|
4019
|
+
onChange: (e) => onScopeTagChange(e.target.value),
|
|
4020
|
+
placeholder: "wai/triaged",
|
|
4021
|
+
disabled: !canWrite
|
|
4022
|
+
}
|
|
4023
|
+
),
|
|
4024
|
+
/* @__PURE__ */ jsxs("p", { className: "mt-1 text-xs text-muted-foreground", children: [
|
|
4025
|
+
"Le ticket doit d\xE9j\xE0 porter ce tag pour qu'un message suivant soit trait\xE9 \u2014 typiquement le tag \xAB trait\xE9 \xBB pos\xE9 par le premier passage. ",
|
|
4026
|
+
/* @__PURE__ */ jsx("strong", { children: "Vide = aucun message suivant trait\xE9" }),
|
|
4027
|
+
" (c'est aussi le kill-switch). Deux apps sur le m\xEAme compte Gorgias doivent y mettre des valeurs ",
|
|
4028
|
+
/* @__PURE__ */ jsx("strong", { children: "distinctes" }),
|
|
4029
|
+
", sinon chacune r\xE9pondrait sur les tickets de l'autre."
|
|
4030
|
+
] })
|
|
4031
|
+
] }),
|
|
4032
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2 border-t pt-4", children: [
|
|
4033
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: "Int\xE9gration Gorgias (installation manuelle)" }),
|
|
4034
|
+
/* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
|
|
4035
|
+
"\xC0 cr\xE9er une fois dans Gorgias, sous ",
|
|
4036
|
+
/* @__PURE__ */ jsx("em", { children: "Settings \u203A Integrations \u203A HTTP" }),
|
|
4037
|
+
". Rien n'est install\xE9 depuis cette page : l'app n'\xE9crit rien sur le compte Gorgias."
|
|
4038
|
+
] }),
|
|
4039
|
+
/* @__PURE__ */ jsxs("dl", { className: "space-y-1 text-xs", children: [
|
|
4040
|
+
/* @__PURE__ */ jsx(RecipeRow, { label: "Nom", children: followupIntegrationName(appSlug) }),
|
|
4041
|
+
/* @__PURE__ */ jsx(RecipeRow, { label: "D\xE9clencheur", children: FOLLOWUP_WEBHOOK_TRIGGER }),
|
|
4042
|
+
/* @__PURE__ */ jsx(RecipeRow, { label: "M\xE9thode", children: "POST" }),
|
|
4043
|
+
/* @__PURE__ */ jsxs(RecipeRow, { label: "URL", children: [
|
|
4044
|
+
"<PUBLIC_BASE_URL>",
|
|
4045
|
+
followupWebhookPath(appSlug)
|
|
4046
|
+
] }),
|
|
4047
|
+
/* @__PURE__ */ jsxs(RecipeRow, { label: "En-t\xEAte", children: [
|
|
4048
|
+
"Authorization: Bearer <cl\xE9 d'application ",
|
|
4049
|
+
/* @__PURE__ */ jsx("code", { children: "wopilo_app_\u2026" }),
|
|
4050
|
+
">"
|
|
4051
|
+
] })
|
|
4052
|
+
] }),
|
|
4053
|
+
/* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
|
|
4054
|
+
/* @__PURE__ */ jsx("code", { children: "PUBLIC_BASE_URL" }),
|
|
4055
|
+
" est l'origine publique de l'",
|
|
4056
|
+
/* @__PURE__ */ jsx("strong", { children: "API" }),
|
|
4057
|
+
" \u2014 pas forc\xE9ment celle de cette interface, que l'instance peut servir depuis un autre domaine (",
|
|
4058
|
+
/* @__PURE__ */ jsx("code", { children: "WEB_APP_URL" }),
|
|
4059
|
+
"). En cas de doute, c'est la valeur r\xE9gl\xE9e c\xF4t\xE9 instance qui fait foi : une URL construite sur la mauvaise origine renvoie 404 \xE0 chaque appel Gorgias, sans message d'erreur nulle part."
|
|
4060
|
+
] }),
|
|
4061
|
+
/* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
|
|
4062
|
+
"La cl\xE9 est une cl\xE9 d'application de cette app, cr\xE9\xE9e dans la plateforme puis coll\xE9e telle quelle dans l'en-t\xEAte. Elle porte le r\xF4le manifeste complet de l'app (voir",
|
|
4063
|
+
" ",
|
|
4064
|
+
/* @__PURE__ */ jsx("code", { children: "docs/app-platform/gorgias-callback-authentication.md" }),
|
|
4065
|
+
" \xA75)."
|
|
4066
|
+
] }),
|
|
4067
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4068
|
+
/* @__PURE__ */ jsx("p", { className: "mb-1 text-xs font-medium", children: "Champs du corps (onglet \xAB Body \xBB, un par ligne)" }),
|
|
4069
|
+
/* @__PURE__ */ jsx("ul", { className: "space-y-0.5 font-mono text-xs text-muted-foreground", children: Object.entries(FOLLOWUP_WEBHOOK_FORM).map(([key, value]) => /* @__PURE__ */ jsxs("li", { children: [
|
|
4070
|
+
key,
|
|
4071
|
+
" = ",
|
|
4072
|
+
value
|
|
4073
|
+
] }, key)) }),
|
|
4074
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: "Les quatre derniers champs ne sont pas document\xE9s par Gorgias : s'ils ne se r\xE9solvent pas, le traitement relit simplement le ticket et continue. Rien ne casse s'ils manquent." })
|
|
4075
|
+
] })
|
|
4076
|
+
] })
|
|
4077
|
+
] }) });
|
|
4078
|
+
}
|
|
4079
|
+
function RecipeRow({ label, children }) {
|
|
4080
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
4081
|
+
/* @__PURE__ */ jsx("dt", { className: "w-24 shrink-0 text-muted-foreground", children: label }),
|
|
4082
|
+
/* @__PURE__ */ jsx("dd", { className: "break-all font-mono", children })
|
|
4083
|
+
] });
|
|
4084
|
+
}
|
|
3962
4085
|
var WHATSAPP_MODE_LABELS = {
|
|
3963
4086
|
escalate_only: "Escalade uniquement",
|
|
3964
4087
|
draft_only: "Brouillon uniquement",
|
|
@@ -3978,7 +4101,7 @@ function list(value) {
|
|
|
3978
4101
|
return Array.isArray(value) ? value.join(", ") : "";
|
|
3979
4102
|
}
|
|
3980
4103
|
function parseList(value) {
|
|
3981
|
-
return value.split(
|
|
4104
|
+
return value.split(/[\n,]/).map((v) => v.trim()).filter(Boolean);
|
|
3982
4105
|
}
|
|
3983
4106
|
function describeConnection(connections) {
|
|
3984
4107
|
if (connections === void 0) return { text: "Chargement\u2026", tone: "muted" };
|
|
@@ -4254,6 +4377,14 @@ function SettingsPage() {
|
|
|
4254
4377
|
/* @__PURE__ */ jsx(Input, { id: key, value: field(form[key]), onChange: (e) => set(key, e.target.value), disabled: !canWrite })
|
|
4255
4378
|
] }, key))
|
|
4256
4379
|
] }) }),
|
|
4380
|
+
/* @__PURE__ */ jsx(
|
|
4381
|
+
FollowupWebhookCard,
|
|
4382
|
+
{
|
|
4383
|
+
scopeTag: field(form.webhookScopeTag),
|
|
4384
|
+
onScopeTagChange: (value) => set("webhookScopeTag", value),
|
|
4385
|
+
canWrite
|
|
4386
|
+
}
|
|
4387
|
+
),
|
|
4257
4388
|
/* @__PURE__ */ jsx(Card, { id: "guardrails", children: /* @__PURE__ */ jsxs(CardContent, { className: "space-y-3 p-4", children: [
|
|
4258
4389
|
/* @__PURE__ */ jsx("h2", { className: "font-medium", children: "Garde-fous" }),
|
|
4259
4390
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
@@ -4270,7 +4401,7 @@ function SettingsPage() {
|
|
|
4270
4401
|
)) })
|
|
4271
4402
|
] }),
|
|
4272
4403
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
4273
|
-
/* @__PURE__ */ jsx("label", { htmlFor: "blocklist", className: "mb-1 block text-sm font-medium", children: "Liste de blocage" }),
|
|
4404
|
+
/* @__PURE__ */ jsx("label", { htmlFor: "blocklist", className: "mb-1 block text-sm font-medium", children: "Liste de blocage (un par ligne ou s\xE9par\xE9s par des virgules)" }),
|
|
4274
4405
|
/* @__PURE__ */ jsx(
|
|
4275
4406
|
Textarea,
|
|
4276
4407
|
{
|
|
@@ -4282,7 +4413,7 @@ function SettingsPage() {
|
|
|
4282
4413
|
)
|
|
4283
4414
|
] }),
|
|
4284
4415
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
4285
|
-
/* @__PURE__ */ jsx("label", { htmlFor: "noreplySenders", className: "mb-1 block text-sm font-medium", children: "Exp\xE9diteurs no-reply (s\xE9par\xE9s par des virgules)" }),
|
|
4416
|
+
/* @__PURE__ */ jsx("label", { htmlFor: "noreplySenders", className: "mb-1 block text-sm font-medium", children: "Exp\xE9diteurs no-reply (un par ligne ou s\xE9par\xE9s par des virgules)" }),
|
|
4286
4417
|
/* @__PURE__ */ jsx(
|
|
4287
4418
|
Textarea,
|
|
4288
4419
|
{
|
|
@@ -6006,6 +6137,116 @@ function DryRunResultView({ result, langfuseConfig, knownTags, tagSettings }) {
|
|
|
6006
6137
|
] })
|
|
6007
6138
|
] });
|
|
6008
6139
|
}
|
|
6140
|
+
var STATUS_BADGE = {
|
|
6141
|
+
passed: { label: "OK", variant: "success" },
|
|
6142
|
+
stopped: { label: "Arr\xEAt", variant: "danger" },
|
|
6143
|
+
// A pre-gate that could not read its field. Never shown by the diagnostic
|
|
6144
|
+
// (it evaluates no payload) but rendered honestly if it ever appears, rather
|
|
6145
|
+
// than falling through to a blank badge.
|
|
6146
|
+
muted: { label: "Muet", variant: "warning" },
|
|
6147
|
+
skipped: { label: "Non \xE9valu\xE9", variant: "neutral" }
|
|
6148
|
+
};
|
|
6149
|
+
function FollowupWebhookCard2() {
|
|
6150
|
+
const api = useAppApi();
|
|
6151
|
+
const toast = useToast();
|
|
6152
|
+
const ticketId = useId();
|
|
6153
|
+
const [ticket, setTicket] = useState("");
|
|
6154
|
+
const [test, setTest] = useState(null);
|
|
6155
|
+
const [isTesting, setIsTesting] = useState(false);
|
|
6156
|
+
const [confirmingRealRun, setConfirmingRealRun] = useState(false);
|
|
6157
|
+
async function runTest(mode) {
|
|
6158
|
+
setIsTesting(true);
|
|
6159
|
+
setTest(null);
|
|
6160
|
+
try {
|
|
6161
|
+
setTest(await api.invoke("test-gorgias-webhook", { ticketId: ticket.trim(), mode }));
|
|
6162
|
+
} catch (err) {
|
|
6163
|
+
toast({ title: "\xC9chec du test", description: describeInvokeError(err), variant: "error" });
|
|
6164
|
+
} finally {
|
|
6165
|
+
setIsTesting(false);
|
|
6166
|
+
setConfirmingRealRun(false);
|
|
6167
|
+
}
|
|
6168
|
+
}
|
|
6169
|
+
const disabled = !ticket.trim() || isTesting;
|
|
6170
|
+
return /* @__PURE__ */ jsxs(Card, { id: "webhook-suite", children: [
|
|
6171
|
+
/* @__PURE__ */ jsxs(CardContent, { className: "space-y-3 p-4", children: [
|
|
6172
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
6173
|
+
/* @__PURE__ */ jsx("h2", { className: "font-medium", children: "R\xE9ponses aux messages suivants" }),
|
|
6174
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Rejoue sur un ticket r\xE9el ce que ferait le webhook Gorgias quand un client r\xE9pond sur un ticket d\xE9j\xE0 trait\xE9. Le tag de p\xE9rim\xE8tre et les cat\xE9gories se r\xE8glent dans Param\xE8tres." })
|
|
6175
|
+
] }),
|
|
6176
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2 border-t pt-3", children: [
|
|
6177
|
+
/* @__PURE__ */ jsx("label", { htmlFor: ticketId, className: "block text-sm font-medium", children: "Ticket \xE0 tester" }),
|
|
6178
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
6179
|
+
/* @__PURE__ */ jsx(
|
|
6180
|
+
Input,
|
|
6181
|
+
{
|
|
6182
|
+
id: ticketId,
|
|
6183
|
+
value: ticket,
|
|
6184
|
+
onChange: (e) => setTicket(e.target.value),
|
|
6185
|
+
placeholder: "1534712154",
|
|
6186
|
+
className: "max-w-48"
|
|
6187
|
+
}
|
|
6188
|
+
),
|
|
6189
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", onClick: () => void runTest("diagnostic"), disabled, children: "Diagnostic" }),
|
|
6190
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", onClick: () => void runTest("generate"), disabled, children: "G\xE9n\xE9rer sans envoyer" }),
|
|
6191
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", onClick: () => setConfirmingRealRun(true), disabled, children: "Ex\xE9cution r\xE9elle" })
|
|
6192
|
+
] }),
|
|
6193
|
+
/* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
|
|
6194
|
+
"Le diagnostic \xE9value les m\xEAmes conditions que le webhook, sans aucun effet de bord.",
|
|
6195
|
+
" ",
|
|
6196
|
+
/* @__PURE__ */ jsx("strong", { children: "G\xE9n\xE9rer sans envoyer" }),
|
|
6197
|
+
" produit la r\xE9ponse compl\xE8te \u2014 m\xEAme si la cat\xE9gorie n'a pas activ\xE9 les r\xE9ponses aux messages suivants \u2014 et ne l'envoie jamais ; elle se lit dans la fiche du ticket. L'ex\xE9cution r\xE9elle d\xE9clenche le vrai traitement."
|
|
6198
|
+
] }),
|
|
6199
|
+
isTesting && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
6200
|
+
/* @__PURE__ */ jsx(Spinner, {}),
|
|
6201
|
+
" Test en cours\u2026"
|
|
6202
|
+
] }),
|
|
6203
|
+
test?.mode === "generate" && /* @__PURE__ */ jsxs("p", { className: "text-sm", children: [
|
|
6204
|
+
"G\xE9n\xE9ration d\xE9clench\xE9e, sans envoi. Run \xE0 suivre : ",
|
|
6205
|
+
/* @__PURE__ */ jsx("code", { children: test.runId }),
|
|
6206
|
+
"."
|
|
6207
|
+
] }),
|
|
6208
|
+
test?.mode === "run" && /* @__PURE__ */ jsxs("p", { className: "text-sm", children: [
|
|
6209
|
+
"Traitement d\xE9clench\xE9. Run \xE0 suivre : ",
|
|
6210
|
+
/* @__PURE__ */ jsx("code", { children: test.runId }),
|
|
6211
|
+
"."
|
|
6212
|
+
] }),
|
|
6213
|
+
test?.mode === "diagnostic" && /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
6214
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: test.stoppedAt === null ? `Ticket ${test.ticketId} : il aurait re\xE7u une r\xE9ponse de suite.` : `Ticket ${test.ticketId} : arr\xEAt en ${test.stoppedAt}.` }),
|
|
6215
|
+
/* @__PURE__ */ jsx("ul", { className: "space-y-1", children: test.gates.map((gate) => /* @__PURE__ */ jsxs("li", { className: "flex items-start gap-2 text-xs", children: [
|
|
6216
|
+
/* @__PURE__ */ jsx(Badge, { variant: STATUS_BADGE[gate.status].variant, children: STATUS_BADGE[gate.status].label }),
|
|
6217
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
6218
|
+
/* @__PURE__ */ jsxs("span", { className: "font-medium", children: [
|
|
6219
|
+
gate.gate,
|
|
6220
|
+
" \u2014 ",
|
|
6221
|
+
gate.label
|
|
6222
|
+
] }),
|
|
6223
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
6224
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: gate.detail })
|
|
6225
|
+
] })
|
|
6226
|
+
] }, gate.gate)) })
|
|
6227
|
+
] })
|
|
6228
|
+
] })
|
|
6229
|
+
] }),
|
|
6230
|
+
confirmingRealRun && /* @__PURE__ */ jsx(
|
|
6231
|
+
ConfirmModal,
|
|
6232
|
+
{
|
|
6233
|
+
title: "Lancer le traitement r\xE9el ?",
|
|
6234
|
+
description: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6235
|
+
"Le ticket ",
|
|
6236
|
+
ticket.trim(),
|
|
6237
|
+
" va \xEAtre trait\xE9 comme un vrai message suivant : g\xE9n\xE9ration, garde-fous, et",
|
|
6238
|
+
" ",
|
|
6239
|
+
/* @__PURE__ */ jsx("strong", { children: "envoi r\xE9el au client" }),
|
|
6240
|
+
" si sa cat\xE9gorie est en r\xE9ponse automatique. Pour tout voir sans rien envoyer, utilisez \xAB G\xE9n\xE9rer sans envoyer \xBB."
|
|
6241
|
+
] }),
|
|
6242
|
+
confirmLabel: "Lancer",
|
|
6243
|
+
busyLabel: "D\xE9clenchement\u2026",
|
|
6244
|
+
onConfirm: () => runTest("run"),
|
|
6245
|
+
onCancel: () => setConfirmingRealRun(false)
|
|
6246
|
+
}
|
|
6247
|
+
)
|
|
6248
|
+
] });
|
|
6249
|
+
}
|
|
6009
6250
|
var TRI_STATE_OPTIONS = [
|
|
6010
6251
|
{ value: "", label: "R\xE9glages actuels" },
|
|
6011
6252
|
{ value: "on", label: "Forcer actif" },
|
|
@@ -6193,9 +6434,11 @@ function TestControls() {
|
|
|
6193
6434
|
function TestPage() {
|
|
6194
6435
|
const { role } = useAppContext();
|
|
6195
6436
|
const canRun = canWriteForRole(role);
|
|
6437
|
+
const canTestFollowup = role === "ADMIN";
|
|
6196
6438
|
return /* @__PURE__ */ jsxs(PageShell, { children: [
|
|
6197
6439
|
/* @__PURE__ */ jsx(PageHeader, { title: "Banc de test", description: "Rejoue le graphe sans jamais agir sur un vrai ticket (\xA70)." }),
|
|
6198
|
-
!canRun ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Acc\xE8s en lecture seule \u2014 lancer un test n\xE9cessite le r\xF4le EDITOR (chaque ex\xE9cution consomme du budget LLM)." }) : /* @__PURE__ */ jsx(TestControls, {})
|
|
6440
|
+
!canRun ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Acc\xE8s en lecture seule \u2014 lancer un test n\xE9cessite le r\xF4le EDITOR (chaque ex\xE9cution consomme du budget LLM)." }) : /* @__PURE__ */ jsx(TestControls, {}),
|
|
6441
|
+
canTestFollowup && /* @__PURE__ */ jsx(FollowupWebhookCard2, {})
|
|
6199
6442
|
] });
|
|
6200
6443
|
}
|
|
6201
6444
|
function ExperimentStatusBadge({ experiment }) {
|