@apotech-os/support-kit 10.1.0 → 10.3.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 +7 -0
- package/dist/{chunk-KEPXRZ7R.js → chunk-ZKFQ3DIY.js} +425 -240
- package/dist/chunk-ZKFQ3DIY.js.map +1 -0
- package/dist/index.cjs +1303 -503
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +137 -74
- package/dist/index.d.ts +137 -74
- package/dist/index.js +766 -111
- package/dist/index.js.map +1 -1
- package/dist/ui/index.cjs +334 -60
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.js +213 -52
- package/dist/ui/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-KEPXRZ7R.js.map +0 -1
package/dist/ui/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EVALUATION_VERDICTS, WHATSAPP_MODES, foldOutcomes, foldDailyOutcomes, fillMissingDays, autonomyRate, settledCount, countFailed, dashboardSignals, foldHumanReasons, foldCategoryOutcomes, toDeliveryPolicy, validateSettings, settingsWarnings, SUPPORT_CHANNELS, AGENT_GUARDRAILS, periodBoundsOf, toCategory, OUTCOME_METRICS, OUTCOME_GROUP_BY, TRIAGE_HANDOFF_GROUP_BY, CATEGORY_TRIAGE_GROUP_BY, CATEGORY_OUTCOME_GROUP_BY, ratePoints, toGeneratedResponse, toTriageDecision, toAgent, toResponseComparison, isGeneratedResponseStatus, isInvalidatableStatus, toCategoryGroup, followupIntegrationName, FOLLOWUP_WEBHOOK_TRIGGER, followupWebhookPath, FOLLOWUP_WEBHOOK_FORM, NODE_NAMES, settingsToProfile, hasNoDraftNode, buildTimelineSteps, outcomeTags, DEFAULT_LLM_PROVIDER, computeWordDiff, isSendableVerdict, COLLISION_GUARDRAILS, DEFAULT_MAX_TOOL_CALLS, DEFAULT_MIN_CONFIDENCE, DEFAULT_ESCALATION_ENABLED } from '../chunk-
|
|
1
|
+
import { EVALUATION_VERDICTS, WHATSAPP_MODES, foldOutcomes, foldDailyOutcomes, fillMissingDays, autonomyRate, settledCount, countFailed, dashboardSignals, foldHumanReasons, foldCategoryOutcomes, toDeliveryPolicy, validateSettings, settingsWarnings, SUPPORT_CHANNELS, AGENT_GUARDRAILS, periodBoundsOf, toCategory, OUTCOME_METRICS, OUTCOME_GROUP_BY, TRIAGE_HANDOFF_GROUP_BY, CATEGORY_TRIAGE_GROUP_BY, CATEGORY_OUTCOME_GROUP_BY, ratePoints, REPLY_TIMING_METRICS, REPLY_TIMING_GROUP_BY, foldReplyTimings, DELAY_BUCKETS, toGeneratedResponse, toTriageDecision, toAgent, toResponseComparison, isGeneratedResponseStatus, isInvalidatableStatus, toCategoryGroup, followupIntegrationName, FOLLOWUP_WEBHOOK_TRIGGER, followupWebhookPath, FOLLOWUP_WEBHOOK_FORM, readConversationEnd, DEFAULT_CONVERSATION_END_TAG, NODE_NAMES, settingsToProfile, hasNoDraftNode, buildTimelineSteps, conversationEndEffects, outcomeTags, DEFAULT_LLM_PROVIDER, computeWordDiff, isSendableVerdict, COLLISION_GUARDRAILS, DEFAULT_MAX_TOOL_CALLS, DEFAULT_MIN_CONFIDENCE, DEFAULT_ESCALATION_ENABLED } from '../chunk-ZKFQ3DIY.js';
|
|
2
2
|
import { forwardRef, useState, useMemo, useRef, useCallback, useEffect, 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, Checkbox, Input, comparisonRange, SidePanel, Modal, Tooltip, buttonVariants, useAppRun, 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';
|
|
@@ -209,6 +209,70 @@ function AutonomyHero({
|
|
|
209
209
|
sides.length > 0 && /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-4 border-t border-border/60 pt-3 sm:max-w-md", children: sides.map((side) => /* @__PURE__ */ jsx(HeroSide, { ...side }, side.label)) })
|
|
210
210
|
] }) });
|
|
211
211
|
}
|
|
212
|
+
var DELAY_BUCKET_LABELS = {
|
|
213
|
+
lt_5m: "moins de 5 min",
|
|
214
|
+
"5_15m": "5 \xE0 15 min",
|
|
215
|
+
"15_60m": "15 \xE0 60 min",
|
|
216
|
+
"1_4h": "1 \xE0 4 h",
|
|
217
|
+
"4_24h": "4 \xE0 24 h",
|
|
218
|
+
gt_24h: "plus de 24 h"
|
|
219
|
+
};
|
|
220
|
+
function formatDuration(seconds) {
|
|
221
|
+
if (Math.round(seconds) < 60) return `${Math.round(seconds)} s`;
|
|
222
|
+
const minutes = Math.round(seconds / 60);
|
|
223
|
+
if (minutes < 60) return `${minutes} min`;
|
|
224
|
+
const hours = Math.floor(minutes / 60);
|
|
225
|
+
if (hours < 24) {
|
|
226
|
+
const rest = minutes % 60;
|
|
227
|
+
return rest === 0 ? `${hours} h` : `${hours} h ${String(rest).padStart(2, "0")}`;
|
|
228
|
+
}
|
|
229
|
+
return `${Math.floor(hours / 24)} j ${hours % 24} h`;
|
|
230
|
+
}
|
|
231
|
+
function Figure({ label, value }) {
|
|
232
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
233
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs font-medium uppercase tracking-widest text-muted-foreground", children: label }),
|
|
234
|
+
/* @__PURE__ */ jsx("p", { className: "text-2xl font-semibold tabular-nums", children: value })
|
|
235
|
+
] });
|
|
236
|
+
}
|
|
237
|
+
function ReplyTimesSection({ fromIso, toIso }) {
|
|
238
|
+
const { rows, isLoading, error } = useAggregate("reply-timing", {
|
|
239
|
+
filter: { customerMessageAt: { gte: fromIso, lte: toIso } },
|
|
240
|
+
groupBy: REPLY_TIMING_GROUP_BY,
|
|
241
|
+
metrics: REPLY_TIMING_METRICS
|
|
242
|
+
});
|
|
243
|
+
const ai = useMemo(() => foldReplyTimings(rows).ai, [rows]);
|
|
244
|
+
const histogram = DELAY_BUCKETS.map((bucket) => ({
|
|
245
|
+
tranche: DELAY_BUCKET_LABELS[bucket],
|
|
246
|
+
ai: ai.buckets[bucket]
|
|
247
|
+
}));
|
|
248
|
+
return /* @__PURE__ */ jsxs(Card, { "data-testid": "dashboard-reply-times", children: [
|
|
249
|
+
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { className: "text-sm", children: "D\xE9lais de r\xE9ponse" }) }),
|
|
250
|
+
/* @__PURE__ */ jsxs(CardContent, { className: "space-y-4", children: [
|
|
251
|
+
isLoading ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Chargement\u2026" }) : error !== void 0 ? /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: "Impossible de calculer les d\xE9lais de r\xE9ponse." }) : ai.medianBucket === null || ai.avgSeconds === null ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Aucune r\xE9ponse de l\u2019IA mesur\xE9e sur cette p\xE9riode." }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
252
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-3 gap-4", children: [
|
|
253
|
+
/* @__PURE__ */ jsx(Figure, { label: "D\xE9lai m\xE9dian IA", value: DELAY_BUCKET_LABELS[ai.medianBucket] }),
|
|
254
|
+
/* @__PURE__ */ jsx(Figure, { label: "D\xE9lai moyen IA", value: formatDuration(ai.avgSeconds) }),
|
|
255
|
+
/* @__PURE__ */ jsx(Figure, { label: "Volume", value: `${ai.count.toLocaleString("fr-FR")} tours` })
|
|
256
|
+
] }),
|
|
257
|
+
/* @__PURE__ */ jsx(
|
|
258
|
+
StackedBarChart,
|
|
259
|
+
{
|
|
260
|
+
data: histogram,
|
|
261
|
+
x: "tranche",
|
|
262
|
+
label: "R\xE9ponses de l\u2019IA par tranche de d\xE9lai",
|
|
263
|
+
series: [{ key: "ai", label: "R\xE9ponse de l\u2019IA", colorIndex: 0 }],
|
|
264
|
+
height: 150
|
|
265
|
+
}
|
|
266
|
+
)
|
|
267
|
+
] }),
|
|
268
|
+
/* @__PURE__ */ jsxs("p", { className: "text-xs leading-relaxed text-muted-foreground", children: [
|
|
269
|
+
"Le d\xE9lai court du ",
|
|
270
|
+
/* @__PURE__ */ jsx("strong", { children: "premier" }),
|
|
271
|
+
" message du client rest\xE9 sans r\xE9ponse jusqu\u2019\xE0 la premi\xE8re r\xE9ponse qui le suit, en temps r\xE9el (nuits et week-ends compris). La m\xE9diane est une tranche : la moiti\xE9 des r\xE9ponses arrive dans cette tranche ou avant. Deux \xE9carts connus : une r\xE9ponse approuv\xE9e par un humain avant envoi compte comme une r\xE9ponse de l\u2019IA, et les tours reconstitu\xE9s apr\xE8s coup partent du dernier message du client, pas du premier."
|
|
272
|
+
] })
|
|
273
|
+
] })
|
|
274
|
+
] });
|
|
275
|
+
}
|
|
212
276
|
var DASHBOARD_PRESETS = [
|
|
213
277
|
{ key: "last7", label: "7 derniers jours" },
|
|
214
278
|
{ key: "last30", label: "30 derniers jours" }
|
|
@@ -434,6 +498,7 @@ function DashboardPage() {
|
|
|
434
498
|
/* @__PURE__ */ jsx("p", { className: "mt-2", children: "Le taux d\u2019autonomie rapporte les r\xE9ponses envoy\xE9es par l\u2019IA \xE0 ces m\xEAmes r\xE9ponses plus celles qu\u2019un humain a reprises \u2014 bloqu\xE9es, escalad\xE9es, invalid\xE9es parce qu\u2019un agent avait d\xE9j\xE0 r\xE9pondu, ou expir\xE9es. \xB7 Une escalade est compt\xE9e UNE fois, du c\xF4t\xE9 humain : c\u2019est un motif de blocage, pas un camp de plus. \xB7 Les demandes encore en cours, celles sans r\xE9ponse n\xE9cessaire et les \xE9checs techniques sont hors du taux \u2014 les compter d\u2019un c\xF4t\xE9 ou de l\u2019autre le fausserait dans les deux sens. \xB7 Le d\xE9nominateur ne couvre que les demandes mises en file : un ticket escalad\xE9 avant toute g\xE9n\xE9ration n\u2019y figure pas." })
|
|
435
499
|
] }),
|
|
436
500
|
dailyError !== void 0 && /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: "Erreur lors du calcul des chiffres cl\xE9s." }),
|
|
501
|
+
/* @__PURE__ */ jsx(ReplyTimesSection, { fromIso: bounds.current.fromIso, toIso: bounds.current.toIso }),
|
|
437
502
|
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-4", children: [
|
|
438
503
|
/* @__PURE__ */ jsxs(Card, { children: [
|
|
439
504
|
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsxs(CardTitle, { className: "text-sm", children: [
|
|
@@ -643,7 +708,9 @@ var SETTINGS_ISSUE_LABELS = {
|
|
|
643
708
|
appScopeTag: "Tag des tickets de l'application requis \u2014 c'est lui qui rattache un ticket \xE0 cette app.",
|
|
644
709
|
nodes: "nodes.triage doit \xEAtre configur\xE9 \u2014 une \xE9tape de triage \xE0 null ne triagerait rien.",
|
|
645
710
|
nodePrompt: "Chaque \xE9tape active doit d\xE9signer un prompt Langfuse \u2014 sans prompt, l'\xE9tape n'a rien \xE0 dire au mod\xE8le.",
|
|
646
|
-
senderEmail: "Adresse d'envoi requise quand l'envoi automatique est actif (sauf en mode WhatsApp \xAB auto_reply \xBB)."
|
|
711
|
+
senderEmail: "Adresse d'envoi requise quand l'envoi automatique est actif (sauf en mode WhatsApp \xAB auto_reply \xBB).",
|
|
712
|
+
conversationEndTag: "Tag de fin de conversation invalide \u2014 il doit \xEAtre renseign\xE9, et diff\xE9rent des tags de reprise humaine (escalade, \xE0 revoir avant envoi, suivi requis), du tag de prise en charge et du tag de l'application.",
|
|
713
|
+
conversationEndPrompt: "Prompt \xAB fin de conversation \xBB requis d\xE8s que l'action de fin de conversation est activ\xE9e."
|
|
647
714
|
};
|
|
648
715
|
function settingsIssueLabel(key, fallback) {
|
|
649
716
|
return SETTINGS_ISSUE_LABELS[key] ?? fallback;
|
|
@@ -1245,6 +1312,8 @@ function describeReason(reason2) {
|
|
|
1245
1312
|
return "Le client a \xE9crit \xE0 nouveau avant l\u2019envoi : une r\xE9ponse plus r\xE9cente a remplac\xE9 celle-ci.";
|
|
1246
1313
|
case "test_draft":
|
|
1247
1314
|
return "Brouillon d'essai \u2014 jamais envoy\xE9.";
|
|
1315
|
+
case "no_reply_needed":
|
|
1316
|
+
return "Aucune r\xE9ponse n\xE9cessaire \u2014 la conversation est finie.";
|
|
1248
1317
|
case "unexpected_status":
|
|
1249
1318
|
return `La r\xE9ponse n'a pas \xE9t\xE9 envoy\xE9e (statut : ${reason2.status}).`;
|
|
1250
1319
|
case "no_correction":
|
|
@@ -1329,14 +1398,18 @@ function triageTagNames(input) {
|
|
|
1329
1398
|
}
|
|
1330
1399
|
function wasSimulated(job, policy) {
|
|
1331
1400
|
if (!job) return false;
|
|
1401
|
+
if (job.status === "test_draft") return true;
|
|
1332
1402
|
if (job.outcome === "sent" && job.status !== "sent") return true;
|
|
1333
1403
|
return policy?.dryRun === true;
|
|
1334
1404
|
}
|
|
1335
1405
|
function ticketActions(input) {
|
|
1336
1406
|
const { job, policy, notSentReason } = input;
|
|
1337
1407
|
const simulated = wasSimulated(job, policy);
|
|
1408
|
+
const ended = job?.outcome === "no_reply_needed" && (job.status === "no_reply_needed" || job.status === "test_draft") && input.decision.conversationOver === true;
|
|
1409
|
+
const endEffects = conversationEndEffects(ended ? policy?.conversationEnd ?? null : null);
|
|
1338
1410
|
const tags = dedupe([
|
|
1339
1411
|
...triageTagNames(input),
|
|
1412
|
+
...endEffects.tags,
|
|
1340
1413
|
...policy ? outcomeTags(job?.outcome ?? null, job?.verdict ?? null, policy.audit) : []
|
|
1341
1414
|
]);
|
|
1342
1415
|
const taken = [];
|
|
@@ -1347,6 +1420,7 @@ function ticketActions(input) {
|
|
|
1347
1420
|
skipped.push(`R\xE9ponse non envoy\xE9e \u2014 ${notSentReason ?? "raison inconnue."}`);
|
|
1348
1421
|
}
|
|
1349
1422
|
if (job?.outcome === "awaiting_approval" && !simulated) taken.push("Demande d'approbation cr\xE9\xE9e.");
|
|
1423
|
+
if (endEffects.close && !simulated) taken.push("Ticket ferm\xE9 dans Gorgias.");
|
|
1350
1424
|
return { tags, taken, skipped, simulated, unrecorded: job !== void 0 && job.outcome === null };
|
|
1351
1425
|
}
|
|
1352
1426
|
function TimelinePanel(props) {
|
|
@@ -3679,6 +3753,61 @@ function NumberField({ id, label, value, onChange, disabled, min, max, integer,
|
|
|
3679
3753
|
hint && /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: hint })
|
|
3680
3754
|
] });
|
|
3681
3755
|
}
|
|
3756
|
+
function PromptRefPicker({
|
|
3757
|
+
id,
|
|
3758
|
+
subject,
|
|
3759
|
+
name,
|
|
3760
|
+
label,
|
|
3761
|
+
prompts,
|
|
3762
|
+
promptsLoading,
|
|
3763
|
+
disabled,
|
|
3764
|
+
onChange
|
|
3765
|
+
}) {
|
|
3766
|
+
const known = prompts.find((entry) => entry.name === name);
|
|
3767
|
+
const unlisted = name !== "" && !known;
|
|
3768
|
+
const orphaned = unlisted && !promptsLoading;
|
|
3769
|
+
const labels = known?.labels.length ? known.labels : [DEFAULT_PROMPT_LABEL];
|
|
3770
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3771
|
+
/* @__PURE__ */ jsx("label", { htmlFor: id, className: "mb-1 block text-sm font-medium", children: "Prompt Langfuse" }),
|
|
3772
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-2 sm:grid-cols-2", children: [
|
|
3773
|
+
/* @__PURE__ */ jsx(
|
|
3774
|
+
Select,
|
|
3775
|
+
{
|
|
3776
|
+
"aria-label": `Prompt \u2014 ${subject}`,
|
|
3777
|
+
value: name,
|
|
3778
|
+
onValueChange: (next) => onChange(next, DEFAULT_PROMPT_LABEL),
|
|
3779
|
+
items: [
|
|
3780
|
+
...unlisted ? [{ value: name, label: orphaned ? `${name} \u2014 introuvable dans Langfuse` : name }] : [],
|
|
3781
|
+
...prompts.map((entry) => ({ value: entry.name, label: entry.name }))
|
|
3782
|
+
],
|
|
3783
|
+
disabled: disabled || promptsLoading
|
|
3784
|
+
}
|
|
3785
|
+
),
|
|
3786
|
+
/* @__PURE__ */ jsx(
|
|
3787
|
+
Select,
|
|
3788
|
+
{
|
|
3789
|
+
"aria-label": `Version du prompt \u2014 ${subject}`,
|
|
3790
|
+
value: labels.includes(label) ? label : "",
|
|
3791
|
+
onValueChange: (next) => onChange(name, next),
|
|
3792
|
+
items: labels.map((entry) => ({ value: entry, label: entry })),
|
|
3793
|
+
disabled: disabled || promptsLoading || name === ""
|
|
3794
|
+
}
|
|
3795
|
+
)
|
|
3796
|
+
] }),
|
|
3797
|
+
name === "" && !promptsLoading && /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-destructive", children: "Aucun prompt choisi \u2014 cette \xE9tape ne peut pas s'ex\xE9cuter tant qu'elle n'en d\xE9signe pas un." }),
|
|
3798
|
+
orphaned && /* @__PURE__ */ jsxs("p", { className: "mt-1 text-sm text-destructive", children: [
|
|
3799
|
+
"\xAB ",
|
|
3800
|
+
name,
|
|
3801
|
+
" \xBB n'est pas dans le catalogue de cette app \u2014 le prochain traitement \xE9chouera tant que ce prompt n'est pas r\xE9tabli ou remplac\xE9."
|
|
3802
|
+
] }),
|
|
3803
|
+
/* @__PURE__ */ jsxs("p", { className: "mt-1 text-xs text-muted-foreground", children: [
|
|
3804
|
+
"Le label suit les promotions faites dans Langfuse : promouvoir une nouvelle version sous \xAB",
|
|
3805
|
+
" ",
|
|
3806
|
+
label,
|
|
3807
|
+
" \xBB la met en service sans repasser ici."
|
|
3808
|
+
] })
|
|
3809
|
+
] });
|
|
3810
|
+
}
|
|
3682
3811
|
var PERCENT = 100;
|
|
3683
3812
|
function PipelineNodesForm({
|
|
3684
3813
|
value,
|
|
@@ -3947,51 +4076,19 @@ function StepPromptField({
|
|
|
3947
4076
|
if (stepUsesAgentPrompt(step.key)) {
|
|
3948
4077
|
return /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: step.key === "revise" ? "Cette \xE9tape relance l'agent qui r\xE9dige avec l'objection du relecteur \u2014 elle n'a pas de prompt \xE0 choisir." : "Le prompt de cette \xE9tape est celui de l'agent qui r\xE9dige \u2014 il se choisit sur la page Agents." });
|
|
3949
4078
|
}
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
value: name,
|
|
3964
|
-
onValueChange: (next) => onPatch(promptPatch(next, DEFAULT_PROMPT_LABEL)),
|
|
3965
|
-
items: [
|
|
3966
|
-
...unlisted ? [{ value: name, label: orphaned ? `${name} \u2014 introuvable dans Langfuse` : name }] : [],
|
|
3967
|
-
...prompts.map((entry) => ({ value: entry.name, label: entry.name }))
|
|
3968
|
-
],
|
|
3969
|
-
disabled: disabled || promptsLoading
|
|
3970
|
-
}
|
|
3971
|
-
),
|
|
3972
|
-
/* @__PURE__ */ jsx(
|
|
3973
|
-
Select,
|
|
3974
|
-
{
|
|
3975
|
-
"aria-label": `Version du prompt \u2014 ${step.label}`,
|
|
3976
|
-
value: labels.includes(label) ? label : "",
|
|
3977
|
-
onValueChange: (next) => onPatch(promptPatch(name, next)),
|
|
3978
|
-
items: labels.map((entry) => ({ value: entry, label: entry })),
|
|
3979
|
-
disabled: disabled || promptsLoading || name === ""
|
|
3980
|
-
}
|
|
3981
|
-
)
|
|
3982
|
-
] }),
|
|
3983
|
-
name === "" && !promptsLoading && /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-destructive", children: "Aucun prompt choisi \u2014 cette \xE9tape ne peut pas s'ex\xE9cuter tant qu'elle n'en d\xE9signe pas un." }),
|
|
3984
|
-
orphaned && /* @__PURE__ */ jsxs("p", { className: "mt-1 text-sm text-destructive", children: [
|
|
3985
|
-
"\xAB ",
|
|
3986
|
-
name,
|
|
3987
|
-
" \xBB n'est pas dans le catalogue de cette app \u2014 le prochain traitement \xE9chouera tant que ce prompt n'est pas r\xE9tabli ou remplac\xE9."
|
|
3988
|
-
] }),
|
|
3989
|
-
/* @__PURE__ */ jsxs("p", { className: "mt-1 text-xs text-muted-foreground", children: [
|
|
3990
|
-
"Le label suit les promotions faites dans Langfuse : promouvoir une nouvelle version sous \xAB ",
|
|
3991
|
-
label,
|
|
3992
|
-
" \xBB la met en service sans repasser ici."
|
|
3993
|
-
] })
|
|
3994
|
-
] });
|
|
4079
|
+
return /* @__PURE__ */ jsx(
|
|
4080
|
+
PromptRefPicker,
|
|
4081
|
+
{
|
|
4082
|
+
id,
|
|
4083
|
+
subject: step.label,
|
|
4084
|
+
name: stepPromptName(settings),
|
|
4085
|
+
label: stepPromptLabel(settings),
|
|
4086
|
+
prompts,
|
|
4087
|
+
promptsLoading,
|
|
4088
|
+
disabled,
|
|
4089
|
+
onChange: (name, label) => onPatch(promptPatch(name, label))
|
|
4090
|
+
}
|
|
4091
|
+
);
|
|
3995
4092
|
}
|
|
3996
4093
|
function useIds(stepKey) {
|
|
3997
4094
|
const base2 = useId();
|
|
@@ -4162,6 +4259,64 @@ function RecipeRow({ label, children }) {
|
|
|
4162
4259
|
/* @__PURE__ */ jsx("dd", { className: "break-all font-mono", children })
|
|
4163
4260
|
] });
|
|
4164
4261
|
}
|
|
4262
|
+
var ACTION_OPTIONS = [
|
|
4263
|
+
{ value: "disabled", label: "D\xE9sactiv\xE9 \u2014 r\xE9pondre \xE0 tous les messages" },
|
|
4264
|
+
{ value: "tag", label: "Poser un tag \u2014 un humain repasse via une vue Gorgias" },
|
|
4265
|
+
{ value: "close", label: "Fermer le ticket dans Gorgias, sans tag" }
|
|
4266
|
+
];
|
|
4267
|
+
function ConversationEndCard({
|
|
4268
|
+
form,
|
|
4269
|
+
set,
|
|
4270
|
+
canWrite,
|
|
4271
|
+
prompts,
|
|
4272
|
+
promptsLoading
|
|
4273
|
+
}) {
|
|
4274
|
+
const end = readConversationEnd(form);
|
|
4275
|
+
const tag = typeof form.conversationEndTag === "string" ? form.conversationEndTag : DEFAULT_CONVERSATION_END_TAG;
|
|
4276
|
+
return /* @__PURE__ */ jsx(Card, { id: "conversation-end", children: /* @__PURE__ */ jsxs(CardContent, { className: "space-y-3 p-4", children: [
|
|
4277
|
+
/* @__PURE__ */ jsx("h2", { className: "font-medium", children: "Fin de conversation" }),
|
|
4278
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Sur un message qui n\u2019appelle aucune r\xE9ponse (\xAB merci \xBB, \xE9moji seul, \xAB c\u2019est r\xE9gl\xE9 \xBB), premier message compris, l\u2019app n\u2019envoie jamais de r\xE9ponse : elle pose le tag ou ferme le ticket, et annule un brouillon rest\xE9 ouvert. Dans le doute l\u2019app r\xE9pond. Un ticket repris par un humain n\u2019est jamais touch\xE9." }),
|
|
4279
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4280
|
+
/* @__PURE__ */ jsx("label", { htmlFor: "conversationEndAction", className: "mb-1 block text-sm font-medium", children: "Action de fin de conversation" }),
|
|
4281
|
+
/* @__PURE__ */ jsx(
|
|
4282
|
+
Select,
|
|
4283
|
+
{
|
|
4284
|
+
"aria-label": "Action de fin de conversation",
|
|
4285
|
+
value: end.action,
|
|
4286
|
+
onValueChange: (value) => set("conversationEndAction", value),
|
|
4287
|
+
items: ACTION_OPTIONS,
|
|
4288
|
+
disabled: !canWrite
|
|
4289
|
+
}
|
|
4290
|
+
)
|
|
4291
|
+
] }),
|
|
4292
|
+
end.action === "tag" && /* @__PURE__ */ jsxs("div", { children: [
|
|
4293
|
+
/* @__PURE__ */ jsx("label", { htmlFor: "conversationEndTag", className: "mb-1 block text-sm font-medium", children: "Tag de fin de conversation" }),
|
|
4294
|
+
/* @__PURE__ */ jsx(
|
|
4295
|
+
Input,
|
|
4296
|
+
{
|
|
4297
|
+
id: "conversationEndTag",
|
|
4298
|
+
value: tag,
|
|
4299
|
+
onChange: (e) => set("conversationEndTag", e.target.value),
|
|
4300
|
+
disabled: !canWrite
|
|
4301
|
+
}
|
|
4302
|
+
),
|
|
4303
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: "Retir\xE9 automatiquement quand le client r\xE9\xE9crit avec une demande. Cr\xE9ez une vue Gorgias sur ce tag pour repasser sur ces tickets." })
|
|
4304
|
+
] }),
|
|
4305
|
+
end.action !== "disabled" && /* @__PURE__ */ jsx(
|
|
4306
|
+
PromptRefPicker,
|
|
4307
|
+
{
|
|
4308
|
+
id: "conversationEndPrompt",
|
|
4309
|
+
subject: "Fin de conversation",
|
|
4310
|
+
name: end.prompt?.name ?? "",
|
|
4311
|
+
label: end.prompt?.label ?? DEFAULT_PROMPT_LABEL,
|
|
4312
|
+
prompts,
|
|
4313
|
+
promptsLoading,
|
|
4314
|
+
disabled: !canWrite,
|
|
4315
|
+
onChange: (name, label) => set("conversationEndPrompt", { name, label })
|
|
4316
|
+
}
|
|
4317
|
+
)
|
|
4318
|
+
] }) });
|
|
4319
|
+
}
|
|
4165
4320
|
var WHATSAPP_MODE_LABELS = {
|
|
4166
4321
|
escalate_only: "Escalade uniquement",
|
|
4167
4322
|
draft_only: "Brouillon uniquement",
|
|
@@ -4488,6 +4643,16 @@ function SettingsPage() {
|
|
|
4488
4643
|
/* @__PURE__ */ jsx(SettingsWarnings, { warnings: tagWarnings })
|
|
4489
4644
|
] }) }),
|
|
4490
4645
|
/* @__PURE__ */ jsx(FollowupWebhookCard, {}),
|
|
4646
|
+
/* @__PURE__ */ jsx(
|
|
4647
|
+
ConversationEndCard,
|
|
4648
|
+
{
|
|
4649
|
+
form,
|
|
4650
|
+
set,
|
|
4651
|
+
canWrite,
|
|
4652
|
+
prompts: promptCatalogue.prompts,
|
|
4653
|
+
promptsLoading: promptCatalogue.isLoading
|
|
4654
|
+
}
|
|
4655
|
+
),
|
|
4491
4656
|
/* @__PURE__ */ jsx(Card, { id: "guardrails", children: /* @__PURE__ */ jsxs(CardContent, { className: "space-y-3 p-4", children: [
|
|
4492
4657
|
/* @__PURE__ */ jsx("h2", { className: "font-medium", children: "Garde-fous" }),
|
|
4493
4658
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
@@ -4696,11 +4861,6 @@ var NODE_EXITS = {
|
|
|
4696
4861
|
],
|
|
4697
4862
|
triage: [
|
|
4698
4863
|
{ key: "triage-fallback", condition: "classification de repli", outcome: "triaged_only" },
|
|
4699
|
-
{
|
|
4700
|
-
key: "triage-closed",
|
|
4701
|
-
condition: "le dernier message client cl\xF4t la conversation",
|
|
4702
|
-
outcome: "no_reply_needed"
|
|
4703
|
-
},
|
|
4704
4864
|
{
|
|
4705
4865
|
key: "triage-whatsapp-gate",
|
|
4706
4866
|
condition: "r\xE8gle de canal WhatsApp (STOP ou pas notre tour)",
|
|
@@ -6269,6 +6429,7 @@ function parseRunResult(result) {
|
|
|
6269
6429
|
};
|
|
6270
6430
|
}
|
|
6271
6431
|
function describeRunDecision(result, mode) {
|
|
6432
|
+
if (result.stoppedAt === "FC" && result.outcome === "no_reply_needed") return "Conversation finie \u2014 aucune r\xE9ponse.";
|
|
6272
6433
|
if (result.stoppedAt !== null) return `Arr\xEAt en ${result.stoppedAt}.`;
|
|
6273
6434
|
const category = result.categoryName ? ` (cat\xE9gorie \xAB ${result.categoryName} \xBB)` : "";
|
|
6274
6435
|
if (result.outcome === "sent") {
|