@apotech-os/support-kit 2.9.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-CVYJU4SV.js → chunk-KCPVWKUY.js} +7 -13
- package/dist/chunk-KCPVWKUY.js.map +1 -0
- package/dist/index.cjs +45 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -24
- package/dist/index.d.ts +23 -24
- package/dist/index.js +43 -21
- package/dist/index.js.map +1 -1
- package/dist/ui/index.cjs +579 -422
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.js +410 -253
- package/dist/ui/index.js.map +1 -1
- package/package.json +5 -5
- package/dist/chunk-CVYJU4SV.js.map +0 -1
package/dist/ui/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GENERATED_RESPONSE_STATUSES, EVALUATION_VERDICTS, WHATSAPP_MODES, validateSettings, AGENT_GUARDRAILS, toCategory, toTriageDecision, toAgent, toGeneratedResponse, isGeneratedResponseStatus, toCategoryGroup, toResponseComparison, toDiffAnalysis, NODE_NAMES, settingsToProfile, hasNoDraftNode, guardrailBucket,
|
|
1
|
+
import { GENERATED_RESPONSE_STATUSES, EVALUATION_VERDICTS, WHATSAPP_MODES, validateSettings, AGENT_GUARDRAILS, toCategory, toTriageDecision, toAgent, toGeneratedResponse, isGeneratedResponseStatus, toCategoryGroup, toResponseComparison, toDiffAnalysis, NODE_NAMES, settingsToProfile, hasNoDraftNode, guardrailBucket, DEFAULT_LLM_PROVIDER, computeWordDiff, isSendableVerdict, DEFAULT_MAX_TOOL_CALLS, DEFAULT_MIN_CONFIDENCE, DEFAULT_ESCALATION_ENABLED } from '../chunk-KCPVWKUY.js';
|
|
2
2
|
import { useState, useMemo, useRef, useEffect, useCallback, useId } from 'react';
|
|
3
3
|
import { useAppContext, useAppSettings, Card, CardContent, Button, Link, KpiCard, BarChart, StackedBarChart, DataTable, Select, useAppApi, useToast, Badge, FunnelChart, Spinner, LineChart, Input, Switch, Checkbox, Textarea, cn, SidePanel, CopyButton, Modal, Tooltip, AppInvokeError } from '@apotech-os/ui-sdk';
|
|
4
4
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
@@ -1391,6 +1391,216 @@ function PipelinePage() {
|
|
|
1391
1391
|
)
|
|
1392
1392
|
] });
|
|
1393
1393
|
}
|
|
1394
|
+
|
|
1395
|
+
// src/ui/settings/pipeline-nodes.ts
|
|
1396
|
+
var PIPELINE_STEP_KEYS = ["triage", "escalate", "draft", "evaluate", "revise"];
|
|
1397
|
+
var PIPELINE_STEPS = [
|
|
1398
|
+
{
|
|
1399
|
+
key: "triage",
|
|
1400
|
+
label: "Triage",
|
|
1401
|
+
description: "comprend et classe chaque demande entrante",
|
|
1402
|
+
requires: null,
|
|
1403
|
+
blockedReason: null
|
|
1404
|
+
},
|
|
1405
|
+
{
|
|
1406
|
+
key: "escalate",
|
|
1407
|
+
label: "Escalade",
|
|
1408
|
+
description: "passe la main \xE0 un humain",
|
|
1409
|
+
requires: null,
|
|
1410
|
+
blockedReason: null
|
|
1411
|
+
},
|
|
1412
|
+
{
|
|
1413
|
+
key: "draft",
|
|
1414
|
+
label: "R\xE9daction",
|
|
1415
|
+
description: "pr\xE9pare un projet de r\xE9ponse",
|
|
1416
|
+
requires: null,
|
|
1417
|
+
blockedReason: null
|
|
1418
|
+
},
|
|
1419
|
+
{
|
|
1420
|
+
key: "evaluate",
|
|
1421
|
+
label: "\xC9valuation",
|
|
1422
|
+
description: "relit la r\xE9ponse avant envoi",
|
|
1423
|
+
requires: "draft",
|
|
1424
|
+
blockedReason: "Il n'y a rien \xE0 \xE9valuer sans r\xE9daction."
|
|
1425
|
+
},
|
|
1426
|
+
{
|
|
1427
|
+
key: "revise",
|
|
1428
|
+
label: "R\xE9vision",
|
|
1429
|
+
description: "r\xE9\xE9crit la r\xE9ponse si l'\xE9valuation la juge insuffisante",
|
|
1430
|
+
requires: "evaluate",
|
|
1431
|
+
blockedReason: "Sans \xE9valuation, rien ne d\xE9clenche une r\xE9vision."
|
|
1432
|
+
}
|
|
1433
|
+
];
|
|
1434
|
+
var TRIAGE_LOCK_REASON = "Sans triage l'app ne traite rien.";
|
|
1435
|
+
var STEP_BY_KEY = new Map(PIPELINE_STEPS.map((step) => [step.key, step]));
|
|
1436
|
+
function pipelineStep(key) {
|
|
1437
|
+
const step = STEP_BY_KEY.get(key);
|
|
1438
|
+
if (!step) throw new Error(`unknown pipeline step: ${key}`);
|
|
1439
|
+
return step;
|
|
1440
|
+
}
|
|
1441
|
+
function readNodes(value) {
|
|
1442
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return {};
|
|
1443
|
+
return value;
|
|
1444
|
+
}
|
|
1445
|
+
function readStep(value, key) {
|
|
1446
|
+
const step = readNodes(value)[key];
|
|
1447
|
+
if (typeof step !== "object" || step === null || Array.isArray(step)) return null;
|
|
1448
|
+
return step;
|
|
1449
|
+
}
|
|
1450
|
+
function isStepEnabled(value, key) {
|
|
1451
|
+
return readStep(value, key) !== null;
|
|
1452
|
+
}
|
|
1453
|
+
function stepBlockedReason(value, key) {
|
|
1454
|
+
const { requires, blockedReason } = pipelineStep(key);
|
|
1455
|
+
if (!requires) return null;
|
|
1456
|
+
return isStepActive(value, requires) ? null : blockedReason;
|
|
1457
|
+
}
|
|
1458
|
+
function isStepActive(value, key) {
|
|
1459
|
+
return isStepEnabled(value, key) && stepBlockedReason(value, key) === null;
|
|
1460
|
+
}
|
|
1461
|
+
function withStep(value, key, step) {
|
|
1462
|
+
return { ...readNodes(value), [key]: step };
|
|
1463
|
+
}
|
|
1464
|
+
function withStepFields(value, key, patch) {
|
|
1465
|
+
const step = readStep(value, key);
|
|
1466
|
+
if (!step) return readNodes(value);
|
|
1467
|
+
const next = { ...step };
|
|
1468
|
+
for (const [field2, fieldValue] of Object.entries(patch)) {
|
|
1469
|
+
if (fieldValue === void 0) delete next[field2];
|
|
1470
|
+
else next[field2] = fieldValue;
|
|
1471
|
+
}
|
|
1472
|
+
return withStep(value, key, next);
|
|
1473
|
+
}
|
|
1474
|
+
function stepString(step, field2) {
|
|
1475
|
+
const value = step?.[field2];
|
|
1476
|
+
return typeof value === "string" ? value : "";
|
|
1477
|
+
}
|
|
1478
|
+
function stepNumber(step, field2, fallback) {
|
|
1479
|
+
const value = step?.[field2];
|
|
1480
|
+
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
1481
|
+
}
|
|
1482
|
+
function stepBoolean(step, field2, fallback) {
|
|
1483
|
+
const value = step?.[field2];
|
|
1484
|
+
return typeof value === "boolean" ? value : fallback;
|
|
1485
|
+
}
|
|
1486
|
+
function stepUsesAgentPrompt(key) {
|
|
1487
|
+
return key === "draft" || key === "revise";
|
|
1488
|
+
}
|
|
1489
|
+
var DEFAULT_PROMPT_LABEL = "production";
|
|
1490
|
+
function stepPromptName(step) {
|
|
1491
|
+
return readPromptField(step, "name");
|
|
1492
|
+
}
|
|
1493
|
+
function stepPromptLabel(step) {
|
|
1494
|
+
return readPromptField(step, "label") || DEFAULT_PROMPT_LABEL;
|
|
1495
|
+
}
|
|
1496
|
+
function readPromptField(step, field2) {
|
|
1497
|
+
const prompt = step?.prompt;
|
|
1498
|
+
if (typeof prompt !== "object" || prompt === null) return "";
|
|
1499
|
+
const value = prompt[field2];
|
|
1500
|
+
return typeof value === "string" ? value : "";
|
|
1501
|
+
}
|
|
1502
|
+
function promptPatch(name, label) {
|
|
1503
|
+
return { prompt: { name, label } };
|
|
1504
|
+
}
|
|
1505
|
+
function stepReasoning(step) {
|
|
1506
|
+
const value = step?.reasoning;
|
|
1507
|
+
return REASONING_EFFORTS.some((effort) => effort.value === value) ? value : "off";
|
|
1508
|
+
}
|
|
1509
|
+
var REASONING_EFFORTS = [
|
|
1510
|
+
{ value: "off", label: "Aucun" },
|
|
1511
|
+
{ value: "low", label: "L\xE9ger" },
|
|
1512
|
+
{ value: "medium", label: "Moyen" },
|
|
1513
|
+
{ value: "high", label: "Pouss\xE9" }
|
|
1514
|
+
];
|
|
1515
|
+
var CUSTOM_MODEL_VALUE = "__custom__";
|
|
1516
|
+
var DEFAULT_STEP_MODEL = "gpt-4o-mini";
|
|
1517
|
+
var DEFAULT_STEP_PROVIDER = "openai";
|
|
1518
|
+
function defaultStep() {
|
|
1519
|
+
return { model: DEFAULT_STEP_MODEL, provider: DEFAULT_STEP_PROVIDER, reasoning: "off" };
|
|
1520
|
+
}
|
|
1521
|
+
var PIPELINE_PRESETS = [
|
|
1522
|
+
{
|
|
1523
|
+
id: "triage-only",
|
|
1524
|
+
label: "D\xE9marrage prudent \u2014 triage seul",
|
|
1525
|
+
description: "Les demandes sont comprises et class\xE9es. Aucune r\xE9ponse n\u2019est pr\xE9par\xE9e.",
|
|
1526
|
+
enabled: ["triage"]
|
|
1527
|
+
},
|
|
1528
|
+
{
|
|
1529
|
+
id: "assisted",
|
|
1530
|
+
label: "R\xE9ponse assist\xE9e",
|
|
1531
|
+
description: "Triage, escalade et r\xE9daction : un projet de r\xE9ponse est pr\xE9par\xE9 pour un humain. L\u2019envoi automatique reste d\xE9sactiv\xE9.",
|
|
1532
|
+
enabled: ["triage", "escalate", "draft"]
|
|
1533
|
+
}
|
|
1534
|
+
];
|
|
1535
|
+
function applyPreset(value, preset, restore) {
|
|
1536
|
+
let next = readNodes(value);
|
|
1537
|
+
for (const key of PIPELINE_STEP_KEYS) {
|
|
1538
|
+
const on = preset.enabled.includes(key);
|
|
1539
|
+
next = withStep(next, key, on ? readStep(next, key) ?? restore(key) : null);
|
|
1540
|
+
}
|
|
1541
|
+
return next;
|
|
1542
|
+
}
|
|
1543
|
+
function usePromptCatalogue() {
|
|
1544
|
+
const { appSlug } = useAppContext();
|
|
1545
|
+
const api = useAppApi();
|
|
1546
|
+
const [prompts, setPrompts] = useState([]);
|
|
1547
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
1548
|
+
const [error, setError] = useState(void 0);
|
|
1549
|
+
const clientRef = useRef(api);
|
|
1550
|
+
clientRef.current = api;
|
|
1551
|
+
const requestIdRef = useRef(0);
|
|
1552
|
+
const isMountedRef = useRef(true);
|
|
1553
|
+
useEffect(() => {
|
|
1554
|
+
isMountedRef.current = true;
|
|
1555
|
+
const requestId = ++requestIdRef.current;
|
|
1556
|
+
setIsLoading(true);
|
|
1557
|
+
void clientRef.current.get(`/data/apps/${appSlug}/prompts`).then((catalogue) => {
|
|
1558
|
+
if (requestId !== requestIdRef.current || !isMountedRef.current) return;
|
|
1559
|
+
setPrompts(catalogue);
|
|
1560
|
+
setError(void 0);
|
|
1561
|
+
}).catch((err) => {
|
|
1562
|
+
if (requestId !== requestIdRef.current || !isMountedRef.current) return;
|
|
1563
|
+
setError(err);
|
|
1564
|
+
}).finally(() => {
|
|
1565
|
+
if (requestId !== requestIdRef.current || !isMountedRef.current) return;
|
|
1566
|
+
setIsLoading(false);
|
|
1567
|
+
});
|
|
1568
|
+
return () => {
|
|
1569
|
+
isMountedRef.current = false;
|
|
1570
|
+
};
|
|
1571
|
+
}, [appSlug]);
|
|
1572
|
+
return { prompts, isLoading, error };
|
|
1573
|
+
}
|
|
1574
|
+
function useModelCatalogue() {
|
|
1575
|
+
const api = useAppApi();
|
|
1576
|
+
const [models, setModels] = useState([]);
|
|
1577
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
1578
|
+
const [error, setError] = useState(void 0);
|
|
1579
|
+
const clientRef = useRef(api);
|
|
1580
|
+
clientRef.current = api;
|
|
1581
|
+
const requestIdRef = useRef(0);
|
|
1582
|
+
const isMountedRef = useRef(true);
|
|
1583
|
+
useEffect(() => {
|
|
1584
|
+
isMountedRef.current = true;
|
|
1585
|
+
const requestId = ++requestIdRef.current;
|
|
1586
|
+
setIsLoading(true);
|
|
1587
|
+
void clientRef.current.get("/data/llm/models").then((catalogue) => {
|
|
1588
|
+
if (requestId !== requestIdRef.current || !isMountedRef.current) return;
|
|
1589
|
+
setModels(catalogue.models);
|
|
1590
|
+
setError(void 0);
|
|
1591
|
+
}).catch((err) => {
|
|
1592
|
+
if (requestId !== requestIdRef.current || !isMountedRef.current) return;
|
|
1593
|
+
setError(err);
|
|
1594
|
+
}).finally(() => {
|
|
1595
|
+
if (requestId !== requestIdRef.current || !isMountedRef.current) return;
|
|
1596
|
+
setIsLoading(false);
|
|
1597
|
+
});
|
|
1598
|
+
return () => {
|
|
1599
|
+
isMountedRef.current = false;
|
|
1600
|
+
};
|
|
1601
|
+
}, []);
|
|
1602
|
+
return { models, isLoading, error };
|
|
1603
|
+
}
|
|
1394
1604
|
function ConfirmModal({
|
|
1395
1605
|
title,
|
|
1396
1606
|
description,
|
|
@@ -1560,18 +1770,34 @@ var STATUS_VARIANT = {
|
|
|
1560
1770
|
archived: "outline"
|
|
1561
1771
|
};
|
|
1562
1772
|
function emptyForm() {
|
|
1563
|
-
return {
|
|
1773
|
+
return {
|
|
1774
|
+
name: "",
|
|
1775
|
+
modelId: "",
|
|
1776
|
+
provider: DEFAULT_LLM_PROVIDER,
|
|
1777
|
+
status: "available",
|
|
1778
|
+
promptName: "",
|
|
1779
|
+
promptLabel: "",
|
|
1780
|
+
systemPromptSnapshot: ""
|
|
1781
|
+
};
|
|
1564
1782
|
}
|
|
1565
1783
|
function formFromAgent(agent) {
|
|
1566
1784
|
return {
|
|
1567
1785
|
name: agent.name,
|
|
1568
1786
|
modelId: agent.modelId,
|
|
1569
1787
|
provider: agent.provider,
|
|
1788
|
+
status: agent.status,
|
|
1789
|
+
promptName: agent.promptName,
|
|
1790
|
+
promptLabel: agent.promptLabel ?? "",
|
|
1570
1791
|
systemPromptSnapshot: agent.systemPromptSnapshot ?? ""
|
|
1571
1792
|
};
|
|
1572
1793
|
}
|
|
1794
|
+
var DERIVED_PROMPT_VALUE = "__derived__";
|
|
1795
|
+
var CUSTOM_PROMPT_VALUE = "__custom-prompt__";
|
|
1796
|
+
var DEFAULT_LABEL_VALUE = "__production__";
|
|
1573
1797
|
function AgentFormModal({
|
|
1574
1798
|
agent,
|
|
1799
|
+
prompts,
|
|
1800
|
+
promptsLoading,
|
|
1575
1801
|
onClose,
|
|
1576
1802
|
onSave
|
|
1577
1803
|
}) {
|
|
@@ -1579,10 +1805,20 @@ function AgentFormModal({
|
|
|
1579
1805
|
agent === "new" ? emptyForm() : formFromAgent(agent)
|
|
1580
1806
|
);
|
|
1581
1807
|
const [isSaving, setIsSaving] = useState(false);
|
|
1808
|
+
const [freeTextModel, setFreeTextModel] = useState(false);
|
|
1809
|
+
const [freeTextPrompt, setFreeTextPrompt] = useState(false);
|
|
1582
1810
|
const nameId = useId();
|
|
1583
|
-
const
|
|
1811
|
+
const modelInputId = useId();
|
|
1812
|
+
const providerInputId = useId();
|
|
1813
|
+
const promptInputId = useId();
|
|
1584
1814
|
const snapshotId = useId();
|
|
1585
|
-
const
|
|
1815
|
+
const { models, isLoading: modelsLoading } = useModelCatalogue();
|
|
1816
|
+
const knownModel = models.includes(form.modelId);
|
|
1817
|
+
const showModelFreeText = freeTextModel || form.modelId !== "" && !knownModel && !modelsLoading;
|
|
1818
|
+
const knownPrompt = prompts.find((entry) => entry.name === form.promptName);
|
|
1819
|
+
const showPromptFreeText = freeTextPrompt || agent !== "new" && form.promptName !== "" && !knownPrompt && !promptsLoading;
|
|
1820
|
+
const promptLabels = knownPrompt?.labels ?? [];
|
|
1821
|
+
const isValid = form.name.trim() !== "" && form.modelId.trim() !== "" && (agent === "new" || form.promptName.trim() !== "");
|
|
1586
1822
|
async function submit(event) {
|
|
1587
1823
|
event.preventDefault();
|
|
1588
1824
|
if (isSaving || !isValid) return;
|
|
@@ -1593,6 +1829,14 @@ function AgentFormModal({
|
|
|
1593
1829
|
setIsSaving(false);
|
|
1594
1830
|
}
|
|
1595
1831
|
}
|
|
1832
|
+
function pickPrompt(next) {
|
|
1833
|
+
if (next === CUSTOM_PROMPT_VALUE) {
|
|
1834
|
+
setFreeTextPrompt(true);
|
|
1835
|
+
return;
|
|
1836
|
+
}
|
|
1837
|
+
setFreeTextPrompt(false);
|
|
1838
|
+
setForm({ ...form, promptName: next === DERIVED_PROMPT_VALUE ? "" : next, promptLabel: "" });
|
|
1839
|
+
}
|
|
1596
1840
|
return /* @__PURE__ */ jsx(
|
|
1597
1841
|
Modal,
|
|
1598
1842
|
{
|
|
@@ -1604,24 +1848,109 @@ function AgentFormModal({
|
|
|
1604
1848
|
/* @__PURE__ */ jsx("label", { htmlFor: nameId, className: "mb-1 block text-sm font-medium", children: "Nom" }),
|
|
1605
1849
|
/* @__PURE__ */ jsx(Input, { id: nameId, value: form.name, onChange: (e) => setForm({ ...form, name: e.target.value }) })
|
|
1606
1850
|
] }),
|
|
1607
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
1608
|
-
/* @__PURE__ */ jsx("
|
|
1851
|
+
agent !== "new" && agent.status !== "default" && /* @__PURE__ */ jsxs("div", { children: [
|
|
1852
|
+
/* @__PURE__ */ jsx("p", { className: "mb-1 text-sm font-medium", children: "Statut" }),
|
|
1609
1853
|
/* @__PURE__ */ jsx(
|
|
1610
|
-
|
|
1854
|
+
Select,
|
|
1611
1855
|
{
|
|
1612
|
-
|
|
1613
|
-
value: form.
|
|
1614
|
-
|
|
1856
|
+
"aria-label": "Statut",
|
|
1857
|
+
value: form.status,
|
|
1858
|
+
onValueChange: (next) => setForm({ ...form, status: next }),
|
|
1859
|
+
items: [
|
|
1860
|
+
{ value: "available", label: STATUS_LABELS.available },
|
|
1861
|
+
{ value: "archived", label: STATUS_LABELS.archived }
|
|
1862
|
+
]
|
|
1615
1863
|
}
|
|
1616
1864
|
)
|
|
1617
1865
|
] }),
|
|
1618
1866
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
1619
|
-
/* @__PURE__ */ jsx("p", { className: "mb-1 text-sm font-medium", children: "
|
|
1620
|
-
/* @__PURE__ */
|
|
1621
|
-
|
|
1622
|
-
|
|
1867
|
+
/* @__PURE__ */ jsx("p", { className: "mb-1 text-sm font-medium", children: "Mod\xE8le" }),
|
|
1868
|
+
/* @__PURE__ */ jsx(
|
|
1869
|
+
Select,
|
|
1870
|
+
{
|
|
1871
|
+
"aria-label": "Mod\xE8le",
|
|
1872
|
+
value: showModelFreeText ? CUSTOM_MODEL_VALUE : knownModel ? form.modelId : void 0,
|
|
1873
|
+
onValueChange: (next) => {
|
|
1874
|
+
if (next === CUSTOM_MODEL_VALUE) {
|
|
1875
|
+
setFreeTextModel(true);
|
|
1876
|
+
return;
|
|
1877
|
+
}
|
|
1878
|
+
setFreeTextModel(false);
|
|
1879
|
+
setForm({ ...form, modelId: next, provider: DEFAULT_STEP_PROVIDER });
|
|
1880
|
+
},
|
|
1881
|
+
items: [
|
|
1882
|
+
...models.map((name) => ({ value: name, label: name })),
|
|
1883
|
+
{ value: CUSTOM_MODEL_VALUE, label: "Autre \u2014 saisir un identifiant de mod\xE8le" }
|
|
1884
|
+
],
|
|
1885
|
+
disabled: modelsLoading
|
|
1886
|
+
}
|
|
1887
|
+
),
|
|
1888
|
+
showModelFreeText && /* @__PURE__ */ jsxs("div", { className: "mt-2 space-y-2", children: [
|
|
1889
|
+
/* @__PURE__ */ jsx("label", { htmlFor: modelInputId, className: "mb-1 block text-sm font-medium", children: "Identifiant de mod\xE8le" }),
|
|
1890
|
+
/* @__PURE__ */ jsx(
|
|
1891
|
+
Input,
|
|
1892
|
+
{
|
|
1893
|
+
id: modelInputId,
|
|
1894
|
+
value: form.modelId,
|
|
1895
|
+
onChange: (e) => setForm({ ...form, modelId: e.target.value })
|
|
1896
|
+
}
|
|
1897
|
+
),
|
|
1898
|
+
/* @__PURE__ */ jsx("label", { htmlFor: providerInputId, className: "mb-1 block text-sm font-medium", children: "Fournisseur" }),
|
|
1899
|
+
/* @__PURE__ */ jsx(
|
|
1900
|
+
Input,
|
|
1901
|
+
{
|
|
1902
|
+
id: providerInputId,
|
|
1903
|
+
value: form.provider,
|
|
1904
|
+
onChange: (e) => setForm({ ...form, provider: e.target.value })
|
|
1905
|
+
}
|
|
1906
|
+
)
|
|
1623
1907
|
] })
|
|
1624
1908
|
] }),
|
|
1909
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1910
|
+
/* @__PURE__ */ jsx("p", { className: "mb-1 text-sm font-medium", children: "Prompt Langfuse" }),
|
|
1911
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-2 sm:grid-cols-2", children: [
|
|
1912
|
+
/* @__PURE__ */ jsx(
|
|
1913
|
+
Select,
|
|
1914
|
+
{
|
|
1915
|
+
"aria-label": "Prompt Langfuse",
|
|
1916
|
+
value: showPromptFreeText ? CUSTOM_PROMPT_VALUE : knownPrompt ? form.promptName : agent === "new" ? DERIVED_PROMPT_VALUE : void 0,
|
|
1917
|
+
onValueChange: pickPrompt,
|
|
1918
|
+
items: [
|
|
1919
|
+
...agent === "new" ? [{ value: DERIVED_PROMPT_VALUE, label: "Nouveau prompt \u2014 agent/<g\xE9n\xE9r\xE9 automatiquement>" }] : [],
|
|
1920
|
+
...prompts.map((entry) => ({ value: entry.name, label: entry.name })),
|
|
1921
|
+
{ value: CUSTOM_PROMPT_VALUE, label: "Autre \u2014 saisir un nom de prompt" }
|
|
1922
|
+
],
|
|
1923
|
+
disabled: promptsLoading
|
|
1924
|
+
}
|
|
1925
|
+
),
|
|
1926
|
+
/* @__PURE__ */ jsx(
|
|
1927
|
+
Select,
|
|
1928
|
+
{
|
|
1929
|
+
"aria-label": "Tag du prompt",
|
|
1930
|
+
value: form.promptLabel === "" ? DEFAULT_LABEL_VALUE : form.promptLabel,
|
|
1931
|
+
onValueChange: (next) => setForm({ ...form, promptLabel: next === DEFAULT_LABEL_VALUE ? "" : next }),
|
|
1932
|
+
items: [
|
|
1933
|
+
{ value: DEFAULT_LABEL_VALUE, label: "production (par d\xE9faut)" },
|
|
1934
|
+
...promptLabels.filter((label) => label !== DEFAULT_PROMPT_LABEL).map((label) => ({ value: label, label })),
|
|
1935
|
+
...form.promptLabel !== "" && !promptLabels.includes(form.promptLabel) ? [{ value: form.promptLabel, label: form.promptLabel }] : []
|
|
1936
|
+
],
|
|
1937
|
+
disabled: promptsLoading || form.promptName === "" && !showPromptFreeText
|
|
1938
|
+
}
|
|
1939
|
+
)
|
|
1940
|
+
] }),
|
|
1941
|
+
showPromptFreeText && /* @__PURE__ */ jsxs("div", { className: "mt-2", children: [
|
|
1942
|
+
/* @__PURE__ */ jsx("label", { htmlFor: promptInputId, className: "mb-1 block text-sm font-medium", children: "Nom du prompt Langfuse" }),
|
|
1943
|
+
/* @__PURE__ */ jsx(
|
|
1944
|
+
Input,
|
|
1945
|
+
{
|
|
1946
|
+
id: promptInputId,
|
|
1947
|
+
value: form.promptName,
|
|
1948
|
+
onChange: (e) => setForm({ ...form, promptName: e.target.value })
|
|
1949
|
+
}
|
|
1950
|
+
)
|
|
1951
|
+
] }),
|
|
1952
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: "Laisser sur \xAB Nouveau prompt \xBB pour en cr\xE9er un ; choisir un prompt existant pour y rattacher l'agent. Le nom est \xE9crit tel quel, sans normalisation." })
|
|
1953
|
+
] }),
|
|
1625
1954
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
1626
1955
|
/* @__PURE__ */ jsx("label", { htmlFor: snapshotId, className: "mb-1 block text-sm font-medium", children: "Prompt de secours (niveau 3)" }),
|
|
1627
1956
|
/* @__PURE__ */ jsx(
|
|
@@ -1821,6 +2150,8 @@ function AgentsPage() {
|
|
|
1821
2150
|
const [formAgent, setFormAgent] = useState(null);
|
|
1822
2151
|
const [versionsAgent, setVersionsAgent] = useState(null);
|
|
1823
2152
|
const [deletingAgent, setDeletingAgent] = useState(null);
|
|
2153
|
+
const { prompts, isLoading: promptsLoading, error: promptsError } = usePromptCatalogue();
|
|
2154
|
+
const promptExists = (name) => promptsLoading || promptsError !== void 0 || prompts.some((entry) => entry.name === name);
|
|
1824
2155
|
const recordPath = (id) => `/data/apps/${appSlug}/records/agent/${id}`;
|
|
1825
2156
|
async function patchStatus(agent, status) {
|
|
1826
2157
|
try {
|
|
@@ -1856,12 +2187,30 @@ function AgentsPage() {
|
|
|
1856
2187
|
if (formAgent === "new") {
|
|
1857
2188
|
await api.invoke(
|
|
1858
2189
|
"create-agent",
|
|
1859
|
-
{
|
|
2190
|
+
{
|
|
2191
|
+
name: form.name,
|
|
2192
|
+
modelId: form.modelId,
|
|
2193
|
+
provider: form.provider,
|
|
2194
|
+
systemPromptSnapshot: form.systemPromptSnapshot,
|
|
2195
|
+
// Verbatim (trim only) — empty means "derive agent/<id>", and an
|
|
2196
|
+
// empty label means "follow production" (stored null, never the
|
|
2197
|
+
// literal string).
|
|
2198
|
+
promptName: form.promptName.trim(),
|
|
2199
|
+
promptLabel: form.promptLabel.trim()
|
|
2200
|
+
},
|
|
1860
2201
|
{ idempotencyKey: crypto.randomUUID() }
|
|
1861
2202
|
);
|
|
1862
2203
|
} else if (formAgent) {
|
|
1863
2204
|
await api.patch(recordPath(formAgent.id), {
|
|
1864
|
-
data: {
|
|
2205
|
+
data: {
|
|
2206
|
+
name: form.name,
|
|
2207
|
+
modelId: form.modelId,
|
|
2208
|
+
provider: form.provider,
|
|
2209
|
+
systemPromptSnapshot: form.systemPromptSnapshot,
|
|
2210
|
+
promptName: form.promptName.trim(),
|
|
2211
|
+
promptLabel: form.promptLabel.trim() || null,
|
|
2212
|
+
...formAgent.status !== "default" ? { status: form.status } : {}
|
|
2213
|
+
}
|
|
1865
2214
|
});
|
|
1866
2215
|
}
|
|
1867
2216
|
setFormAgent(null);
|
|
@@ -1882,7 +2231,14 @@ function AgentsPage() {
|
|
|
1882
2231
|
header: "Statut",
|
|
1883
2232
|
cell: (row) => /* @__PURE__ */ jsx(Badge, { variant: STATUS_VARIANT[row.status] ?? "neutral", children: STATUS_LABELS[row.status] ?? row.status })
|
|
1884
2233
|
},
|
|
1885
|
-
{
|
|
2234
|
+
{
|
|
2235
|
+
key: "promptName",
|
|
2236
|
+
header: "Prompt",
|
|
2237
|
+
cell: (row) => /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-2", children: [
|
|
2238
|
+
row.promptName,
|
|
2239
|
+
!promptExists(row.promptName) && /* @__PURE__ */ jsx(Badge, { variant: "warning", children: "prompt introuvable chez Langfuse" })
|
|
2240
|
+
] })
|
|
2241
|
+
},
|
|
1886
2242
|
{
|
|
1887
2243
|
key: "actions",
|
|
1888
2244
|
header: "",
|
|
@@ -1928,7 +2284,16 @@ function AgentsPage() {
|
|
|
1928
2284
|
empty: "Aucun agent configur\xE9."
|
|
1929
2285
|
}
|
|
1930
2286
|
),
|
|
1931
|
-
formAgent && /* @__PURE__ */ jsx(
|
|
2287
|
+
formAgent && /* @__PURE__ */ jsx(
|
|
2288
|
+
AgentFormModal,
|
|
2289
|
+
{
|
|
2290
|
+
agent: formAgent,
|
|
2291
|
+
prompts,
|
|
2292
|
+
promptsLoading,
|
|
2293
|
+
onClose: () => setFormAgent(null),
|
|
2294
|
+
onSave: save
|
|
2295
|
+
}
|
|
2296
|
+
),
|
|
1932
2297
|
versionsAgent && /* @__PURE__ */ jsx(PromptVersionsPanel, { agent: versionsAgent, canWrite, onClose: () => setVersionsAgent(null) }),
|
|
1933
2298
|
deletingAgent && /* @__PURE__ */ jsx(
|
|
1934
2299
|
ConfirmModal,
|
|
@@ -2977,195 +3342,6 @@ function NumberField({ id, label, value, onChange, disabled, min, max, integer,
|
|
|
2977
3342
|
hint && /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: hint })
|
|
2978
3343
|
] });
|
|
2979
3344
|
}
|
|
2980
|
-
|
|
2981
|
-
// src/ui/settings/pipeline-nodes.ts
|
|
2982
|
-
var PIPELINE_STEP_KEYS = ["triage", "escalate", "draft", "evaluate", "revise"];
|
|
2983
|
-
var PIPELINE_STEPS = [
|
|
2984
|
-
{
|
|
2985
|
-
key: "triage",
|
|
2986
|
-
label: "Triage",
|
|
2987
|
-
description: "comprend et classe chaque demande entrante",
|
|
2988
|
-
requires: null,
|
|
2989
|
-
blockedReason: null
|
|
2990
|
-
},
|
|
2991
|
-
{
|
|
2992
|
-
key: "escalate",
|
|
2993
|
-
label: "Escalade",
|
|
2994
|
-
description: "passe la main \xE0 un humain",
|
|
2995
|
-
requires: null,
|
|
2996
|
-
blockedReason: null
|
|
2997
|
-
},
|
|
2998
|
-
{
|
|
2999
|
-
key: "draft",
|
|
3000
|
-
label: "R\xE9daction",
|
|
3001
|
-
description: "pr\xE9pare un projet de r\xE9ponse",
|
|
3002
|
-
requires: null,
|
|
3003
|
-
blockedReason: null
|
|
3004
|
-
},
|
|
3005
|
-
{
|
|
3006
|
-
key: "evaluate",
|
|
3007
|
-
label: "\xC9valuation",
|
|
3008
|
-
description: "relit la r\xE9ponse avant envoi",
|
|
3009
|
-
requires: "draft",
|
|
3010
|
-
blockedReason: "Il n'y a rien \xE0 \xE9valuer sans r\xE9daction."
|
|
3011
|
-
},
|
|
3012
|
-
{
|
|
3013
|
-
key: "revise",
|
|
3014
|
-
label: "R\xE9vision",
|
|
3015
|
-
description: "r\xE9\xE9crit la r\xE9ponse si l'\xE9valuation la juge insuffisante",
|
|
3016
|
-
requires: "evaluate",
|
|
3017
|
-
blockedReason: "Sans \xE9valuation, rien ne d\xE9clenche une r\xE9vision."
|
|
3018
|
-
}
|
|
3019
|
-
];
|
|
3020
|
-
var TRIAGE_LOCK_REASON = "Sans triage l'app ne traite rien.";
|
|
3021
|
-
var STEP_BY_KEY = new Map(PIPELINE_STEPS.map((step) => [step.key, step]));
|
|
3022
|
-
function pipelineStep(key) {
|
|
3023
|
-
const step = STEP_BY_KEY.get(key);
|
|
3024
|
-
if (!step) throw new Error(`unknown pipeline step: ${key}`);
|
|
3025
|
-
return step;
|
|
3026
|
-
}
|
|
3027
|
-
function readNodes(value) {
|
|
3028
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return {};
|
|
3029
|
-
return value;
|
|
3030
|
-
}
|
|
3031
|
-
function readStep(value, key) {
|
|
3032
|
-
const step = readNodes(value)[key];
|
|
3033
|
-
if (typeof step !== "object" || step === null || Array.isArray(step)) return null;
|
|
3034
|
-
return step;
|
|
3035
|
-
}
|
|
3036
|
-
function isStepEnabled(value, key) {
|
|
3037
|
-
return readStep(value, key) !== null;
|
|
3038
|
-
}
|
|
3039
|
-
function stepBlockedReason(value, key) {
|
|
3040
|
-
const { requires, blockedReason } = pipelineStep(key);
|
|
3041
|
-
if (!requires) return null;
|
|
3042
|
-
return isStepActive(value, requires) ? null : blockedReason;
|
|
3043
|
-
}
|
|
3044
|
-
function isStepActive(value, key) {
|
|
3045
|
-
return isStepEnabled(value, key) && stepBlockedReason(value, key) === null;
|
|
3046
|
-
}
|
|
3047
|
-
function withStep(value, key, step) {
|
|
3048
|
-
return { ...readNodes(value), [key]: step };
|
|
3049
|
-
}
|
|
3050
|
-
function withStepFields(value, key, patch) {
|
|
3051
|
-
const step = readStep(value, key);
|
|
3052
|
-
if (!step) return readNodes(value);
|
|
3053
|
-
const next = { ...step };
|
|
3054
|
-
for (const [field2, fieldValue] of Object.entries(patch)) {
|
|
3055
|
-
if (fieldValue === void 0) delete next[field2];
|
|
3056
|
-
else next[field2] = fieldValue;
|
|
3057
|
-
}
|
|
3058
|
-
return withStep(value, key, next);
|
|
3059
|
-
}
|
|
3060
|
-
function stepString(step, field2) {
|
|
3061
|
-
const value = step?.[field2];
|
|
3062
|
-
return typeof value === "string" ? value : "";
|
|
3063
|
-
}
|
|
3064
|
-
function stepNumber(step, field2, fallback) {
|
|
3065
|
-
const value = step?.[field2];
|
|
3066
|
-
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
3067
|
-
}
|
|
3068
|
-
function stepBoolean(step, field2, fallback) {
|
|
3069
|
-
const value = step?.[field2];
|
|
3070
|
-
return typeof value === "boolean" ? value : fallback;
|
|
3071
|
-
}
|
|
3072
|
-
function stepUsesAgentPrompt(key) {
|
|
3073
|
-
return key === "draft";
|
|
3074
|
-
}
|
|
3075
|
-
var DEFAULT_PROMPT_LABEL = "production";
|
|
3076
|
-
function stepPromptName(step) {
|
|
3077
|
-
return readPromptField(step, "name");
|
|
3078
|
-
}
|
|
3079
|
-
function stepPromptLabel(step) {
|
|
3080
|
-
return readPromptField(step, "label") || DEFAULT_PROMPT_LABEL;
|
|
3081
|
-
}
|
|
3082
|
-
function readPromptField(step, field2) {
|
|
3083
|
-
const prompt = step?.prompt;
|
|
3084
|
-
if (typeof prompt !== "object" || prompt === null) return "";
|
|
3085
|
-
const value = prompt[field2];
|
|
3086
|
-
return typeof value === "string" ? value : "";
|
|
3087
|
-
}
|
|
3088
|
-
function promptPatch(name, label) {
|
|
3089
|
-
return { prompt: { name, label } };
|
|
3090
|
-
}
|
|
3091
|
-
function stepReasoning(step) {
|
|
3092
|
-
const value = step?.reasoning;
|
|
3093
|
-
return REASONING_EFFORTS.some((effort) => effort.value === value) ? value : "off";
|
|
3094
|
-
}
|
|
3095
|
-
var REASONING_EFFORTS = [
|
|
3096
|
-
{ value: "off", label: "Aucun" },
|
|
3097
|
-
{ value: "low", label: "L\xE9ger" },
|
|
3098
|
-
{ value: "medium", label: "Moyen" },
|
|
3099
|
-
{ value: "high", label: "Pouss\xE9" }
|
|
3100
|
-
];
|
|
3101
|
-
var KNOWN_MODELS = [
|
|
3102
|
-
{
|
|
3103
|
-
provider: "openai",
|
|
3104
|
-
model: "gpt-4o-mini",
|
|
3105
|
-
label: "GPT-4o mini",
|
|
3106
|
-
hint: "Le moins cher, tr\xE8s rapide \u2014 suffisant pour classer"
|
|
3107
|
-
},
|
|
3108
|
-
{
|
|
3109
|
-
provider: "openai",
|
|
3110
|
-
model: "gpt-5-mini",
|
|
3111
|
-
label: "GPT-5 mini",
|
|
3112
|
-
hint: "Rapide, bon march\xE9, meilleur raisonnement"
|
|
3113
|
-
},
|
|
3114
|
-
{
|
|
3115
|
-
provider: "openai",
|
|
3116
|
-
model: "gpt-4.1",
|
|
3117
|
-
label: "GPT-4.1",
|
|
3118
|
-
hint: "Co\xFBt moyen \u2014 r\xE9daction soign\xE9e"
|
|
3119
|
-
},
|
|
3120
|
-
{
|
|
3121
|
-
provider: "openai",
|
|
3122
|
-
model: "gpt-5",
|
|
3123
|
-
label: "GPT-5",
|
|
3124
|
-
hint: "Le plus capable \u2014 le plus lent et le plus cher"
|
|
3125
|
-
},
|
|
3126
|
-
{
|
|
3127
|
-
provider: "anthropic",
|
|
3128
|
-
model: "claude-3-5-haiku-latest",
|
|
3129
|
-
label: "Claude 3.5 Haiku",
|
|
3130
|
-
hint: "Rapide et bon march\xE9"
|
|
3131
|
-
},
|
|
3132
|
-
{
|
|
3133
|
-
provider: "anthropic",
|
|
3134
|
-
model: "claude-3-5-sonnet-latest",
|
|
3135
|
-
label: "Claude 3.5 Sonnet",
|
|
3136
|
-
hint: "Co\xFBt moyen \u2014 r\xE9daction soign\xE9e"
|
|
3137
|
-
}
|
|
3138
|
-
];
|
|
3139
|
-
var CUSTOM_MODEL_VALUE = "__custom__";
|
|
3140
|
-
function findModelOption(model) {
|
|
3141
|
-
return KNOWN_MODELS.find((option) => option.model === model);
|
|
3142
|
-
}
|
|
3143
|
-
function defaultStep() {
|
|
3144
|
-
const [first] = KNOWN_MODELS;
|
|
3145
|
-
return { model: first.model, provider: first.provider, reasoning: "off" };
|
|
3146
|
-
}
|
|
3147
|
-
var PIPELINE_PRESETS = [
|
|
3148
|
-
{
|
|
3149
|
-
id: "triage-only",
|
|
3150
|
-
label: "D\xE9marrage prudent \u2014 triage seul",
|
|
3151
|
-
description: "Les demandes sont comprises et class\xE9es. Aucune r\xE9ponse n\u2019est pr\xE9par\xE9e.",
|
|
3152
|
-
enabled: ["triage"]
|
|
3153
|
-
},
|
|
3154
|
-
{
|
|
3155
|
-
id: "assisted",
|
|
3156
|
-
label: "R\xE9ponse assist\xE9e",
|
|
3157
|
-
description: "Triage, escalade et r\xE9daction : un projet de r\xE9ponse est pr\xE9par\xE9 pour un humain. L\u2019envoi automatique reste d\xE9sactiv\xE9.",
|
|
3158
|
-
enabled: ["triage", "escalate", "draft"]
|
|
3159
|
-
}
|
|
3160
|
-
];
|
|
3161
|
-
function applyPreset(value, preset, restore) {
|
|
3162
|
-
let next = readNodes(value);
|
|
3163
|
-
for (const key of PIPELINE_STEP_KEYS) {
|
|
3164
|
-
const on = preset.enabled.includes(key);
|
|
3165
|
-
next = withStep(next, key, on ? readStep(next, key) ?? restore(key) : null);
|
|
3166
|
-
}
|
|
3167
|
-
return next;
|
|
3168
|
-
}
|
|
3169
3345
|
var PERCENT = 100;
|
|
3170
3346
|
function PipelineNodesForm({
|
|
3171
3347
|
value,
|
|
@@ -3173,7 +3349,9 @@ function PipelineNodesForm({
|
|
|
3173
3349
|
canWrite,
|
|
3174
3350
|
issueMessage,
|
|
3175
3351
|
prompts,
|
|
3176
|
-
promptsLoading = false
|
|
3352
|
+
promptsLoading = false,
|
|
3353
|
+
models,
|
|
3354
|
+
modelsLoading = false
|
|
3177
3355
|
}) {
|
|
3178
3356
|
const [remembered, setRemembered] = useState({});
|
|
3179
3357
|
useEffect(() => {
|
|
@@ -3221,6 +3399,8 @@ function PipelineNodesForm({
|
|
|
3221
3399
|
issueMessage: step.key === "triage" ? issueMessage : null,
|
|
3222
3400
|
prompts,
|
|
3223
3401
|
promptsLoading,
|
|
3402
|
+
models,
|
|
3403
|
+
modelsLoading,
|
|
3224
3404
|
onToggle: (on) => toggleStep(step.key, on),
|
|
3225
3405
|
onPatch: (patch) => onChange(withStepFields(value, step.key, patch))
|
|
3226
3406
|
},
|
|
@@ -3235,6 +3415,8 @@ function StepRow({
|
|
|
3235
3415
|
issueMessage,
|
|
3236
3416
|
prompts,
|
|
3237
3417
|
promptsLoading,
|
|
3418
|
+
models,
|
|
3419
|
+
modelsLoading,
|
|
3238
3420
|
onToggle,
|
|
3239
3421
|
onPatch
|
|
3240
3422
|
}) {
|
|
@@ -3288,6 +3470,8 @@ function StepRow({
|
|
|
3288
3470
|
step,
|
|
3289
3471
|
settings: readStep(value, step.key),
|
|
3290
3472
|
disabled: !canWrite || blockedReason !== null,
|
|
3473
|
+
models,
|
|
3474
|
+
modelsLoading,
|
|
3291
3475
|
onPatch
|
|
3292
3476
|
}
|
|
3293
3477
|
) })
|
|
@@ -3298,12 +3482,14 @@ function StepOptions({
|
|
|
3298
3482
|
step,
|
|
3299
3483
|
settings,
|
|
3300
3484
|
disabled,
|
|
3485
|
+
models,
|
|
3486
|
+
modelsLoading,
|
|
3301
3487
|
onPatch
|
|
3302
3488
|
}) {
|
|
3303
3489
|
const model = stepString(settings, "model");
|
|
3304
|
-
const known =
|
|
3490
|
+
const known = models.includes(model);
|
|
3305
3491
|
const [freeText, setFreeText] = useState(false);
|
|
3306
|
-
const showFreeText = freeText || model !== "" && !known;
|
|
3492
|
+
const showFreeText = freeText || model !== "" && !known && !modelsLoading;
|
|
3307
3493
|
const ids = useIds(step.key);
|
|
3308
3494
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3309
3495
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
@@ -3312,25 +3498,20 @@ function StepOptions({
|
|
|
3312
3498
|
Select,
|
|
3313
3499
|
{
|
|
3314
3500
|
"aria-label": `Mod\xE8le \u2014 ${step.label}`,
|
|
3315
|
-
value: showFreeText ? CUSTOM_MODEL_VALUE : known
|
|
3501
|
+
value: showFreeText ? CUSTOM_MODEL_VALUE : known ? model : void 0,
|
|
3316
3502
|
onValueChange: (next) => {
|
|
3317
3503
|
if (next === CUSTOM_MODEL_VALUE) {
|
|
3318
3504
|
setFreeText(true);
|
|
3319
3505
|
return;
|
|
3320
3506
|
}
|
|
3321
3507
|
setFreeText(false);
|
|
3322
|
-
|
|
3323
|
-
if (!option) return;
|
|
3324
|
-
onPatch({ model: option.model, provider: option.provider });
|
|
3508
|
+
onPatch({ model: next, provider: DEFAULT_STEP_PROVIDER });
|
|
3325
3509
|
},
|
|
3326
3510
|
items: [
|
|
3327
|
-
...
|
|
3328
|
-
value: option.model,
|
|
3329
|
-
label: `${option.label} \u2014 ${option.hint}`
|
|
3330
|
-
})),
|
|
3511
|
+
...models.map((name) => ({ value: name, label: name })),
|
|
3331
3512
|
{ value: CUSTOM_MODEL_VALUE, label: "Autre \u2014 saisir un identifiant de mod\xE8le" }
|
|
3332
3513
|
],
|
|
3333
|
-
disabled
|
|
3514
|
+
disabled: disabled || modelsLoading
|
|
3334
3515
|
}
|
|
3335
3516
|
),
|
|
3336
3517
|
showFreeText && // The provider travels WITH the model: a free-text id typed after a
|
|
@@ -3428,7 +3609,7 @@ function StepPromptField({
|
|
|
3428
3609
|
onPatch
|
|
3429
3610
|
}) {
|
|
3430
3611
|
if (stepUsesAgentPrompt(step.key)) {
|
|
3431
|
-
return /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Le prompt de cette \xE9tape est celui de l'agent qui r\xE9dige \u2014 il se choisit sur la page Agents." });
|
|
3612
|
+
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." });
|
|
3432
3613
|
}
|
|
3433
3614
|
const name = stepPromptName(settings);
|
|
3434
3615
|
const label = stepPromptLabel(settings);
|
|
@@ -3485,37 +3666,6 @@ function useIds(stepKey) {
|
|
|
3485
3666
|
minConfidence: `${base2}-${stepKey}-min-confidence`
|
|
3486
3667
|
};
|
|
3487
3668
|
}
|
|
3488
|
-
function usePromptCatalogue() {
|
|
3489
|
-
const { appSlug } = useAppContext();
|
|
3490
|
-
const api = useAppApi();
|
|
3491
|
-
const [prompts, setPrompts] = useState([]);
|
|
3492
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
3493
|
-
const [error, setError] = useState(void 0);
|
|
3494
|
-
const clientRef = useRef(api);
|
|
3495
|
-
clientRef.current = api;
|
|
3496
|
-
const requestIdRef = useRef(0);
|
|
3497
|
-
const isMountedRef = useRef(true);
|
|
3498
|
-
useEffect(() => {
|
|
3499
|
-
isMountedRef.current = true;
|
|
3500
|
-
const requestId = ++requestIdRef.current;
|
|
3501
|
-
setIsLoading(true);
|
|
3502
|
-
void clientRef.current.get(`/data/apps/${appSlug}/prompts`).then((catalogue) => {
|
|
3503
|
-
if (requestId !== requestIdRef.current || !isMountedRef.current) return;
|
|
3504
|
-
setPrompts(catalogue);
|
|
3505
|
-
setError(void 0);
|
|
3506
|
-
}).catch((err) => {
|
|
3507
|
-
if (requestId !== requestIdRef.current || !isMountedRef.current) return;
|
|
3508
|
-
setError(err);
|
|
3509
|
-
}).finally(() => {
|
|
3510
|
-
if (requestId !== requestIdRef.current || !isMountedRef.current) return;
|
|
3511
|
-
setIsLoading(false);
|
|
3512
|
-
});
|
|
3513
|
-
return () => {
|
|
3514
|
-
isMountedRef.current = false;
|
|
3515
|
-
};
|
|
3516
|
-
}, [appSlug]);
|
|
3517
|
-
return { prompts, isLoading, error };
|
|
3518
|
-
}
|
|
3519
3669
|
var WHATSAPP_MODE_LABELS = {
|
|
3520
3670
|
escalate_only: "Escalade uniquement",
|
|
3521
3671
|
draft_only: "Brouillon uniquement",
|
|
@@ -3571,6 +3721,7 @@ function SettingsPage() {
|
|
|
3571
3721
|
const [installedAppsUnavailable, setInstalledAppsUnavailable] = useState(false);
|
|
3572
3722
|
const [connections, setConnections] = useState(void 0);
|
|
3573
3723
|
const promptCatalogue = usePromptCatalogue();
|
|
3724
|
+
const modelCatalogue = useModelCatalogue();
|
|
3574
3725
|
const formInitializedRef = useRef(false);
|
|
3575
3726
|
useEffect(() => {
|
|
3576
3727
|
if (settings && !formInitializedRef.current) {
|
|
@@ -3947,9 +4098,15 @@ function SettingsPage() {
|
|
|
3947
4098
|
canWrite,
|
|
3948
4099
|
issueMessage: nodesIssue ? settingsIssueLabel(nodesIssue.key, nodesIssue.message) : null,
|
|
3949
4100
|
prompts: promptCatalogue.prompts,
|
|
3950
|
-
promptsLoading: promptCatalogue.isLoading
|
|
4101
|
+
promptsLoading: promptCatalogue.isLoading,
|
|
4102
|
+
models: modelCatalogue.models,
|
|
4103
|
+
modelsLoading: modelCatalogue.isLoading
|
|
3951
4104
|
}
|
|
3952
4105
|
),
|
|
4106
|
+
modelCatalogue.error !== void 0 && /* @__PURE__ */ jsxs("p", { className: "text-sm text-destructive", children: [
|
|
4107
|
+
"Liste des mod\xE8les indisponible \u2014 ",
|
|
4108
|
+
describeApiError(modelCatalogue.error)
|
|
4109
|
+
] }),
|
|
3953
4110
|
promptCatalogue.error !== void 0 && /* @__PURE__ */ jsxs("p", { className: "text-sm text-destructive", children: [
|
|
3954
4111
|
"Catalogue de prompts indisponible \u2014 ",
|
|
3955
4112
|
describeApiError(promptCatalogue.error)
|
|
@@ -3971,7 +4128,7 @@ function SettingsPage() {
|
|
|
3971
4128
|
// src/ui/graph-canvas/reachability.ts
|
|
3972
4129
|
function stubPrompts() {
|
|
3973
4130
|
const ref = { name: "", label: "production" };
|
|
3974
|
-
return { triage: ref, escalate: ref, draft: ref, evaluate: ref
|
|
4131
|
+
return { triage: ref, escalate: ref, draft: ref, evaluate: ref };
|
|
3975
4132
|
}
|
|
3976
4133
|
var PROMPT_403_NODES = /* @__PURE__ */ new Set(["triage", "escalate", "draft", "evaluate", "revise"]);
|
|
3977
4134
|
var PROMPT_403_NOTE = "promptRef est transmis \xE0 ctx.api.llm.complete, qui r\xE9pond 403 en production tant que manifest.prompts[] reste vide (d\xE9faut D-LF connu, non corrig\xE9 \u2014 voir le journal T24/T25) : ce n\u0153ud peut renvoyer PROMPT_NOT_DECLARED sur un d\xE9ploiement r\xE9el malgr\xE9 un r\xE9glage \xAB Actif \xBB ici.";
|