@apotech-os/support-kit 8.2.0 → 8.4.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 +11 -4
- package/dist/{chunk-LXHPPWPM.js → chunk-D3QGGJAI.js} +73 -14
- package/dist/chunk-D3QGGJAI.js.map +1 -0
- package/dist/index.cjs +220 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -2
- package/dist/index.d.ts +32 -2
- package/dist/index.js +140 -27
- package/dist/index.js.map +1 -1
- package/dist/ui/index.cjs +228 -55
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.js +166 -43
- package/dist/ui/index.js.map +1 -1
- package/package.json +11 -11
- package/dist/chunk-LXHPPWPM.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, toGeneratedResponse, toTriageDecision, toAgent, toResponseComparison, 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-
|
|
1
|
+
import { EVALUATION_VERDICTS, WHATSAPP_MODES, validateSettings, settingsWarnings, AGENT_GUARDRAILS, toCategory, DEFAULT_MIN_CONFIDENCE, DEFAULT_ESCALATION_ENABLED, toAuditTags, toGeneratedResponse, toTriageDecision, toAgent, toResponseComparison, 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-D3QGGJAI.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, Input, Checkbox, 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';
|
|
@@ -145,6 +145,9 @@ function toNameMap(rows) {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
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
|
+
}
|
|
148
151
|
function bucketDay(row) {
|
|
149
152
|
return String(row["bucket"]).slice(0, 10);
|
|
150
153
|
}
|
|
@@ -152,23 +155,38 @@ var EMPTY_TOTALS = {
|
|
|
152
155
|
auto: 0,
|
|
153
156
|
human: 0,
|
|
154
157
|
inProgress: 0,
|
|
155
|
-
noReplyNeeded: 0
|
|
156
|
-
failed: 0
|
|
158
|
+
noReplyNeeded: 0
|
|
157
159
|
};
|
|
158
|
-
function
|
|
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;
|
|
160
171
|
if (status === "sent") return "auto";
|
|
161
172
|
if (status === "no_reply_needed") return "noReplyNeeded";
|
|
162
|
-
if (status === "failed") return "
|
|
173
|
+
if (status === "failed") return "human";
|
|
163
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;
|
|
164
179
|
return autoSendDecision === "hold" ? "human" : "inProgress";
|
|
165
180
|
}
|
|
166
|
-
function foldOutcomes(rows) {
|
|
181
|
+
function foldOutcomes(rows, triageRows = []) {
|
|
167
182
|
const totals = { ...EMPTY_TOTALS };
|
|
168
183
|
for (const row of rows) {
|
|
169
|
-
const outcome = outcomeOf(row
|
|
184
|
+
const outcome = outcomeOf(row);
|
|
170
185
|
if (outcome !== null) totals[outcome] += Number(row["count"]) || 0;
|
|
171
186
|
}
|
|
187
|
+
for (const row of triageRows) {
|
|
188
|
+
if (isUnautomatedTriage(row)) totals.human += Number(row["count"]) || 0;
|
|
189
|
+
}
|
|
172
190
|
return totals;
|
|
173
191
|
}
|
|
174
192
|
function settledCount(totals) {
|
|
@@ -178,15 +196,22 @@ function autonomyRate(totals) {
|
|
|
178
196
|
const settled = settledCount(totals);
|
|
179
197
|
return settled > 0 ? totals.auto / settled : Number.NaN;
|
|
180
198
|
}
|
|
181
|
-
function foldDailyOutcomes(rows) {
|
|
199
|
+
function foldDailyOutcomes(rows, triageRows = []) {
|
|
182
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
|
+
};
|
|
183
208
|
for (const row of rows) {
|
|
184
|
-
const outcome = outcomeOf(row
|
|
209
|
+
const outcome = outcomeOf(row);
|
|
185
210
|
if (outcome === null) continue;
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
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;
|
|
190
215
|
}
|
|
191
216
|
return [...byDay.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([day, totals]) => ({
|
|
192
217
|
day,
|
|
@@ -212,7 +237,7 @@ function ratePoints(rate, compareRate) {
|
|
|
212
237
|
}
|
|
213
238
|
var SIGNAL_MIN_VOLUME = 20;
|
|
214
239
|
var SIGNAL_MIN_POINTS = 3;
|
|
215
|
-
function dashboardSignals(totals, compare) {
|
|
240
|
+
function dashboardSignals(totals, compare, failed = 0) {
|
|
216
241
|
const signals = [];
|
|
217
242
|
const settled = settledCount(totals);
|
|
218
243
|
const rate = autonomyRate(totals);
|
|
@@ -226,10 +251,10 @@ function dashboardSignals(totals, compare) {
|
|
|
226
251
|
});
|
|
227
252
|
}
|
|
228
253
|
}
|
|
229
|
-
if (
|
|
254
|
+
if (failed > 0) {
|
|
230
255
|
signals.push({
|
|
231
256
|
level: "creuser",
|
|
232
|
-
text: `${
|
|
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.`
|
|
233
258
|
});
|
|
234
259
|
}
|
|
235
260
|
if (totals.inProgress > 0) {
|
|
@@ -252,15 +277,19 @@ function dashboardSignals(totals, compare) {
|
|
|
252
277
|
}
|
|
253
278
|
return signals;
|
|
254
279
|
}
|
|
255
|
-
function foldHumanReasons(rows) {
|
|
256
|
-
const reasons = { blocked: 0, invalidated: 0, expired: 0 };
|
|
280
|
+
function foldHumanReasons(rows, triageRows = []) {
|
|
281
|
+
const reasons = { blocked: 0, invalidated: 0, expired: 0, escalatedNoDraft: 0, failed: 0 };
|
|
257
282
|
for (const row of rows) {
|
|
258
|
-
if (outcomeOf(row
|
|
283
|
+
if (outcomeOf(row) !== "human") continue;
|
|
259
284
|
const count = Number(row["count"]) || 0;
|
|
260
285
|
if (row["status"] === "invalidated") reasons.invalidated += count;
|
|
261
286
|
else if (row["status"] === "expired") reasons.expired += count;
|
|
287
|
+
else if (row["status"] === "failed") reasons.failed += count;
|
|
262
288
|
else reasons.blocked += count;
|
|
263
289
|
}
|
|
290
|
+
for (const row of triageRows) {
|
|
291
|
+
if (isUnautomatedTriage(row)) reasons.escalatedNoDraft += Number(row["count"]) || 0;
|
|
292
|
+
}
|
|
264
293
|
return reasons;
|
|
265
294
|
}
|
|
266
295
|
var CATEGORY_TOP_N = 10;
|
|
@@ -284,12 +313,15 @@ function foldCategoryOutcomes(triageRows, responseRows, categoryNames, topN = CA
|
|
|
284
313
|
};
|
|
285
314
|
for (const row of triageRows) {
|
|
286
315
|
const bar = barFor(row["categoryId"]);
|
|
287
|
-
if (bar
|
|
316
|
+
if (bar === null) continue;
|
|
317
|
+
const count = Number(row["count"]) || 0;
|
|
318
|
+
bar.total += count;
|
|
319
|
+
if (isUnautomatedTriage(row)) bar.human += count;
|
|
288
320
|
}
|
|
289
321
|
for (const row of responseRows) {
|
|
290
322
|
const bar = barFor(row["categoryId"]);
|
|
291
323
|
if (bar === null) continue;
|
|
292
|
-
const outcome = outcomeOf(row
|
|
324
|
+
const outcome = outcomeOf(row);
|
|
293
325
|
const count = Number(row["count"]) || 0;
|
|
294
326
|
if (outcome === "auto") bar.auto += count;
|
|
295
327
|
else if (outcome === "human") bar.human += count;
|
|
@@ -477,8 +509,10 @@ function StackedLegend({ segments }) {
|
|
|
477
509
|
] }, segment.key)) });
|
|
478
510
|
}
|
|
479
511
|
var OUTCOME_METRICS = [{ op: "count", as: "count" }];
|
|
480
|
-
var OUTCOME_GROUP_BY = ["status", "autoSendDecision"];
|
|
481
|
-
var CATEGORY_OUTCOME_GROUP_BY = ["categoryId", "status", "autoSendDecision"];
|
|
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"];
|
|
482
516
|
var CATEGORY_COLORS = {
|
|
483
517
|
auto: "var(--chart-1)",
|
|
484
518
|
human: "var(--chart-2)",
|
|
@@ -522,13 +556,27 @@ function DashboardPage() {
|
|
|
522
556
|
groupBy: OUTCOME_GROUP_BY,
|
|
523
557
|
metrics: OUTCOME_METRICS
|
|
524
558
|
});
|
|
559
|
+
const { rows: dailyTriageRows, isLoading: triageLoading } = useAggregate("triage-decision", {
|
|
560
|
+
filter: { decidedAt: { gte: bounds.current.fromIso, lte: bounds.current.toIso } },
|
|
561
|
+
groupBy: TRIAGE_HANDOFF_GROUP_BY,
|
|
562
|
+
bucket: { field: "decidedAt", interval: bounds.interval, tz: timezone },
|
|
563
|
+
metrics: OUTCOME_METRICS
|
|
564
|
+
});
|
|
565
|
+
const { rows: previousTriageRows, isLoading: previousTriageLoading } = useAggregate(
|
|
566
|
+
"triage-decision",
|
|
567
|
+
{
|
|
568
|
+
filter: { decidedAt: { gte: previousBounds.fromIso, lte: previousBounds.toIso } },
|
|
569
|
+
groupBy: TRIAGE_HANDOFF_GROUP_BY,
|
|
570
|
+
metrics: OUTCOME_METRICS
|
|
571
|
+
}
|
|
572
|
+
);
|
|
525
573
|
const {
|
|
526
574
|
rows: categoryCounts,
|
|
527
575
|
isLoading: categoryLoading,
|
|
528
576
|
error: categoryError
|
|
529
577
|
} = useAggregate("triage-decision", {
|
|
530
578
|
filter: { decidedAt: { gte: bounds.current.fromIso, lte: bounds.current.toIso } },
|
|
531
|
-
groupBy:
|
|
579
|
+
groupBy: CATEGORY_TRIAGE_GROUP_BY,
|
|
532
580
|
metrics: OUTCOME_METRICS
|
|
533
581
|
});
|
|
534
582
|
const { rows: categoryOutcomes } = useAggregate("generated-response", {
|
|
@@ -538,26 +586,36 @@ function DashboardPage() {
|
|
|
538
586
|
});
|
|
539
587
|
const { rows: categories } = useRecordList("category", { limit: 500 }, toCategory);
|
|
540
588
|
const categoryNames = useMemo(() => toNameMap(categories), [categories]);
|
|
541
|
-
const totals = useMemo(
|
|
589
|
+
const totals = useMemo(
|
|
590
|
+
() => foldOutcomes(dailyRows, dailyTriageRows),
|
|
591
|
+
[dailyRows, dailyTriageRows]
|
|
592
|
+
);
|
|
542
593
|
const compareTotals = useMemo(
|
|
543
|
-
() => bounds.previous === null ? null : foldOutcomes(previousRows),
|
|
544
|
-
[bounds.previous, previousRows]
|
|
594
|
+
() => bounds.previous === null ? null : foldOutcomes(previousRows, previousTriageRows),
|
|
595
|
+
[bounds.previous, previousRows, previousTriageRows]
|
|
545
596
|
);
|
|
546
597
|
const daily = useMemo(() => {
|
|
547
|
-
const folded = foldDailyOutcomes(dailyRows);
|
|
598
|
+
const folded = foldDailyOutcomes(dailyRows, dailyTriageRows);
|
|
548
599
|
return bounds.interval === "day" ? fillMissingDays(folded, bounds.current.fromIso, bounds.current.toIso) : folded;
|
|
549
|
-
}, [dailyRows, bounds]);
|
|
600
|
+
}, [dailyRows, dailyTriageRows, bounds]);
|
|
550
601
|
const rate = autonomyRate(totals);
|
|
551
602
|
const compareRate = compareTotals === null ? Number.NaN : autonomyRate(compareTotals);
|
|
552
603
|
const settled = settledCount(totals);
|
|
553
|
-
const
|
|
554
|
-
const
|
|
604
|
+
const failed = useMemo(() => countFailed(dailyRows), [dailyRows]);
|
|
605
|
+
const signals = useMemo(
|
|
606
|
+
() => dashboardSignals(totals, compareTotals, failed),
|
|
607
|
+
[totals, compareTotals, failed]
|
|
608
|
+
);
|
|
609
|
+
const reasons = useMemo(
|
|
610
|
+
() => foldHumanReasons(dailyRows, dailyTriageRows),
|
|
611
|
+
[dailyRows, dailyTriageRows]
|
|
612
|
+
);
|
|
555
613
|
const categoryBars = useMemo(
|
|
556
614
|
() => foldCategoryOutcomes(categoryCounts, categoryOutcomes, categoryNames),
|
|
557
615
|
[categoryCounts, categoryOutcomes, categoryNames]
|
|
558
616
|
);
|
|
559
617
|
const categoryScale = categoryBars.reduce((max, bar) => Math.max(max, bar.total), 0);
|
|
560
|
-
const loading = dailyLoading || previousLoading;
|
|
618
|
+
const loading = dailyLoading || previousLoading || triageLoading || previousTriageLoading;
|
|
561
619
|
const chartData = daily.map((point) => ({ ...point, jour: dayLabel(point.day) }));
|
|
562
620
|
const bucketWord = bounds.interval === "day" ? "jour" : "semaine";
|
|
563
621
|
return /* @__PURE__ */ jsxs(PageShell, { children: [
|
|
@@ -740,6 +798,18 @@ function DashboardPage() {
|
|
|
740
798
|
label: "Brouillon expir\xE9",
|
|
741
799
|
value: reasons.expired,
|
|
742
800
|
color: "var(--chart-5)"
|
|
801
|
+
},
|
|
802
|
+
{
|
|
803
|
+
key: "escalatedNoDraft",
|
|
804
|
+
label: "Escalad\xE9 sans brouillon",
|
|
805
|
+
value: reasons.escalatedNoDraft,
|
|
806
|
+
color: "var(--chart-4)"
|
|
807
|
+
},
|
|
808
|
+
{
|
|
809
|
+
key: "failed",
|
|
810
|
+
label: "\xC9chec technique",
|
|
811
|
+
value: reasons.failed,
|
|
812
|
+
color: "var(--destructive)"
|
|
743
813
|
}
|
|
744
814
|
]
|
|
745
815
|
}
|
|
@@ -762,16 +832,26 @@ function DashboardPage() {
|
|
|
762
832
|
key: "expired",
|
|
763
833
|
label: `Brouillon expir\xE9 (${formatCount(reasons.expired)})`,
|
|
764
834
|
color: "var(--chart-5)"
|
|
835
|
+
},
|
|
836
|
+
{
|
|
837
|
+
key: "escalatedNoDraft",
|
|
838
|
+
label: `Escalad\xE9 sans brouillon (${formatCount(reasons.escalatedNoDraft)})`,
|
|
839
|
+
color: "var(--chart-4)"
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
key: "failed",
|
|
843
|
+
label: `\xC9chec technique (${formatCount(reasons.failed)})`,
|
|
844
|
+
color: "var(--destructive)"
|
|
765
845
|
}
|
|
766
846
|
]
|
|
767
847
|
}
|
|
768
848
|
),
|
|
769
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs leading-relaxed text-muted-foreground", children: "
|
|
849
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs leading-relaxed text-muted-foreground", children: "\xAB\xA0Bloqu\xE9\xA0\xBB veut dire qu\u2019un brouillon existe et qu\u2019on ne l\u2019a pas envoy\xE9 \u2014 chantier de prompt ou de garde-fou. \xAB\xA0Escalad\xE9 sans brouillon\xA0\xBB veut dire qu\u2019on n\u2019a m\xEAme pas essay\xE9 de r\xE9diger\xA0: le tri a pass\xE9 la main. Le d\xE9tail ticket par ticket est sur la page Escalades." })
|
|
770
850
|
] }) })
|
|
771
851
|
] }),
|
|
772
852
|
/* @__PURE__ */ jsxs(Card, { children: [
|
|
773
853
|
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { className: "text-sm", children: "Signaux \xE0 surveiller" }) }),
|
|
774
|
-
/* @__PURE__ */ jsx(CardContent, { children: signals.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Rien de notable sur cette p\xE9riode \u2014 ou pas assez de demandes r\xE9gl\xE9es pour qu\u2019une comparaison veuille dire quelque chose." }) : /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3", children: signals.map((signal) => /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
|
|
854
|
+
/* @__PURE__ */ jsx(CardContent, { "data-testid": "dashboard-signals", children: loading ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Calcul en cours\u2026" }) : signals.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Rien de notable sur cette p\xE9riode \u2014 ou pas assez de demandes r\xE9gl\xE9es pour qu\u2019une comparaison veuille dire quelque chose." }) : /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3", children: signals.map((signal) => /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
|
|
775
855
|
/* @__PURE__ */ jsx(Badge, { variant: signal.level === "creuser" ? "warning" : "neutral", children: signal.level === "creuser" ? "\xC0 creuser" : "Info" }),
|
|
776
856
|
/* @__PURE__ */ jsx("span", { className: "text-sm leading-relaxed", children: signal.text })
|
|
777
857
|
] }, signal.text)) }) })
|
|
@@ -1042,7 +1122,8 @@ var GENERATED_RESPONSE_STATUS_LABELS = {
|
|
|
1042
1122
|
no_reply_needed: "Aucune r\xE9ponse n\xE9cessaire",
|
|
1043
1123
|
invalidated: "Invalid\xE9e",
|
|
1044
1124
|
expired: "Expir\xE9e",
|
|
1045
|
-
test_draft: "Brouillon d'essai \u2014 jamais envoy\xE9"
|
|
1125
|
+
test_draft: "Brouillon d'essai \u2014 jamais envoy\xE9",
|
|
1126
|
+
superseded: "Remplac\xE9e par une r\xE9ponse plus r\xE9cente"
|
|
1046
1127
|
};
|
|
1047
1128
|
var AUTO_SEND_DECISION_LABELS = {
|
|
1048
1129
|
auto: "Autoris\xE9",
|
|
@@ -1340,6 +1421,8 @@ function deliveryReason(input) {
|
|
|
1340
1421
|
}
|
|
1341
1422
|
case "failed":
|
|
1342
1423
|
return job.error ?? "La r\xE9ponse a \xE9chou\xE9 avant son envoi.";
|
|
1424
|
+
case "superseded":
|
|
1425
|
+
return "Le client a \xE9crit \xE0 nouveau avant l\u2019envoi : une r\xE9ponse plus r\xE9cente a remplac\xE9 celle-ci.";
|
|
1343
1426
|
case "test_draft":
|
|
1344
1427
|
return "Brouillon d'essai \u2014 jamais envoy\xE9.";
|
|
1345
1428
|
default:
|
|
@@ -1442,7 +1525,7 @@ function dedupe(names) {
|
|
|
1442
1525
|
}
|
|
1443
1526
|
function triageTagNames(input) {
|
|
1444
1527
|
const { decision, category, policy } = input;
|
|
1445
|
-
return [decision.tag, ...category?.extraTags ?? [], policy?.audit.handledTag];
|
|
1528
|
+
return [decision.tag, ...category?.extraTags ?? [], policy?.audit.handledTag, policy?.audit.appScopeTag];
|
|
1446
1529
|
}
|
|
1447
1530
|
function wasSimulated(job, policy) {
|
|
1448
1531
|
if (!job) return false;
|
|
@@ -1758,6 +1841,10 @@ var ORIGIN_FILTER_OPTIONS = [
|
|
|
1758
1841
|
{ value: "followup", label: "Messages suivants" },
|
|
1759
1842
|
{ value: "test", label: "Brouillons d'essai" }
|
|
1760
1843
|
];
|
|
1844
|
+
var VIEW_MODE_OPTIONS = [
|
|
1845
|
+
{ value: "byTicket", label: "Une ligne par ticket" },
|
|
1846
|
+
{ value: "all", label: "Toutes les g\xE9n\xE9rations" }
|
|
1847
|
+
];
|
|
1761
1848
|
function OutcomeBadge({ outcome }) {
|
|
1762
1849
|
return /* @__PURE__ */ jsx(Badge, { variant: OUTCOME_BADGE_VARIANT[outcome.variant], children: outcome.label });
|
|
1763
1850
|
}
|
|
@@ -1777,6 +1864,7 @@ function TicketsPage() {
|
|
|
1777
1864
|
const [promptVersionFilter, setPromptVersionFilter] = useState("");
|
|
1778
1865
|
const [correctedFilter, setCorrectedFilter] = useState("");
|
|
1779
1866
|
const [originFilter, setOriginFilter] = useState("");
|
|
1867
|
+
const [viewMode, setViewMode] = useState("byTicket");
|
|
1780
1868
|
const [detailDecision, setDetailDecision] = useState(null);
|
|
1781
1869
|
const [isTriaging, setIsTriaging] = useState(false);
|
|
1782
1870
|
const [isInvalidating, setIsInvalidating] = useState(false);
|
|
@@ -1908,6 +1996,16 @@ function TicketsPage() {
|
|
|
1908
1996
|
return true;
|
|
1909
1997
|
});
|
|
1910
1998
|
}, [decisions, jobByDecisionId, comparisonsByTicketId, outcomeFilter, verdictFilter, promptVersionFilter, correctedFilter, originFilter]);
|
|
1999
|
+
const listRows = useMemo(() => {
|
|
2000
|
+
if (viewMode === "all") return rows.map((row) => ({ ...row, turnCount: 1 }));
|
|
2001
|
+
const byTicket = /* @__PURE__ */ new Map();
|
|
2002
|
+
for (const row of rows) {
|
|
2003
|
+
const seen = byTicket.get(row.decision.ticketId);
|
|
2004
|
+
if (seen) seen.turnCount += 1;
|
|
2005
|
+
else byTicket.set(row.decision.ticketId, { ...row, turnCount: 1 });
|
|
2006
|
+
}
|
|
2007
|
+
return [...byTicket.values()];
|
|
2008
|
+
}, [rows, viewMode]);
|
|
1911
2009
|
const deepLinkConsumed = useRef(false);
|
|
1912
2010
|
useEffect(() => {
|
|
1913
2011
|
if (deepLinkConsumed.current || !requestedTicket) return;
|
|
@@ -1955,6 +2053,16 @@ function TicketsPage() {
|
|
|
1955
2053
|
}
|
|
1956
2054
|
const columns = [
|
|
1957
2055
|
{ key: "ticketId", header: "Ticket", cell: ({ decision }) => /* @__PURE__ */ jsx(TicketLink, { ticketId: decision.ticketId, url: decision.ticketUrl }) },
|
|
2056
|
+
{
|
|
2057
|
+
key: "turns",
|
|
2058
|
+
header: "Tours",
|
|
2059
|
+
// Only a multi-turn ticket is worth marking: badging every row would
|
|
2060
|
+
// make the multi-turn ones invisible by saturation.
|
|
2061
|
+
cell: ({ turnCount }) => turnCount > 1 ? /* @__PURE__ */ jsxs(Badge, { variant: "neutral", children: [
|
|
2062
|
+
turnCount,
|
|
2063
|
+
" tours"
|
|
2064
|
+
] }) : null
|
|
2065
|
+
},
|
|
1958
2066
|
{
|
|
1959
2067
|
key: "origin",
|
|
1960
2068
|
header: "Origine",
|
|
@@ -2060,10 +2168,20 @@ function TicketsPage() {
|
|
|
2060
2168
|
/* @__PURE__ */ jsx(Select, { items: promptVersionOptions, value: promptVersionFilter, onValueChange: setPromptVersionFilter, placeholder: "Toutes versions de prompt", "aria-label": "Filtrer par version de prompt" }),
|
|
2061
2169
|
/* @__PURE__ */ jsx(Select, { items: CORRECTED_OPTIONS, value: correctedFilter, onValueChange: setCorrectedFilter, placeholder: "Corrig\xE9s ou non", "aria-label": "Filtrer par correction humaine" }),
|
|
2062
2170
|
/* @__PURE__ */ jsx(Select, { items: ORIGIN_FILTER_OPTIONS, value: originFilter, onValueChange: setOriginFilter, placeholder: "Toutes origines", "aria-label": "Filtrer par origine" }),
|
|
2063
|
-
|
|
2064
|
-
|
|
2171
|
+
/* @__PURE__ */ jsx(
|
|
2172
|
+
Select,
|
|
2173
|
+
{
|
|
2174
|
+
items: VIEW_MODE_OPTIONS,
|
|
2175
|
+
value: viewMode,
|
|
2176
|
+
onValueChange: (value) => setViewMode(value === "all" ? "all" : "byTicket"),
|
|
2177
|
+
placeholder: "Une ligne par ticket",
|
|
2178
|
+
"aria-label": "Filtrer par mode d'affichage"
|
|
2179
|
+
}
|
|
2180
|
+
),
|
|
2181
|
+
listRows.length > 0 && /* @__PURE__ */ jsxs("span", { className: "ml-auto text-sm text-muted-foreground", children: [
|
|
2182
|
+
listRows.length,
|
|
2065
2183
|
" ticket",
|
|
2066
|
-
|
|
2184
|
+
listRows.length > 1 ? "s" : "",
|
|
2067
2185
|
" sur cette page"
|
|
2068
2186
|
] })
|
|
2069
2187
|
] }),
|
|
@@ -2071,7 +2189,7 @@ function TicketsPage() {
|
|
|
2071
2189
|
DataTable,
|
|
2072
2190
|
{
|
|
2073
2191
|
columns,
|
|
2074
|
-
rows,
|
|
2192
|
+
rows: listRows,
|
|
2075
2193
|
rowId: (row) => row.decision.id,
|
|
2076
2194
|
manual: true,
|
|
2077
2195
|
defaultState: { search: requestedTicket?.trim() ?? "" },
|
|
@@ -4380,6 +4498,7 @@ function SettingsPage() {
|
|
|
4380
4498
|
const claimedView = views.find((v) => v.id === sourceViewId);
|
|
4381
4499
|
const claimUnverifiable = installedAppsUnavailable || uncheckedAppSlugs.length > 0;
|
|
4382
4500
|
const issues = validateSettings(form);
|
|
4501
|
+
const warnings = settingsWarnings(form);
|
|
4383
4502
|
const nodesIssue = issues.find((issue) => issue.key === "nodes");
|
|
4384
4503
|
const summaryIssues = issues.filter((issue) => issue !== nodesIssue);
|
|
4385
4504
|
const guardrailsActive = Array.isArray(form.guardrailsActive) ? form.guardrailsActive : [];
|
|
@@ -4554,11 +4673,14 @@ function SettingsPage() {
|
|
|
4554
4673
|
["escalationTag", "Tag d'escalade"],
|
|
4555
4674
|
["autoRepliedTag", "Tag r\xE9pondu automatiquement"],
|
|
4556
4675
|
["needsReviewTag", "Tag \xE0 revoir avant envoi"],
|
|
4557
|
-
["followupTag", "Tag suivi requis"]
|
|
4676
|
+
["followupTag", "Tag suivi requis"],
|
|
4677
|
+
["appScopeTag", "Tag d'appartenance"]
|
|
4558
4678
|
].map(([key, label]) => /* @__PURE__ */ jsxs("div", { children: [
|
|
4559
4679
|
/* @__PURE__ */ jsx("label", { htmlFor: key, className: "mb-1 block text-sm font-medium", children: label }),
|
|
4560
4680
|
/* @__PURE__ */ jsx(Input, { id: key, value: field(form[key]), onChange: (e) => set(key, e.target.value), disabled: !canWrite })
|
|
4561
|
-
] }, key))
|
|
4681
|
+
] }, key)),
|
|
4682
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Le tag d\u2019appartenance est pos\xE9 sur chaque ticket que le triage examine, dans le m\xEAme appel que les tags ci-dessus. Il doit \xEAtre propre \xE0 cette app : c\u2019est lui qui distingue ses tickets de ceux d\u2019une autre app install\xE9e sur le m\xEAme compte Gorgias." }),
|
|
4683
|
+
warnings.map((warning) => /* @__PURE__ */ jsx("p", { className: "text-sm text-status-pending", children: warning.message }, warning.key))
|
|
4562
4684
|
] }) }),
|
|
4563
4685
|
/* @__PURE__ */ jsx(
|
|
4564
4686
|
FollowupWebhookCard,
|
|
@@ -6098,6 +6220,7 @@ function tagOrigin(tag, settings) {
|
|
|
6098
6220
|
if (tag === str(settings.followupTag)) return "tag de suivi";
|
|
6099
6221
|
if (tag === str(settings.escalationTag)) return "tag d'escalade";
|
|
6100
6222
|
if (tag === str(settings.handledTag)) return "tag de traitement";
|
|
6223
|
+
if (tag === str(settings.appScopeTag)) return "tag d'appartenance";
|
|
6101
6224
|
if (tag === str(settings.unknownTag)) return "classification de repli";
|
|
6102
6225
|
return "classification";
|
|
6103
6226
|
}
|