@apotech-os/support-kit 9.0.0 → 10.1.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 +43 -12
- package/dist/{chunk-MHRKUDEZ.js → chunk-KEPXRZ7R.js} +597 -52
- package/dist/chunk-KEPXRZ7R.js.map +1 -0
- package/dist/index.cjs +1495 -84
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -13
- package/dist/index.d.ts +15 -13
- package/dist/index.js +863 -37
- package/dist/index.js.map +1 -1
- package/dist/ui/index.cjs +267 -171
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.js +186 -527
- package/dist/ui/index.js.map +1 -1
- package/package.json +5 -5
- package/dist/chunk-MHRKUDEZ.js.map +0 -1
package/dist/ui/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EVALUATION_VERDICTS, WHATSAPP_MODES, validateSettings, settingsWarnings, SUPPORT_CHANNELS, AGENT_GUARDRAILS, toCategory,
|
|
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-KEPXRZ7R.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';
|
|
@@ -143,212 +143,6 @@ function formatDate(iso) {
|
|
|
143
143
|
function toNameMap(rows) {
|
|
144
144
|
return new Map(rows.map((r) => [r.id, r.name]));
|
|
145
145
|
}
|
|
146
|
-
|
|
147
|
-
// src/ui/dashboard/dashboard-stats.ts
|
|
148
|
-
function sumCounts(rows, countField = "count") {
|
|
149
|
-
return rows.reduce((sum, row) => sum + (Number(row[countField]) || 0), 0);
|
|
150
|
-
}
|
|
151
|
-
function bucketDay(row) {
|
|
152
|
-
return String(row["bucket"]).slice(0, 10);
|
|
153
|
-
}
|
|
154
|
-
var EMPTY_TOTALS = {
|
|
155
|
-
auto: 0,
|
|
156
|
-
human: 0,
|
|
157
|
-
inProgress: 0,
|
|
158
|
-
noReplyNeeded: 0
|
|
159
|
-
};
|
|
160
|
-
function countFailed(rows) {
|
|
161
|
-
return sumCounts(rows.filter((row) => row["status"] === "failed"));
|
|
162
|
-
}
|
|
163
|
-
var HUMAN_OUTCOMES = /* @__PURE__ */ new Set(["needs_human", "guardrail_hold", "escalated", "awaiting_approval"]);
|
|
164
|
-
function isUnautomatedTriage(row) {
|
|
165
|
-
return row["escalated"] === "true" || row["status"] === "error";
|
|
166
|
-
}
|
|
167
|
-
function outcomeOf(row) {
|
|
168
|
-
const status = row["status"];
|
|
169
|
-
const autoSendDecision = row["autoSendDecision"];
|
|
170
|
-
if (status === "test_draft" || status === "superseded") return null;
|
|
171
|
-
if (status === "sent") return "auto";
|
|
172
|
-
if (status === "no_reply_needed") return "noReplyNeeded";
|
|
173
|
-
if (status === "failed") return "human";
|
|
174
|
-
if (status === "invalidated" || status === "expired") return "human";
|
|
175
|
-
const outcome = row["outcome"];
|
|
176
|
-
if (typeof outcome === "string" && HUMAN_OUTCOMES.has(outcome)) return "human";
|
|
177
|
-
if (outcome === "no_reply_needed") return "noReplyNeeded";
|
|
178
|
-
if (outcome === "triaged_only") return null;
|
|
179
|
-
return autoSendDecision === "hold" ? "human" : "inProgress";
|
|
180
|
-
}
|
|
181
|
-
function foldOutcomes(rows, triageRows = []) {
|
|
182
|
-
const totals = { ...EMPTY_TOTALS };
|
|
183
|
-
for (const row of rows) {
|
|
184
|
-
const outcome = outcomeOf(row);
|
|
185
|
-
if (outcome !== null) totals[outcome] += Number(row["count"]) || 0;
|
|
186
|
-
}
|
|
187
|
-
for (const row of triageRows) {
|
|
188
|
-
if (isUnautomatedTriage(row)) totals.human += Number(row["count"]) || 0;
|
|
189
|
-
}
|
|
190
|
-
return totals;
|
|
191
|
-
}
|
|
192
|
-
function settledCount(totals) {
|
|
193
|
-
return totals.auto + totals.human;
|
|
194
|
-
}
|
|
195
|
-
function autonomyRate(totals) {
|
|
196
|
-
const settled = settledCount(totals);
|
|
197
|
-
return settled > 0 ? totals.auto / settled : Number.NaN;
|
|
198
|
-
}
|
|
199
|
-
function foldDailyOutcomes(rows, triageRows = []) {
|
|
200
|
-
const byDay = /* @__PURE__ */ new Map();
|
|
201
|
-
const totalsFor = (day) => {
|
|
202
|
-
const existing = byDay.get(day);
|
|
203
|
-
if (existing !== void 0) return existing;
|
|
204
|
-
const fresh = { ...EMPTY_TOTALS };
|
|
205
|
-
byDay.set(day, fresh);
|
|
206
|
-
return fresh;
|
|
207
|
-
};
|
|
208
|
-
for (const row of rows) {
|
|
209
|
-
const outcome = outcomeOf(row);
|
|
210
|
-
if (outcome === null) continue;
|
|
211
|
-
totalsFor(bucketDay(row))[outcome] += Number(row["count"]) || 0;
|
|
212
|
-
}
|
|
213
|
-
for (const row of triageRows) {
|
|
214
|
-
if (isUnautomatedTriage(row)) totalsFor(bucketDay(row)).human += Number(row["count"]) || 0;
|
|
215
|
-
}
|
|
216
|
-
return [...byDay.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([day, totals]) => ({
|
|
217
|
-
day,
|
|
218
|
-
auto: totals.auto,
|
|
219
|
-
human: totals.human,
|
|
220
|
-
rate: settledCount(totals) > 0 ? autonomyRate(totals) : null
|
|
221
|
-
}));
|
|
222
|
-
}
|
|
223
|
-
function fillMissingDays(series, fromIso, toIso) {
|
|
224
|
-
const from = Date.parse(fromIso.slice(0, 10));
|
|
225
|
-
const to = Date.parse(toIso.slice(0, 10));
|
|
226
|
-
if (Number.isNaN(from) || Number.isNaN(to) || to < from) return series;
|
|
227
|
-
const measured = new Map(series.map((point) => [point.day, point]));
|
|
228
|
-
const filled = [];
|
|
229
|
-
for (let t = from; t <= to; t += 864e5) {
|
|
230
|
-
const day = new Date(t).toISOString().slice(0, 10);
|
|
231
|
-
filled.push(measured.get(day) ?? { day, auto: 0, human: 0, rate: null });
|
|
232
|
-
}
|
|
233
|
-
return filled;
|
|
234
|
-
}
|
|
235
|
-
function ratePoints(rate, compareRate) {
|
|
236
|
-
return Number.isNaN(rate) || Number.isNaN(compareRate) ? null : (rate - compareRate) * 100;
|
|
237
|
-
}
|
|
238
|
-
var SIGNAL_MIN_VOLUME = 20;
|
|
239
|
-
var SIGNAL_MIN_POINTS = 3;
|
|
240
|
-
function dashboardSignals(totals, compare, failed = 0) {
|
|
241
|
-
const signals = [];
|
|
242
|
-
const settled = settledCount(totals);
|
|
243
|
-
const rate = autonomyRate(totals);
|
|
244
|
-
if (compare !== null && settled >= SIGNAL_MIN_VOLUME && settledCount(compare) >= SIGNAL_MIN_VOLUME) {
|
|
245
|
-
const points = ratePoints(rate, autonomyRate(compare));
|
|
246
|
-
if (points !== null && Math.abs(points) >= SIGNAL_MIN_POINTS) {
|
|
247
|
-
const move = points < 0 ? "recule" : "progresse";
|
|
248
|
-
signals.push({
|
|
249
|
-
level: points < 0 ? "creuser" : "info",
|
|
250
|
-
text: `Le taux d\u2019autonomie ${move} de ${Math.abs(Math.round(points))} points par rapport \xE0 la p\xE9riode pr\xE9c\xE9dente.`
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
if (failed > 0) {
|
|
255
|
-
signals.push({
|
|
256
|
-
level: "creuser",
|
|
257
|
-
text: `${failed} g\xE9n\xE9ration${failed > 1 ? "s ont" : " a"} \xE9chou\xE9 techniquement : ${failed > 1 ? "ces demandes n\u2019ont" : "cette demande n\u2019a"} jamais eu de brouillon et ${failed > 1 ? "sont retomb\xE9es" : "est retomb\xE9e"} sur un humain.`
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
if (totals.inProgress > 0) {
|
|
261
|
-
signals.push({
|
|
262
|
-
level: "info",
|
|
263
|
-
text: `${totals.inProgress} r\xE9ponse${totals.inProgress > 1 ? "s sont" : " est"} encore en cours : ${totals.inProgress > 1 ? "elles ne comptent" : "elle ne compte"} dans aucun des deux camps.`
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
if (totals.noReplyNeeded > 0) {
|
|
267
|
-
signals.push({
|
|
268
|
-
level: "info",
|
|
269
|
-
text: `${totals.noReplyNeeded} demande${totals.noReplyNeeded > 1 ? "s" : ""} ne n\xE9cessitai${totals.noReplyNeeded > 1 ? "ent" : "t"} aucune r\xE9ponse : hors du taux d\u2019autonomie.`
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
if (compare !== null && settled > 0 && settledCount(compare) < SIGNAL_MIN_VOLUME) {
|
|
273
|
-
signals.push({
|
|
274
|
-
level: "info",
|
|
275
|
-
text: "La p\xE9riode pr\xE9c\xE9dente compte trop peu de demandes r\xE9gl\xE9es pour que la comparaison veuille dire quelque chose."
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
return signals;
|
|
279
|
-
}
|
|
280
|
-
function foldHumanReasons(rows, triageRows = []) {
|
|
281
|
-
const reasons = { blocked: 0, invalidated: 0, expired: 0, escalatedNoDraft: 0, failed: 0 };
|
|
282
|
-
for (const row of rows) {
|
|
283
|
-
if (outcomeOf(row) !== "human") continue;
|
|
284
|
-
const count = Number(row["count"]) || 0;
|
|
285
|
-
if (row["status"] === "invalidated") reasons.invalidated += count;
|
|
286
|
-
else if (row["status"] === "expired") reasons.expired += count;
|
|
287
|
-
else if (row["status"] === "failed") reasons.failed += count;
|
|
288
|
-
else reasons.blocked += count;
|
|
289
|
-
}
|
|
290
|
-
for (const row of triageRows) {
|
|
291
|
-
if (isUnautomatedTriage(row)) reasons.escalatedNoDraft += Number(row["count"]) || 0;
|
|
292
|
-
}
|
|
293
|
-
return reasons;
|
|
294
|
-
}
|
|
295
|
-
var CATEGORY_TOP_N = 10;
|
|
296
|
-
function foldCategoryOutcomes(triageRows, responseRows, categoryNames, topN = CATEGORY_TOP_N) {
|
|
297
|
-
const byId = /* @__PURE__ */ new Map();
|
|
298
|
-
const barFor = (id) => {
|
|
299
|
-
const name = typeof id === "string" ? categoryNames.get(id) : void 0;
|
|
300
|
-
if (name === void 0) return null;
|
|
301
|
-
const existing = byId.get(id);
|
|
302
|
-
if (existing !== void 0) return existing;
|
|
303
|
-
const bar = {
|
|
304
|
-
label: name,
|
|
305
|
-
total: 0,
|
|
306
|
-
auto: 0,
|
|
307
|
-
human: 0,
|
|
308
|
-
noReply: 0,
|
|
309
|
-
undrafted: 0
|
|
310
|
-
};
|
|
311
|
-
byId.set(id, bar);
|
|
312
|
-
return bar;
|
|
313
|
-
};
|
|
314
|
-
for (const row of triageRows) {
|
|
315
|
-
const bar = barFor(row["categoryId"]);
|
|
316
|
-
if (bar === null) continue;
|
|
317
|
-
const count = Number(row["count"]) || 0;
|
|
318
|
-
bar.total += count;
|
|
319
|
-
if (isUnautomatedTriage(row)) bar.human += count;
|
|
320
|
-
}
|
|
321
|
-
for (const row of responseRows) {
|
|
322
|
-
const bar = barFor(row["categoryId"]);
|
|
323
|
-
if (bar === null) continue;
|
|
324
|
-
const outcome = outcomeOf(row);
|
|
325
|
-
const count = Number(row["count"]) || 0;
|
|
326
|
-
if (outcome === "auto") bar.auto += count;
|
|
327
|
-
else if (outcome === "human") bar.human += count;
|
|
328
|
-
else if (outcome === "noReplyNeeded") bar.noReply += count;
|
|
329
|
-
}
|
|
330
|
-
const bars = [...byId.values()].map((bar) => {
|
|
331
|
-
const accounted = bar.auto + bar.human + bar.noReply;
|
|
332
|
-
return {
|
|
333
|
-
...bar,
|
|
334
|
-
total: Math.max(bar.total, accounted),
|
|
335
|
-
undrafted: Math.max(0, bar.total - accounted)
|
|
336
|
-
};
|
|
337
|
-
}).filter((bar) => bar.total > 0).sort((a, b) => b.total - a.total);
|
|
338
|
-
if (bars.length <= topN + 1) return bars;
|
|
339
|
-
const tail = bars.slice(topN).reduce(
|
|
340
|
-
(sum, bar) => ({
|
|
341
|
-
label: "Autres",
|
|
342
|
-
total: sum.total + bar.total,
|
|
343
|
-
auto: sum.auto + bar.auto,
|
|
344
|
-
human: sum.human + bar.human,
|
|
345
|
-
noReply: sum.noReply + bar.noReply,
|
|
346
|
-
undrafted: sum.undrafted + bar.undrafted
|
|
347
|
-
}),
|
|
348
|
-
{ label: "Autres", total: 0, auto: 0, human: 0, noReply: 0, undrafted: 0 }
|
|
349
|
-
);
|
|
350
|
-
return [...bars.slice(0, topN), tail];
|
|
351
|
-
}
|
|
352
146
|
var POINTS_FORMAT = new Intl.NumberFormat("fr-FR", {
|
|
353
147
|
maximumFractionDigits: 1,
|
|
354
148
|
signDisplay: "exceptZero"
|
|
@@ -419,34 +213,12 @@ var DASHBOARD_PRESETS = [
|
|
|
419
213
|
{ key: "last7", label: "7 derniers jours" },
|
|
420
214
|
{ key: "last30", label: "30 derniers jours" }
|
|
421
215
|
];
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
}
|
|
428
|
-
function endOfDayIso(day) {
|
|
429
|
-
return DAY_PATTERN.test(day) ? `${day}T23:59:59.999Z` : (/* @__PURE__ */ new Date()).toISOString();
|
|
430
|
-
}
|
|
431
|
-
function dayCount(bounds) {
|
|
432
|
-
const from = Date.parse(bounds.fromIso);
|
|
433
|
-
const to = Date.parse(bounds.toIso);
|
|
434
|
-
if (Number.isNaN(from) || Number.isNaN(to)) return 0;
|
|
435
|
-
return Math.max(1, Math.round((to - from) / 864e5));
|
|
436
|
-
}
|
|
437
|
-
function periodBoundsOf(value) {
|
|
438
|
-
const current = {
|
|
439
|
-
fromIso: startOfDayIso(value.range.from),
|
|
440
|
-
toIso: endOfDayIso(value.range.to)
|
|
441
|
-
};
|
|
442
|
-
const compare = value.compare === "none" ? void 0 : value.compareRange ?? comparisonRange(value.preset, value.range, value.compare);
|
|
443
|
-
const days = dayCount(current);
|
|
444
|
-
return {
|
|
445
|
-
current,
|
|
446
|
-
previous: compare === void 0 ? null : { fromIso: startOfDayIso(compare.from), toIso: endOfDayIso(compare.to) },
|
|
447
|
-
days,
|
|
448
|
-
interval: days >= WEEKLY_BUCKET_FROM_DAYS ? "week" : "day"
|
|
449
|
-
};
|
|
216
|
+
function periodBoundsOf2(value) {
|
|
217
|
+
const compareRange = value.compare === "none" ? void 0 : value.compareRange ?? comparisonRange(value.preset, value.range, value.compare);
|
|
218
|
+
return periodBoundsOf({
|
|
219
|
+
range: value.range,
|
|
220
|
+
...compareRange === void 0 ? {} : { compareRange }
|
|
221
|
+
});
|
|
450
222
|
}
|
|
451
223
|
function defaultPeriod(today = /* @__PURE__ */ new Date()) {
|
|
452
224
|
const to = today.toISOString().slice(0, 10);
|
|
@@ -508,11 +280,6 @@ function StackedLegend({ segments }) {
|
|
|
508
280
|
segment.label
|
|
509
281
|
] }, segment.key)) });
|
|
510
282
|
}
|
|
511
|
-
var OUTCOME_METRICS = [{ op: "count", as: "count" }];
|
|
512
|
-
var OUTCOME_GROUP_BY = ["status", "autoSendDecision", "outcome"];
|
|
513
|
-
var CATEGORY_OUTCOME_GROUP_BY = ["categoryId", "status", "autoSendDecision", "outcome"];
|
|
514
|
-
var TRIAGE_HANDOFF_GROUP_BY = ["escalated", "status"];
|
|
515
|
-
var CATEGORY_TRIAGE_GROUP_BY = ["categoryId", "escalated", "status"];
|
|
516
283
|
var CATEGORY_COLORS = {
|
|
517
284
|
auto: "var(--chart-1)",
|
|
518
285
|
human: "var(--chart-2)",
|
|
@@ -538,7 +305,7 @@ function DashboardPage() {
|
|
|
538
305
|
const { settings } = useAppSettings();
|
|
539
306
|
const timezone = settings?.statsTimezone ?? "UTC";
|
|
540
307
|
const periodKey = JSON.stringify(period);
|
|
541
|
-
const bounds = useMemo(() =>
|
|
308
|
+
const bounds = useMemo(() => periodBoundsOf2(JSON.parse(periodKey)), [periodKey]);
|
|
542
309
|
const currentFilter = { generatedAt: { gte: bounds.current.fromIso, lte: bounds.current.toIso } };
|
|
543
310
|
const previousBounds = bounds.previous ?? bounds.current;
|
|
544
311
|
const {
|
|
@@ -873,6 +640,7 @@ function idempotencyKeyFor(operation, payload) {
|
|
|
873
640
|
// src/ui/shared/settings-issue-labels.ts
|
|
874
641
|
var SETTINGS_ISSUE_LABELS = {
|
|
875
642
|
sourceViewId: "Vue Gorgias source requise \u2014 choisissez la vue que cette app poss\xE8de.",
|
|
643
|
+
appScopeTag: "Tag des tickets de l'application requis \u2014 c'est lui qui rattache un ticket \xE0 cette app.",
|
|
876
644
|
nodes: "nodes.triage doit \xEAtre configur\xE9 \u2014 une \xE9tape de triage \xE0 null ne triagerait rien.",
|
|
877
645
|
nodePrompt: "Chaque \xE9tape active doit d\xE9signer un prompt Langfuse \u2014 sans prompt, l'\xE9tape n'a rien \xE0 dire au mod\xE8le.",
|
|
878
646
|
senderEmail: "Adresse d'envoi requise quand l'envoi automatique est actif (sauf en mode WhatsApp \xAB auto_reply \xBB)."
|
|
@@ -893,6 +661,7 @@ var EXACT_MESSAGE_LABELS = {
|
|
|
893
661
|
};
|
|
894
662
|
var SETTINGS_VALIDATION_MESSAGE_LABELS = {
|
|
895
663
|
"sourceViewId is required \u2014 pick the Gorgias view this app owns.": SETTINGS_ISSUE_LABELS.sourceViewId,
|
|
664
|
+
"appScopeTag is required \u2014 set the tag that marks this app's tickets.": SETTINGS_ISSUE_LABELS.appScopeTag,
|
|
896
665
|
"nodes.triage must be configured \u2014 a null triage step would triage nothing.": SETTINGS_ISSUE_LABELS.nodes,
|
|
897
666
|
"senderEmail is required when autoSendEnabled is on, unless whatsappMode is 'auto_reply'.": SETTINGS_ISSUE_LABELS.senderEmail
|
|
898
667
|
};
|
|
@@ -1258,29 +1027,6 @@ function responseOutcome(job) {
|
|
|
1258
1027
|
return { label, variant: "neutral" };
|
|
1259
1028
|
}
|
|
1260
1029
|
|
|
1261
|
-
// src/ui/tickets/delivery-policy.ts
|
|
1262
|
-
function evaluateNode(settings) {
|
|
1263
|
-
const node = settings.nodes?.evaluate;
|
|
1264
|
-
return node && typeof node === "object" ? node : null;
|
|
1265
|
-
}
|
|
1266
|
-
function toDeliveryPolicy(raw) {
|
|
1267
|
-
if (!raw || typeof raw !== "object") return null;
|
|
1268
|
-
const settings = raw;
|
|
1269
|
-
const evaluate = evaluateNode(settings);
|
|
1270
|
-
const senderEmail = typeof settings.senderEmail === "string" ? settings.senderEmail : "";
|
|
1271
|
-
return {
|
|
1272
|
-
followupSendable: typeof evaluate?.escalationEnabled === "boolean" ? evaluate.escalationEnabled : DEFAULT_ESCALATION_ENABLED,
|
|
1273
|
-
minConfidence: typeof evaluate?.minConfidence === "number" ? evaluate.minConfidence : DEFAULT_MIN_CONFIDENCE,
|
|
1274
|
-
evaluateConfigured: evaluate !== null,
|
|
1275
|
-
autoSendEnabled: settings.autoSendEnabled === true,
|
|
1276
|
-
senderEmail: senderEmail === "" ? null : senderEmail,
|
|
1277
|
-
whatsappMode: typeof settings.whatsappMode === "string" ? settings.whatsappMode : null,
|
|
1278
|
-
autoSendChannels: Array.isArray(settings.autoSendChannels) ? settings.autoSendChannels : [...DEFAULT_AUTO_SEND_CHANNELS],
|
|
1279
|
-
dryRun: settings.dryRun === true,
|
|
1280
|
-
audit: toAuditTags(settings)
|
|
1281
|
-
};
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
1030
|
// src/ui/tickets/match.ts
|
|
1285
1031
|
function tokensFor(row) {
|
|
1286
1032
|
return row.diff ?? computeWordDiff(row.generatedText, row.sentText);
|
|
@@ -1454,175 +1200,116 @@ var TITLES = {
|
|
|
1454
1200
|
correction: "Corrig\xE9 par un humain"
|
|
1455
1201
|
};
|
|
1456
1202
|
function buildTimeline(input) {
|
|
1457
|
-
return
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
];
|
|
1466
|
-
}
|
|
1467
|
-
function step(key, reason2) {
|
|
1468
|
-
return reason2 === null ? { key, title: TITLES[key], reached: true } : { key, title: TITLES[key], reached: false, reason: reason2 };
|
|
1469
|
-
}
|
|
1470
|
-
function receivedReason({ conversation, conversationLoading }) {
|
|
1471
|
-
if (conversation) return null;
|
|
1472
|
-
if (conversationLoading) return "Lecture de la conversation en cours\u2026";
|
|
1473
|
-
return "Aucune conversation disponible : rien n'a \xE9t\xE9 captur\xE9 au moment du run, et le fil n'a pas pu \xEAtre relu chez Gorgias.";
|
|
1474
|
-
}
|
|
1475
|
-
function promptReason({ conversation, job, decision }) {
|
|
1476
|
-
if (!job) return noResponseCause(decision);
|
|
1477
|
-
if (conversation?.systemPrompt) return null;
|
|
1478
|
-
return "Le prompt rendu n'a pas \xE9t\xE9 captur\xE9 sur cette r\xE9ponse \u2014 les r\xE9ponses \xE9crites avant cette capture n'en gardent que le nom et la version.";
|
|
1479
|
-
}
|
|
1480
|
-
function triageReason({ decision }) {
|
|
1481
|
-
if (decision.status === "error" && !decision.tag) {
|
|
1482
|
-
return decision.error ?? "Le triage a \xE9chou\xE9 sans produire de classification.";
|
|
1483
|
-
}
|
|
1484
|
-
return null;
|
|
1203
|
+
return buildTimelineSteps(input).map(
|
|
1204
|
+
(state) => state.reached ? { key: state.key, title: TITLES[state.key], reached: true } : {
|
|
1205
|
+
key: state.key,
|
|
1206
|
+
title: TITLES[state.key],
|
|
1207
|
+
reached: false,
|
|
1208
|
+
reason: describeReason(state.reason)
|
|
1209
|
+
}
|
|
1210
|
+
);
|
|
1485
1211
|
}
|
|
1486
|
-
function
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
case "
|
|
1503
|
-
return
|
|
1504
|
-
case "
|
|
1212
|
+
function describeReason(reason2) {
|
|
1213
|
+
switch (reason2.code) {
|
|
1214
|
+
case "conversation_loading":
|
|
1215
|
+
return "Lecture de la conversation en cours\u2026";
|
|
1216
|
+
case "conversation_unavailable":
|
|
1217
|
+
return "Aucune conversation disponible : rien n'a \xE9t\xE9 captur\xE9 au moment du run, et le fil n'a pas pu \xEAtre relu chez Gorgias.";
|
|
1218
|
+
case "ticket_escalated":
|
|
1219
|
+
return "Ticket escalad\xE9 \xE0 un humain \u2014 le graphe ne r\xE9dige pas.";
|
|
1220
|
+
case "conversation_over":
|
|
1221
|
+
return "Conversation consid\xE9r\xE9e close \u2014 rien \xE0 r\xE9pondre.";
|
|
1222
|
+
case "triage_error":
|
|
1223
|
+
return reason2.error ?? "Le triage a \xE9chou\xE9.";
|
|
1224
|
+
case "category_not_drafting":
|
|
1225
|
+
return "La cat\xE9gorie n'a pas la r\xE9ponse rapide activ\xE9e, ou n'a pas d'agent r\xE9dacteur.";
|
|
1226
|
+
case "triage_failed":
|
|
1227
|
+
return reason2.error ?? "Le triage a \xE9chou\xE9 sans produire de classification.";
|
|
1228
|
+
case "prompt_not_captured":
|
|
1229
|
+
return "Le prompt rendu n'a pas \xE9t\xE9 captur\xE9 sur cette r\xE9ponse \u2014 les r\xE9ponses \xE9crites avant cette capture n'en gardent que le nom et la version.";
|
|
1230
|
+
case "draft_pending":
|
|
1231
|
+
return "La r\xE9daction n'a pas encore tourn\xE9.";
|
|
1232
|
+
case "draft_empty":
|
|
1233
|
+
return reason2.error ?? "La r\xE9daction n'a produit aucun texte.";
|
|
1234
|
+
case "evaluation_pending":
|
|
1235
|
+
return "L'\xE9valuation n'a pas encore tourn\xE9.";
|
|
1236
|
+
case "evaluation_missing":
|
|
1237
|
+
return "Aucun verdict : l'\xE9valuation n'a pas \xE9t\xE9 atteinte.";
|
|
1238
|
+
case "reply_queued":
|
|
1505
1239
|
return "La r\xE9ponse est encore en file.";
|
|
1506
|
-
case "
|
|
1507
|
-
return
|
|
1508
|
-
case "
|
|
1509
|
-
|
|
1510
|
-
return why === GENERIC_NOT_SENT ? "La r\xE9ponse a expir\xE9 avant son envoi." : `La r\xE9ponse a expir\xE9 avant son envoi. ${why}`;
|
|
1511
|
-
}
|
|
1512
|
-
case "failed":
|
|
1513
|
-
return job.error ?? "La r\xE9ponse a \xE9chou\xE9 avant son envoi.";
|
|
1240
|
+
case "expired":
|
|
1241
|
+
return reason2.detail === null ? "La r\xE9ponse a expir\xE9 avant son envoi." : `La r\xE9ponse a expir\xE9 avant son envoi. ${describeNotSent(reason2.detail)}`;
|
|
1242
|
+
case "delivery_failed":
|
|
1243
|
+
return reason2.error ?? "La r\xE9ponse a \xE9chou\xE9 avant son envoi.";
|
|
1514
1244
|
case "superseded":
|
|
1515
1245
|
return "Le client a \xE9crit \xE0 nouveau avant l\u2019envoi : une r\xE9ponse plus r\xE9cente a remplac\xE9 celle-ci.";
|
|
1516
1246
|
case "test_draft":
|
|
1517
1247
|
return "Brouillon d'essai \u2014 jamais envoy\xE9.";
|
|
1248
|
+
case "unexpected_status":
|
|
1249
|
+
return `La r\xE9ponse n'a pas \xE9t\xE9 envoy\xE9e (statut : ${reason2.status}).`;
|
|
1250
|
+
case "no_correction":
|
|
1251
|
+
return "Aucune correction captur\xE9e : l'agent n'a pas r\xE9\xE9crit de r\xE9ponse sur ce ticket.";
|
|
1518
1252
|
default:
|
|
1519
|
-
return
|
|
1520
|
-
}
|
|
1521
|
-
}
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
case "
|
|
1531
|
-
return
|
|
1532
|
-
case "guardrail_hold":
|
|
1533
|
-
return guardrailReason(job);
|
|
1253
|
+
return describeNotSent(reason2);
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
function describeNotSent(reason2) {
|
|
1257
|
+
switch (reason2.code) {
|
|
1258
|
+
case "generic_not_sent":
|
|
1259
|
+
return "R\xE9dig\xE9e, en attente d'un envoi.";
|
|
1260
|
+
case "held_permanently":
|
|
1261
|
+
return "Mise en attente d\xE9finitive : cette r\xE9ponse ne repartira pas toute seule (refus d\u2019approbation, contr\xF4le de derni\xE8re minute, ou envoi interrompu puis repris).";
|
|
1262
|
+
case "guardrail_unrecorded":
|
|
1263
|
+
return "Un garde-fou a bloqu\xE9 l\u2019envoi (r\xE9ponse ant\xE9rieure \xE0 l\u2019enregistrement du motif).";
|
|
1264
|
+
case "guardrail":
|
|
1265
|
+
return describeGuardrail(reason2.hits, reason2.reconstructed);
|
|
1534
1266
|
case "awaiting_approval":
|
|
1535
1267
|
return "En attente d'une approbation humaine avant envoi.";
|
|
1536
|
-
case "
|
|
1537
|
-
return notEligibleReason(job, policy, category);
|
|
1538
|
-
case "sent":
|
|
1268
|
+
case "trial_mode":
|
|
1539
1269
|
return "Mode essai : la r\xE9ponse aurait \xE9t\xE9 envoy\xE9e, mais rien n'a \xE9t\xE9 transmis au client.";
|
|
1540
|
-
case
|
|
1541
|
-
return
|
|
1542
|
-
|
|
1543
|
-
return
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
}
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
if (isWhatsapp && policy.whatsappMode === "draft_only") {
|
|
1571
|
-
return "Mode WhatsApp \xAB brouillon seul \xBB : la r\xE9ponse est r\xE9dig\xE9e, jamais envoy\xE9e automatiquement.";
|
|
1572
|
-
}
|
|
1573
|
-
if (job.ineligibleReason === "no_publication_path") {
|
|
1574
|
-
const channel = job.sourceChannel ? ` ${channelLabel(job.sourceChannel)}` : "";
|
|
1575
|
-
return `Aucun moyen de publier une r\xE9ponse sur ce ticket : Gorgias ne d\xE9clare pas le canal${channel} r\xE9pondable, ou le contact n'a pas l'adresse que ce canal exige. Le brouillon reste disponible pour un agent.`;
|
|
1576
|
-
}
|
|
1577
|
-
if (isRestrictedChannel(job.sourceChannel, policy.autoSendChannels)) {
|
|
1578
|
-
return `L'envoi automatique n'est pas activ\xE9 pour le canal ${channelLabel(job.sourceChannel ?? "")}. Le brouillon reste disponible pour un agent.`;
|
|
1579
|
-
}
|
|
1580
|
-
if (!policy.senderEmail && !isWhatsapp) {
|
|
1581
|
-
return "Aucune adresse d'exp\xE9dition n'est configur\xE9e dans les r\xE9glages.";
|
|
1270
|
+
case "no_verdict":
|
|
1271
|
+
return "L'\xE9valuation n'a produit aucun verdict \u2014 par s\xE9curit\xE9, la r\xE9ponse part en revue humaine.";
|
|
1272
|
+
case "evaluation_failed":
|
|
1273
|
+
return "L'\xE9valuation a \xE9chou\xE9 \u2014 par s\xE9curit\xE9, la r\xE9ponse part en revue humaine.";
|
|
1274
|
+
case "judge_held":
|
|
1275
|
+
return "Le juge a retenu la r\xE9ponse (verdict \xAB Retenir \xBB) \u2014 elle demande une relecture.";
|
|
1276
|
+
case "judge_not_authorized":
|
|
1277
|
+
return "Le juge n'a pas autoris\xE9 l'envoi automatique.";
|
|
1278
|
+
case "below_confidence":
|
|
1279
|
+
return `Confiance de ${asPercent(reason2.confidence)} %, sous le seuil de ${asPercent(reason2.minConfidence)} % fix\xE9 sur l'\xE9tape \xC9valuation.`;
|
|
1280
|
+
case "followup_not_sendable":
|
|
1281
|
+
return "Le juge a valid\xE9 la r\xE9ponse mais demand\xE9 un suivi humain (verdict \xAB Envoyer et escalader \xBB). L'option \xAB Envoyer les r\xE9ponses qui demandent un suivi humain \xBB est d\xE9sactiv\xE9e sur l'\xE9tape \xC9valuation : la r\xE9ponse n'est donc pas envoy\xE9e.";
|
|
1282
|
+
case "legacy_followup_probable":
|
|
1283
|
+
return "Probablement : le juge a valid\xE9 la r\xE9ponse en demandant un suivi humain, et l'option \xAB Envoyer les r\xE9ponses qui demandent un suivi humain \xBB est d\xE9sactiv\xE9e sur l'\xE9tape \xC9valuation. (R\xE9ponse ant\xE9rieure \xE0 l'enregistrement des sorties de run \u2014 lecture faite avec les r\xE9glages actuels.)";
|
|
1284
|
+
case "evaluation_disabled":
|
|
1285
|
+
return "L'\xE9tape \xC9valuation est coup\xE9e : sans verdict, l'envoi automatique est impossible.";
|
|
1286
|
+
case "auto_send_disabled":
|
|
1287
|
+
return "L'envoi automatique est d\xE9sactiv\xE9 dans les r\xE9glages.";
|
|
1288
|
+
case "category_auto_reply_off":
|
|
1289
|
+
return `La cat\xE9gorie \xAB ${reason2.categoryName} \xBB n'a pas l'auto-r\xE9ponse activ\xE9e.`;
|
|
1290
|
+
case "whatsapp_draft_only":
|
|
1291
|
+
return "Mode WhatsApp \xAB brouillon seul \xBB : la r\xE9ponse est r\xE9dig\xE9e, jamais envoy\xE9e automatiquement.";
|
|
1292
|
+
case "no_publication_path": {
|
|
1293
|
+
const channel = reason2.channel ? ` ${channelLabel(reason2.channel)}` : "";
|
|
1294
|
+
return `Aucun moyen de publier une r\xE9ponse sur ce ticket : Gorgias ne d\xE9clare pas le canal${channel} r\xE9pondable, ou le contact n'a pas l'adresse que ce canal exige. Le brouillon reste disponible pour un agent.`;
|
|
1295
|
+
}
|
|
1296
|
+
case "channel_not_enabled":
|
|
1297
|
+
return `L'envoi automatique n'est pas activ\xE9 pour le canal ${channelLabel(reason2.channel ?? "")}. Le brouillon reste disponible pour un agent.`;
|
|
1298
|
+
case "no_sender_address":
|
|
1299
|
+
return "Aucune adresse d'exp\xE9dition n'est configur\xE9e dans les r\xE9glages.";
|
|
1582
1300
|
}
|
|
1583
|
-
return GENERIC_NOT_SENT;
|
|
1584
|
-
}
|
|
1585
|
-
function isRestrictedChannel(sourceChannel, allowed) {
|
|
1586
|
-
if (!sourceChannel) return false;
|
|
1587
|
-
if (!SUPPORT_CHANNELS.includes(sourceChannel)) return false;
|
|
1588
|
-
return !allowed.includes(sourceChannel);
|
|
1589
1301
|
}
|
|
1590
|
-
function
|
|
1591
|
-
const [first, ...rest] =
|
|
1592
|
-
if (first === void 0) {
|
|
1593
|
-
return "Un garde-fou a bloqu\xE9 l\u2019envoi (r\xE9ponse ant\xE9rieure \xE0 l\u2019enregistrement du motif).";
|
|
1594
|
-
}
|
|
1302
|
+
function describeGuardrail(hits, reconstructed) {
|
|
1303
|
+
const [first = "", ...rest] = hits;
|
|
1595
1304
|
const explanation = guardrailExplanation(first);
|
|
1596
1305
|
const head = `Garde-fou d\xE9clench\xE9 : ${guardrailHitLabel(first)}.`;
|
|
1597
1306
|
const others = rest.length > 0 ? ` \xC9galement d\xE9clench\xE9 : ${rest.map(guardrailHitLabel).join(", ")}.` : "";
|
|
1598
|
-
|
|
1599
|
-
}
|
|
1600
|
-
function reconstructionCaveat(job) {
|
|
1601
|
-
if (!job.guardrailHitsReconstructedAt) return "";
|
|
1602
|
-
return " (Motif reconstitu\xE9 a posteriori depuis Gorgias \u2014 lecture faite avec les r\xE9glages actuels.)";
|
|
1603
|
-
}
|
|
1604
|
-
function legacyNotSentReason(job, policy, category) {
|
|
1605
|
-
if (job.guardrailHits.length > 0) return guardrailReason(job);
|
|
1606
|
-
const verdict = job.verdict;
|
|
1607
|
-
if (policy && verdict && verdict.status === "success" && requiresFollowup(verdict.verdict) && !policy.followupSendable) {
|
|
1608
|
-
return "Probablement : le juge a valid\xE9 la r\xE9ponse en demandant un suivi humain, et l'option \xAB Envoyer les r\xE9ponses qui demandent un suivi humain \xBB est d\xE9sactiv\xE9e sur l'\xE9tape \xC9valuation. (R\xE9ponse ant\xE9rieure \xE0 l'enregistrement des sorties de run \u2014 lecture faite avec les r\xE9glages actuels.)";
|
|
1609
|
-
}
|
|
1610
|
-
if (verdict && (verdict.status === "error" || verdict.verdict === "hold")) return notSendableReason(job, policy);
|
|
1611
|
-
return notEligibleReason(job, policy, category);
|
|
1307
|
+
const caveat = reconstructed ? " (Motif reconstitu\xE9 a posteriori depuis Gorgias \u2014 lecture faite avec les r\xE9glages actuels.)" : "";
|
|
1308
|
+
return `${head}${explanation ? ` ${explanation}` : ""}${others}${caveat}`;
|
|
1612
1309
|
}
|
|
1613
1310
|
function asPercent(ratio) {
|
|
1614
1311
|
return Math.round(ratio * 100);
|
|
1615
1312
|
}
|
|
1616
|
-
function correctionReason({ comparisons }) {
|
|
1617
|
-
if (comparisons.length > 0) return null;
|
|
1618
|
-
return "Aucune correction captur\xE9e : l'agent n'a pas r\xE9\xE9crit de r\xE9ponse sur ce ticket.";
|
|
1619
|
-
}
|
|
1620
|
-
function noResponseCause(decision) {
|
|
1621
|
-
if (decision.escalated) return "Ticket escalad\xE9 \xE0 un humain \u2014 le graphe ne r\xE9dige pas.";
|
|
1622
|
-
if (decision.conversationOver) return "Conversation consid\xE9r\xE9e close \u2014 rien \xE0 r\xE9pondre.";
|
|
1623
|
-
if (decision.status === "error") return decision.error ?? "Le triage a \xE9chou\xE9.";
|
|
1624
|
-
return "La cat\xE9gorie n'a pas la r\xE9ponse rapide activ\xE9e, ou n'a pas d'agent r\xE9dacteur.";
|
|
1625
|
-
}
|
|
1626
1313
|
|
|
1627
1314
|
// src/ui/tickets/ticket-actions.ts
|
|
1628
1315
|
function dedupe(names) {
|
|
@@ -1646,7 +1333,7 @@ function wasSimulated(job, policy) {
|
|
|
1646
1333
|
return policy?.dryRun === true;
|
|
1647
1334
|
}
|
|
1648
1335
|
function ticketActions(input) {
|
|
1649
|
-
const { job, policy, notSentReason
|
|
1336
|
+
const { job, policy, notSentReason } = input;
|
|
1650
1337
|
const simulated = wasSimulated(job, policy);
|
|
1651
1338
|
const tags = dedupe([
|
|
1652
1339
|
...triageTagNames(input),
|
|
@@ -1657,7 +1344,7 @@ function ticketActions(input) {
|
|
|
1657
1344
|
if (job?.status === "sent") {
|
|
1658
1345
|
taken.push("R\xE9ponse envoy\xE9e au client.");
|
|
1659
1346
|
} else if (job) {
|
|
1660
|
-
skipped.push(`R\xE9ponse non envoy\xE9e \u2014 ${
|
|
1347
|
+
skipped.push(`R\xE9ponse non envoy\xE9e \u2014 ${notSentReason ?? "raison inconnue."}`);
|
|
1661
1348
|
}
|
|
1662
1349
|
if (job?.outcome === "awaiting_approval" && !simulated) taken.push("Demande d'approbation cr\xE9\xE9e.");
|
|
1663
1350
|
return { tags, taken, skipped, simulated, unrecorded: job !== void 0 && job.outcome === null };
|
|
@@ -1665,8 +1352,8 @@ function ticketActions(input) {
|
|
|
1665
1352
|
function TimelinePanel(props) {
|
|
1666
1353
|
const { decision, job, comparisons, conversation, conversationLoading, categoryName, policy, category, onClose, onInvalidate, isInvalidating, history, onSelectGeneration } = props;
|
|
1667
1354
|
const steps = buildTimeline({ decision, job, comparisons, conversation, conversationLoading, policy, category });
|
|
1668
|
-
const
|
|
1669
|
-
const actions = ticketActions({ decision, job, policy, category, notSentReason
|
|
1355
|
+
const notSentReason = steps.find((step) => step.key === "delivery")?.reason ?? null;
|
|
1356
|
+
const actions = ticketActions({ decision, job, policy, category, notSentReason });
|
|
1670
1357
|
const canInvalidate = job !== void 0 && isGeneratedResponseStatus(job.status) && isInvalidatableStatus(job.status);
|
|
1671
1358
|
return /* @__PURE__ */ jsx(SidePanel, { open: true, onClose, title: `Ticket ${decision.ticketId}`, description: categoryName, children: /* @__PURE__ */ jsxs("div", { className: "min-h-0 flex-1 space-y-1 overflow-y-auto text-sm", children: [
|
|
1672
1359
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 pb-3", children: [
|
|
@@ -1674,7 +1361,7 @@ function TimelinePanel(props) {
|
|
|
1674
1361
|
onInvalidate && canInvalidate && /* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", onClick: onInvalidate, disabled: isInvalidating, children: isInvalidating ? "Invalidation\u2026" : "Invalider la r\xE9ponse" })
|
|
1675
1362
|
] }),
|
|
1676
1363
|
history !== void 0 && history.length > 1 && /* @__PURE__ */ jsx(ThreadHistory, { history, selectedDecisionId: decision.id, onSelect: onSelectGeneration }),
|
|
1677
|
-
steps.map((
|
|
1364
|
+
steps.map((step, index) => /* @__PURE__ */ jsx(StepBlock, { step, index, last: index === steps.length - 1, children: step.reached ? renderStep(step.key, props) : null }, step.key)),
|
|
1678
1365
|
/* @__PURE__ */ jsx(ActionsBlock, { actions })
|
|
1679
1366
|
] }) });
|
|
1680
1367
|
}
|
|
@@ -1709,7 +1396,7 @@ function ThreadHistory({
|
|
|
1709
1396
|
] });
|
|
1710
1397
|
}
|
|
1711
1398
|
function StepBlock({
|
|
1712
|
-
step
|
|
1399
|
+
step,
|
|
1713
1400
|
index,
|
|
1714
1401
|
last,
|
|
1715
1402
|
children
|
|
@@ -1719,16 +1406,16 @@ function StepBlock({
|
|
|
1719
1406
|
/* @__PURE__ */ jsx(
|
|
1720
1407
|
"span",
|
|
1721
1408
|
{
|
|
1722
|
-
className: `flex h-6 w-6 shrink-0 items-center justify-center rounded-full border text-xs font-semibold ${
|
|
1409
|
+
className: `flex h-6 w-6 shrink-0 items-center justify-center rounded-full border text-xs font-semibold ${step.reached ? "border-primary/30 bg-primary/10 text-primary" : "border-muted bg-muted text-muted-foreground"}`,
|
|
1723
1410
|
"aria-hidden": true,
|
|
1724
1411
|
children: index + 1
|
|
1725
1412
|
}
|
|
1726
1413
|
),
|
|
1727
1414
|
!last && /* @__PURE__ */ jsx("span", { className: "w-px flex-1 bg-border", "aria-hidden": true })
|
|
1728
1415
|
] }),
|
|
1729
|
-
/* @__PURE__ */ jsxs("div", { className: `min-w-0 flex-1 pb-5 ${
|
|
1730
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs font-semibold uppercase tracking-wider", children:
|
|
1731
|
-
|
|
1416
|
+
/* @__PURE__ */ jsxs("div", { className: `min-w-0 flex-1 pb-5 ${step.reached ? "" : "text-muted-foreground"}`, children: [
|
|
1417
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs font-semibold uppercase tracking-wider", children: step.title }),
|
|
1418
|
+
step.reached ? /* @__PURE__ */ jsx("div", { className: "mt-2 space-y-2", children }) : /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs", children: step.reason })
|
|
1732
1419
|
] })
|
|
1733
1420
|
] });
|
|
1734
1421
|
}
|
|
@@ -1997,7 +1684,7 @@ function TicketsPage() {
|
|
|
1997
1684
|
const history = useTicketHistory(detailDecision?.ticketId ?? null);
|
|
1998
1685
|
const [triageInFlight] = useState(() => ({ current: false }));
|
|
1999
1686
|
const periodKey = JSON.stringify(period);
|
|
2000
|
-
const bounds = useMemo(() =>
|
|
1687
|
+
const bounds = useMemo(() => periodBoundsOf2(JSON.parse(periodKey)).current, [periodKey]);
|
|
2001
1688
|
const decisionFilter = useMemo(() => {
|
|
2002
1689
|
if (ticketSearch) return { ticketId: { eq: ticketSearch } };
|
|
2003
1690
|
const filter = { decidedAt: { gte: bounds.fromIso, lte: bounds.toIso } };
|
|
@@ -2415,20 +2102,20 @@ var PIPELINE_STEPS = [
|
|
|
2415
2102
|
}
|
|
2416
2103
|
];
|
|
2417
2104
|
var TRIAGE_LOCK_REASON = "Sans triage l'app ne traite rien.";
|
|
2418
|
-
var STEP_BY_KEY = new Map(PIPELINE_STEPS.map((
|
|
2105
|
+
var STEP_BY_KEY = new Map(PIPELINE_STEPS.map((step) => [step.key, step]));
|
|
2419
2106
|
function pipelineStep(key) {
|
|
2420
|
-
const
|
|
2421
|
-
if (!
|
|
2422
|
-
return
|
|
2107
|
+
const step = STEP_BY_KEY.get(key);
|
|
2108
|
+
if (!step) throw new Error(`unknown pipeline step: ${key}`);
|
|
2109
|
+
return step;
|
|
2423
2110
|
}
|
|
2424
2111
|
function readNodes(value) {
|
|
2425
2112
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return {};
|
|
2426
2113
|
return value;
|
|
2427
2114
|
}
|
|
2428
2115
|
function readStep(value, key) {
|
|
2429
|
-
const
|
|
2430
|
-
if (typeof
|
|
2431
|
-
return
|
|
2116
|
+
const step = readNodes(value)[key];
|
|
2117
|
+
if (typeof step !== "object" || step === null || Array.isArray(step)) return null;
|
|
2118
|
+
return step;
|
|
2432
2119
|
}
|
|
2433
2120
|
function isStepEnabled(value, key) {
|
|
2434
2121
|
return readStep(value, key) !== null;
|
|
@@ -2441,43 +2128,43 @@ function stepBlockedReason(value, key) {
|
|
|
2441
2128
|
function isStepActive(value, key) {
|
|
2442
2129
|
return isStepEnabled(value, key) && stepBlockedReason(value, key) === null;
|
|
2443
2130
|
}
|
|
2444
|
-
function withStep(value, key,
|
|
2445
|
-
return { ...readNodes(value), [key]:
|
|
2131
|
+
function withStep(value, key, step) {
|
|
2132
|
+
return { ...readNodes(value), [key]: step };
|
|
2446
2133
|
}
|
|
2447
2134
|
function withStepFields(value, key, patch) {
|
|
2448
|
-
const
|
|
2449
|
-
if (!
|
|
2450
|
-
const next = { ...
|
|
2135
|
+
const step = readStep(value, key);
|
|
2136
|
+
if (!step) return readNodes(value);
|
|
2137
|
+
const next = { ...step };
|
|
2451
2138
|
for (const [field2, fieldValue] of Object.entries(patch)) {
|
|
2452
2139
|
if (fieldValue === void 0) delete next[field2];
|
|
2453
2140
|
else next[field2] = fieldValue;
|
|
2454
2141
|
}
|
|
2455
2142
|
return withStep(value, key, next);
|
|
2456
2143
|
}
|
|
2457
|
-
function stepString(
|
|
2458
|
-
const value =
|
|
2144
|
+
function stepString(step, field2) {
|
|
2145
|
+
const value = step?.[field2];
|
|
2459
2146
|
return typeof value === "string" ? value : "";
|
|
2460
2147
|
}
|
|
2461
|
-
function stepNumber(
|
|
2462
|
-
const value =
|
|
2148
|
+
function stepNumber(step, field2, fallback) {
|
|
2149
|
+
const value = step?.[field2];
|
|
2463
2150
|
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
2464
2151
|
}
|
|
2465
|
-
function stepBoolean(
|
|
2466
|
-
const value =
|
|
2152
|
+
function stepBoolean(step, field2, fallback) {
|
|
2153
|
+
const value = step?.[field2];
|
|
2467
2154
|
return typeof value === "boolean" ? value : fallback;
|
|
2468
2155
|
}
|
|
2469
2156
|
function stepUsesAgentPrompt(key) {
|
|
2470
2157
|
return key === "draft" || key === "revise";
|
|
2471
2158
|
}
|
|
2472
2159
|
var DEFAULT_PROMPT_LABEL = "production";
|
|
2473
|
-
function stepPromptName(
|
|
2474
|
-
return readPromptField(
|
|
2160
|
+
function stepPromptName(step) {
|
|
2161
|
+
return readPromptField(step, "name");
|
|
2475
2162
|
}
|
|
2476
|
-
function stepPromptLabel(
|
|
2477
|
-
return readPromptField(
|
|
2163
|
+
function stepPromptLabel(step) {
|
|
2164
|
+
return readPromptField(step, "label") || DEFAULT_PROMPT_LABEL;
|
|
2478
2165
|
}
|
|
2479
|
-
function readPromptField(
|
|
2480
|
-
const prompt =
|
|
2166
|
+
function readPromptField(step, field2) {
|
|
2167
|
+
const prompt = step?.prompt;
|
|
2481
2168
|
if (typeof prompt !== "object" || prompt === null) return "";
|
|
2482
2169
|
const value = prompt[field2];
|
|
2483
2170
|
return typeof value === "string" ? value : "";
|
|
@@ -2485,8 +2172,8 @@ function readPromptField(step2, field2) {
|
|
|
2485
2172
|
function promptPatch(name, label) {
|
|
2486
2173
|
return { prompt: { name, label } };
|
|
2487
2174
|
}
|
|
2488
|
-
function stepReasoning(
|
|
2489
|
-
const value =
|
|
2175
|
+
function stepReasoning(step) {
|
|
2176
|
+
const value = step?.reasoning;
|
|
2490
2177
|
return REASONING_EFFORTS.some((effort) => effort.value === value) ? value : "off";
|
|
2491
2178
|
}
|
|
2492
2179
|
var REASONING_EFFORTS = [
|
|
@@ -4009,9 +3696,9 @@ function PipelineNodesForm({
|
|
|
4009
3696
|
let changed = false;
|
|
4010
3697
|
const next = { ...prev };
|
|
4011
3698
|
for (const key of PIPELINE_STEP_KEYS) {
|
|
4012
|
-
const
|
|
4013
|
-
if (
|
|
4014
|
-
next[key] =
|
|
3699
|
+
const step = readStep(value, key);
|
|
3700
|
+
if (step && JSON.stringify(step) !== JSON.stringify(prev[key])) {
|
|
3701
|
+
next[key] = step;
|
|
4015
3702
|
changed = true;
|
|
4016
3703
|
}
|
|
4017
3704
|
}
|
|
@@ -4040,26 +3727,26 @@ function PipelineNodesForm({
|
|
|
4040
3727
|
) }, preset.id))
|
|
4041
3728
|
] }),
|
|
4042
3729
|
/* @__PURE__ */ jsx("p", { className: "-mt-2 text-xs text-muted-foreground", children: "Un pr\xE9r\xE9glage remplit ce formulaire \u2014 il n'enregistre rien tant que vous n'avez pas cliqu\xE9 sur Enregistrer." }),
|
|
4043
|
-
/* @__PURE__ */ jsx("div", { className: "divide-y rounded-md border", children: PIPELINE_STEPS.map((
|
|
3730
|
+
/* @__PURE__ */ jsx("div", { className: "divide-y rounded-md border", children: PIPELINE_STEPS.map((step) => /* @__PURE__ */ jsx(
|
|
4044
3731
|
StepRow,
|
|
4045
3732
|
{
|
|
4046
|
-
step
|
|
3733
|
+
step,
|
|
4047
3734
|
value,
|
|
4048
3735
|
canWrite,
|
|
4049
|
-
issueMessage:
|
|
3736
|
+
issueMessage: step.key === "triage" ? issueMessage : null,
|
|
4050
3737
|
prompts,
|
|
4051
3738
|
promptsLoading,
|
|
4052
3739
|
models,
|
|
4053
3740
|
modelsLoading,
|
|
4054
|
-
onToggle: (on) => toggleStep(
|
|
4055
|
-
onPatch: (patch) => onChange(withStepFields(value,
|
|
3741
|
+
onToggle: (on) => toggleStep(step.key, on),
|
|
3742
|
+
onPatch: (patch) => onChange(withStepFields(value, step.key, patch))
|
|
4056
3743
|
},
|
|
4057
|
-
|
|
3744
|
+
step.key
|
|
4058
3745
|
)) })
|
|
4059
3746
|
] });
|
|
4060
3747
|
}
|
|
4061
3748
|
function StepRow({
|
|
4062
|
-
step
|
|
3749
|
+
step,
|
|
4063
3750
|
value,
|
|
4064
3751
|
canWrite,
|
|
4065
3752
|
issueMessage,
|
|
@@ -4070,15 +3757,15 @@ function StepRow({
|
|
|
4070
3757
|
onToggle,
|
|
4071
3758
|
onPatch
|
|
4072
3759
|
}) {
|
|
4073
|
-
const enabled = isStepEnabled(value,
|
|
4074
|
-
const blockedReason = stepBlockedReason(value,
|
|
3760
|
+
const enabled = isStepEnabled(value, step.key);
|
|
3761
|
+
const blockedReason = stepBlockedReason(value, step.key);
|
|
4075
3762
|
const promptFieldId = useId();
|
|
4076
|
-
const triageLocked =
|
|
3763
|
+
const triageLocked = step.key === "triage" && enabled;
|
|
4077
3764
|
const editable = canWrite && !blockedReason && !triageLocked;
|
|
4078
3765
|
const toggle = /* @__PURE__ */ jsx(
|
|
4079
3766
|
Switch,
|
|
4080
3767
|
{
|
|
4081
|
-
"aria-label": `${
|
|
3768
|
+
"aria-label": `${step.label} \u2014 activer l'\xE9tape`,
|
|
4082
3769
|
checked: enabled,
|
|
4083
3770
|
onCheckedChange: onToggle,
|
|
4084
3771
|
disabled: !editable
|
|
@@ -4087,8 +3774,8 @@ function StepRow({
|
|
|
4087
3774
|
return /* @__PURE__ */ jsxs("div", { className: blockedReason ? "space-y-2 p-4 opacity-60" : "space-y-2 p-4", children: [
|
|
4088
3775
|
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-3", children: [
|
|
4089
3776
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
4090
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children:
|
|
4091
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children:
|
|
3777
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: step.label }),
|
|
3778
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: step.description })
|
|
4092
3779
|
] }),
|
|
4093
3780
|
/* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-2 text-sm", children: [
|
|
4094
3781
|
triageLocked ? /* @__PURE__ */ jsx(Tooltip, { label: TRIAGE_LOCK_REASON, children: toggle }) : toggle,
|
|
@@ -4103,8 +3790,8 @@ function StepRow({
|
|
|
4103
3790
|
/* @__PURE__ */ jsx("div", { className: "rounded-md bg-muted/40 p-3", children: /* @__PURE__ */ jsx(
|
|
4104
3791
|
StepPromptField,
|
|
4105
3792
|
{
|
|
4106
|
-
step
|
|
4107
|
-
settings: readStep(value,
|
|
3793
|
+
step,
|
|
3794
|
+
settings: readStep(value, step.key),
|
|
4108
3795
|
disabled: !canWrite || blockedReason !== null,
|
|
4109
3796
|
prompts,
|
|
4110
3797
|
promptsLoading,
|
|
@@ -4117,8 +3804,8 @@ function StepRow({
|
|
|
4117
3804
|
/* @__PURE__ */ jsx("div", { className: "mt-3 grid gap-4 rounded-md bg-muted/40 p-3 sm:grid-cols-2", children: /* @__PURE__ */ jsx(
|
|
4118
3805
|
StepOptions,
|
|
4119
3806
|
{
|
|
4120
|
-
step
|
|
4121
|
-
settings: readStep(value,
|
|
3807
|
+
step,
|
|
3808
|
+
settings: readStep(value, step.key),
|
|
4122
3809
|
disabled: !canWrite || blockedReason !== null,
|
|
4123
3810
|
models,
|
|
4124
3811
|
modelsLoading,
|
|
@@ -4129,7 +3816,7 @@ function StepRow({
|
|
|
4129
3816
|
] });
|
|
4130
3817
|
}
|
|
4131
3818
|
function StepOptions({
|
|
4132
|
-
step
|
|
3819
|
+
step,
|
|
4133
3820
|
settings,
|
|
4134
3821
|
disabled,
|
|
4135
3822
|
models,
|
|
@@ -4140,14 +3827,14 @@ function StepOptions({
|
|
|
4140
3827
|
const known = models.includes(model);
|
|
4141
3828
|
const [freeText, setFreeText] = useState(false);
|
|
4142
3829
|
const showFreeText = freeText || model !== "" && !known && !modelsLoading;
|
|
4143
|
-
const ids = useIds(
|
|
3830
|
+
const ids = useIds(step.key);
|
|
4144
3831
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4145
3832
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
4146
3833
|
/* @__PURE__ */ jsx("label", { htmlFor: ids.model, className: "mb-1 block text-sm font-medium", children: "Mod\xE8le" }),
|
|
4147
3834
|
/* @__PURE__ */ jsx(
|
|
4148
3835
|
Select,
|
|
4149
3836
|
{
|
|
4150
|
-
"aria-label": `Mod\xE8le \u2014 ${
|
|
3837
|
+
"aria-label": `Mod\xE8le \u2014 ${step.label}`,
|
|
4151
3838
|
value: showFreeText ? CUSTOM_MODEL_VALUE : model,
|
|
4152
3839
|
onValueChange: (next) => {
|
|
4153
3840
|
if (next === CUSTOM_MODEL_VALUE) {
|
|
@@ -4177,7 +3864,7 @@ function StepOptions({
|
|
|
4177
3864
|
Input,
|
|
4178
3865
|
{
|
|
4179
3866
|
id: ids.model,
|
|
4180
|
-
"aria-label": `Identifiant de mod\xE8le \u2014 ${
|
|
3867
|
+
"aria-label": `Identifiant de mod\xE8le \u2014 ${step.label}`,
|
|
4181
3868
|
value: model,
|
|
4182
3869
|
disabled,
|
|
4183
3870
|
onChange: (e) => onPatch({ model: e.target.value })
|
|
@@ -4187,7 +3874,7 @@ function StepOptions({
|
|
|
4187
3874
|
Input,
|
|
4188
3875
|
{
|
|
4189
3876
|
id: ids.provider,
|
|
4190
|
-
"aria-label": `Fournisseur \u2014 ${
|
|
3877
|
+
"aria-label": `Fournisseur \u2014 ${step.label}`,
|
|
4191
3878
|
value: stepString(settings, "provider") || DEFAULT_LLM_PROVIDER,
|
|
4192
3879
|
disabled,
|
|
4193
3880
|
onChange: (e) => onPatch({ provider: e.target.value })
|
|
@@ -4201,7 +3888,7 @@ function StepOptions({
|
|
|
4201
3888
|
/* @__PURE__ */ jsx(
|
|
4202
3889
|
Select,
|
|
4203
3890
|
{
|
|
4204
|
-
"aria-label": `Effort de raisonnement \u2014 ${
|
|
3891
|
+
"aria-label": `Effort de raisonnement \u2014 ${step.label}`,
|
|
4205
3892
|
value: stepReasoning(settings),
|
|
4206
3893
|
onValueChange: (next) => onPatch({ reasoning: next }),
|
|
4207
3894
|
items: REASONING_EFFORTS.map((effort) => ({ value: effort.value, label: effort.label })),
|
|
@@ -4209,7 +3896,7 @@ function StepOptions({
|
|
|
4209
3896
|
}
|
|
4210
3897
|
)
|
|
4211
3898
|
] }),
|
|
4212
|
-
|
|
3899
|
+
step.key === "draft" && /* @__PURE__ */ jsx(
|
|
4213
3900
|
NumberField,
|
|
4214
3901
|
{
|
|
4215
3902
|
id: ids.maxToolCalls,
|
|
@@ -4222,7 +3909,7 @@ function StepOptions({
|
|
|
4222
3909
|
hint: "Chaque consultation (commande, livraison\u2026) co\xFBte un appel suppl\xE9mentaire."
|
|
4223
3910
|
}
|
|
4224
3911
|
),
|
|
4225
|
-
|
|
3912
|
+
step.key === "evaluate" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4226
3913
|
/* @__PURE__ */ jsx(
|
|
4227
3914
|
NumberField,
|
|
4228
3915
|
{
|
|
@@ -4249,7 +3936,7 @@ function StepOptions({
|
|
|
4249
3936
|
] });
|
|
4250
3937
|
}
|
|
4251
3938
|
function StepPromptField({
|
|
4252
|
-
step
|
|
3939
|
+
step,
|
|
4253
3940
|
settings,
|
|
4254
3941
|
disabled,
|
|
4255
3942
|
prompts,
|
|
@@ -4257,8 +3944,8 @@ function StepPromptField({
|
|
|
4257
3944
|
id,
|
|
4258
3945
|
onPatch
|
|
4259
3946
|
}) {
|
|
4260
|
-
if (stepUsesAgentPrompt(
|
|
4261
|
-
return /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children:
|
|
3947
|
+
if (stepUsesAgentPrompt(step.key)) {
|
|
3948
|
+
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." });
|
|
4262
3949
|
}
|
|
4263
3950
|
const name = stepPromptName(settings);
|
|
4264
3951
|
const label = stepPromptLabel(settings);
|
|
@@ -4272,7 +3959,7 @@ function StepPromptField({
|
|
|
4272
3959
|
/* @__PURE__ */ jsx(
|
|
4273
3960
|
Select,
|
|
4274
3961
|
{
|
|
4275
|
-
"aria-label": `Prompt \u2014 ${
|
|
3962
|
+
"aria-label": `Prompt \u2014 ${step.label}`,
|
|
4276
3963
|
value: name,
|
|
4277
3964
|
onValueChange: (next) => onPatch(promptPatch(next, DEFAULT_PROMPT_LABEL)),
|
|
4278
3965
|
items: [
|
|
@@ -4285,7 +3972,7 @@ function StepPromptField({
|
|
|
4285
3972
|
/* @__PURE__ */ jsx(
|
|
4286
3973
|
Select,
|
|
4287
3974
|
{
|
|
4288
|
-
"aria-label": `Version du prompt \u2014 ${
|
|
3975
|
+
"aria-label": `Version du prompt \u2014 ${step.label}`,
|
|
4289
3976
|
value: labels.includes(label) ? label : "",
|
|
4290
3977
|
onValueChange: (next) => onPatch(promptPatch(name, next)),
|
|
4291
3978
|
items: labels.map((entry) => ({ value: entry, label: entry })),
|
|
@@ -4415,33 +4102,12 @@ function SourceViewField({ views, value, onChange, disabled }) {
|
|
|
4415
4102
|
}
|
|
4416
4103
|
);
|
|
4417
4104
|
}
|
|
4418
|
-
function FollowupWebhookCard(
|
|
4105
|
+
function FollowupWebhookCard() {
|
|
4419
4106
|
const { appSlug } = useAppContext();
|
|
4420
|
-
const scopeId = useId();
|
|
4421
4107
|
return /* @__PURE__ */ jsx(Card, { id: "webhook-suite", children: /* @__PURE__ */ jsxs(CardContent, { className: "space-y-4 p-4", children: [
|
|
4422
4108
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
4423
4109
|
/* @__PURE__ */ jsx("h2", { className: "font-medium", children: "R\xE9ponses aux messages suivants" }),
|
|
4424
|
-
/* @__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)." })
|
|
4425
|
-
] }),
|
|
4426
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
4427
|
-
/* @__PURE__ */ jsx("label", { htmlFor: scopeId, className: "mb-1 block text-sm font-medium", children: "Tag de p\xE9rim\xE8tre webhook" }),
|
|
4428
|
-
/* @__PURE__ */ jsx(
|
|
4429
|
-
Input,
|
|
4430
|
-
{
|
|
4431
|
-
id: scopeId,
|
|
4432
|
-
value: scopeTag,
|
|
4433
|
-
onChange: (e) => onScopeTagChange(e.target.value),
|
|
4434
|
-
placeholder: "wai/triaged",
|
|
4435
|
-
disabled: !canWrite
|
|
4436
|
-
}
|
|
4437
|
-
),
|
|
4438
|
-
/* @__PURE__ */ jsxs("p", { className: "mt-1 text-xs text-muted-foreground", children: [
|
|
4439
|
-
"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. ",
|
|
4440
|
-
/* @__PURE__ */ jsx("strong", { children: "Vide = aucun message suivant trait\xE9" }),
|
|
4441
|
-
" (c'est aussi le kill-switch). Deux apps sur le m\xEAme compte Gorgias doivent y mettre des valeurs ",
|
|
4442
|
-
/* @__PURE__ */ jsx("strong", { children: "distinctes" }),
|
|
4443
|
-
", sinon chacune r\xE9pondrait sur les tickets de l'autre."
|
|
4444
|
-
] })
|
|
4110
|
+
/* @__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). Seuls les tickets qui portent le tag des tickets de l'application sont concern\xE9s." })
|
|
4445
4111
|
] }),
|
|
4446
4112
|
/* @__PURE__ */ jsxs("div", { className: "space-y-2 border-t pt-4", children: [
|
|
4447
4113
|
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: "Int\xE9gration Gorgias (installation manuelle)" }),
|
|
@@ -4813,22 +4479,15 @@ function SettingsPage() {
|
|
|
4813
4479
|
["autoRepliedTag", "Tag r\xE9pondu automatiquement"],
|
|
4814
4480
|
["needsReviewTag", "Tag \xE0 revoir avant envoi"],
|
|
4815
4481
|
["followupTag", "Tag suivi requis"],
|
|
4816
|
-
["appScopeTag", "Tag
|
|
4482
|
+
["appScopeTag", "Tag des tickets de l'application"]
|
|
4817
4483
|
].map(([key, label]) => /* @__PURE__ */ jsxs("div", { children: [
|
|
4818
4484
|
/* @__PURE__ */ jsx("label", { htmlFor: key, className: "mb-1 block text-sm font-medium", children: label }),
|
|
4819
4485
|
/* @__PURE__ */ jsx(Input, { id: key, value: field(form[key]), onChange: (e) => set(key, e.target.value), disabled: !canWrite })
|
|
4820
4486
|
] }, key)),
|
|
4821
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Le tag
|
|
4487
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Le tag des tickets de l\u2019application est obligatoire. Il est pos\xE9 sur chaque ticket que le triage examine, et c\u2019est lui qui dit qu\u2019un ticket appartient \xE0 cette app : les r\xE9ponses aux messages suivants et l\u2019agent par d\xE9faut propos\xE9 dans l\u2019extension Gorgias s\u2019appuient dessus. Il doit \xEAtre propre \xE0 cette app, distinct de celui d\u2019une autre app install\xE9e sur le m\xEAme compte Gorgias." }),
|
|
4822
4488
|
/* @__PURE__ */ jsx(SettingsWarnings, { warnings: tagWarnings })
|
|
4823
4489
|
] }) }),
|
|
4824
|
-
/* @__PURE__ */ jsx(
|
|
4825
|
-
FollowupWebhookCard,
|
|
4826
|
-
{
|
|
4827
|
-
scopeTag: field(form.webhookScopeTag),
|
|
4828
|
-
onScopeTagChange: (value) => set("webhookScopeTag", value),
|
|
4829
|
-
canWrite
|
|
4830
|
-
}
|
|
4831
|
-
),
|
|
4490
|
+
/* @__PURE__ */ jsx(FollowupWebhookCard, {}),
|
|
4832
4491
|
/* @__PURE__ */ jsx(Card, { id: "guardrails", children: /* @__PURE__ */ jsxs(CardContent, { className: "space-y-3 p-4", children: [
|
|
4833
4492
|
/* @__PURE__ */ jsx("h2", { className: "font-medium", children: "Garde-fous" }),
|
|
4834
4493
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
@@ -6406,7 +6065,7 @@ function readySummary(result) {
|
|
|
6406
6065
|
}
|
|
6407
6066
|
function describeVerdict(result) {
|
|
6408
6067
|
if (result.error) {
|
|
6409
|
-
const failing = result.steps.find((
|
|
6068
|
+
const failing = result.steps.find((step) => step.error);
|
|
6410
6069
|
return {
|
|
6411
6070
|
label: "Erreur technique",
|
|
6412
6071
|
tone: "danger",
|
|
@@ -6451,7 +6110,7 @@ function describeVerdict(result) {
|
|
|
6451
6110
|
}
|
|
6452
6111
|
}
|
|
6453
6112
|
function totalDurationMs(result) {
|
|
6454
|
-
return result.steps.reduce((total,
|
|
6113
|
+
return result.steps.reduce((total, step) => total + step.durationMs, 0);
|
|
6455
6114
|
}
|
|
6456
6115
|
var VERDICT_BADGE_VARIANT = {
|
|
6457
6116
|
success: "success",
|
|
@@ -6461,7 +6120,7 @@ var VERDICT_BADGE_VARIANT = {
|
|
|
6461
6120
|
};
|
|
6462
6121
|
function DryRunResultView({ result, langfuseConfig, knownTags, tagSettings }) {
|
|
6463
6122
|
const verdict = describeVerdict(result);
|
|
6464
|
-
const triageStep = result.steps.find((
|
|
6123
|
+
const triageStep = result.steps.find((step) => step.node === "triage");
|
|
6465
6124
|
const triageTag = triageStep?.patch.classification?.category;
|
|
6466
6125
|
const isFallbackClassification = triageStep?.patch.classification?.isFallback === true;
|
|
6467
6126
|
const unknownTag = Boolean(triageTag) && !isFallbackClassification && knownTags !== void 0 && !knownTags.includes(triageTag);
|
|
@@ -6495,18 +6154,18 @@ function DryRunResultView({ result, langfuseConfig, knownTags, tagSettings }) {
|
|
|
6495
6154
|
] }),
|
|
6496
6155
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
6497
6156
|
/* @__PURE__ */ jsx("p", { className: "mb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground", children: "N\u0153uds ex\xE9cut\xE9s" }),
|
|
6498
|
-
/* @__PURE__ */ jsx("ul", { className: "space-y-1", children: result.steps.map((
|
|
6157
|
+
/* @__PURE__ */ jsx("ul", { className: "space-y-1", children: result.steps.map((step, i) => /* @__PURE__ */ jsxs("li", { className: "flex items-center justify-between gap-3", children: [
|
|
6499
6158
|
/* @__PURE__ */ jsxs("span", { children: [
|
|
6500
|
-
NODE_LABELS[
|
|
6159
|
+
NODE_LABELS[step.node],
|
|
6501
6160
|
" (",
|
|
6502
|
-
|
|
6161
|
+
step.node,
|
|
6503
6162
|
")",
|
|
6504
|
-
|
|
6163
|
+
step.node === "triage" && unknownTag && /* @__PURE__ */ jsx("span", { className: "ml-2 text-xs text-status-warning", children: "\u2014 ce tag ne correspond \xE0 aucune cat\xE9gorie configur\xE9e" })
|
|
6505
6164
|
] }),
|
|
6506
6165
|
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
6507
|
-
|
|
6166
|
+
step.durationMs,
|
|
6508
6167
|
" ms",
|
|
6509
|
-
|
|
6168
|
+
step.error && /* @__PURE__ */ jsx(Badge, { variant: "danger", children: step.error })
|
|
6510
6169
|
] })
|
|
6511
6170
|
] }, i)) })
|
|
6512
6171
|
] }),
|
|
@@ -6663,7 +6322,7 @@ function FollowupWebhookCard2() {
|
|
|
6663
6322
|
/* @__PURE__ */ jsxs(CardContent, { className: "space-y-3 p-4", children: [
|
|
6664
6323
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
6665
6324
|
/* @__PURE__ */ jsx("h2", { className: "font-medium", children: "R\xE9ponses aux messages suivants" }),
|
|
6666
|
-
/* @__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
|
|
6325
|
+
/* @__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 des tickets de l\u2019application et les cat\xE9gories se r\xE8glent dans Param\xE8tres." })
|
|
6667
6326
|
] }),
|
|
6668
6327
|
/* @__PURE__ */ jsxs("div", { className: "space-y-2 border-t pt-3", children: [
|
|
6669
6328
|
/* @__PURE__ */ jsx("label", { htmlFor: ticketId, className: "block text-sm font-medium", children: "Ticket \xE0 tester" }),
|