@nivaro/react 0.3.137 → 0.3.139
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/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +95 -4
- package/dist/index.js +748 -743
- package/dist/shared/components/CollectionBrowserView.js +392 -389
- package/dist/shared/components/DelegateCoverLine.js +80 -87
- package/dist/shared/components/ItemEditForm.js +589 -588
- package/dist/shared/components/MyWorkView.js +284 -286
- package/dist/shared/components/NotificationBell.js +251 -205
- package/dist/shared/components/ai/AiAnalyticsView.js +878 -417
- package/dist/shared/components/ai/AiPlanCard.js +164 -122
- package/dist/shared/components/ai/AiPlanUndo.js +291 -0
- package/dist/shared/components/ai/call-log/CallDrawer.js +357 -0
- package/dist/shared/components/ai/call-log/RawJson.js +126 -0
- package/dist/shared/components/ai/call-log/ThreadView.js +223 -0
- package/dist/shared/components/ai/call-log/TranscriptView.js +227 -0
- package/dist/shared/components/ai/call-log/controls.js +364 -0
- package/dist/shared/components/ai/call-log/format.js +46 -0
- package/dist/shared/components/ai/call-log/url.js +105 -0
- package/dist/shared/components/chat/chat-core.js +422 -346
- package/dist/shared/components/integrations/IntegrationObligationsView.js +98 -98
- package/dist/shared/components/integrations/RecordIntegrationPreview.js +102 -93
- package/dist/shared/components/integrations/console/api.js +11 -1
- package/dist/shared/components/item-edit/HeaderRollupExplainer.js +5 -1
- package/dist/shared/components/item-edit/RecordLiveSync.js +241 -229
- package/dist/shared/components/item-edit/RecordRecapChanges.js +166 -0
- package/dist/shared/components/item-edit/RecordRecapStrip.js +254 -84
- package/dist/shared/components/item-edit/live-related.js +34 -18
- package/dist/shared/components/panels/RevisionsPanel.js +735 -683
- package/dist/shared/components/queue/QueueWorklist.js +323 -316
- package/dist/shared/components/support/SupportRequestDialog.js +198 -181
- package/dist/shared/components/trackers/use-tracker-link.js +74 -65
- package/dist/shared/lib/activity-sentence.js +167 -151
- package/dist/shared/lib/config-update-refresh.js +34 -0
- package/dist/shared/lib/config-watch.js +17 -17
- package/dist/shared/lib/gap-refresh.js +49 -0
- package/dist/shared/lib/integration-dots.js +8 -8
- package/dist/shared/lib/live-ops.js +26 -23
- package/dist/shared/lib/live-pickers.js +1 -1
- package/dist/shared/lib/live-queries.js +223 -195
- package/dist/shared/lib/live.js +56 -51
- package/dist/shared/lib/obligation-banner.js +11 -10
- package/dist/shared/lib/obligation-filters.js +22 -18
- package/dist/shared/lib/obligation-reason-text.js +18 -8
- package/dist/shared/lib/presence-hooks.js +133 -132
- package/dist/shared/lib/reconnect-resync.js +90 -0
- package/dist/shared/lib/record-room-holds.js +43 -0
- package/dist/shared/lib/socket-realtime.js +116 -105
- package/dist/shared/lib/user-sync.js +1 -6
- package/package.json +1 -1
|
@@ -1,437 +1,898 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import { RotateCw as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { get as
|
|
7
|
-
import { cn as
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import { jsxs as o, jsx as t, Fragment as M } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as j } from "@tanstack/react-query";
|
|
3
|
+
import { Search as ge, Download as ve, RotateCw as ye, X as ke, ArrowUp as we, ArrowDown as Ne, ArrowUpDown as _e, MessagesSquare as $e, ThumbsUp as Ce, ThumbsDown as Se } from "lucide-react";
|
|
4
|
+
import { useMemo as re, useState as K, useEffect as se } from "react";
|
|
5
|
+
import { useNivaroClient as me, useApiFetchConfig as qe } from "../../context.js";
|
|
6
|
+
import { get as Q } from "../../lib/commands.js";
|
|
7
|
+
import { cn as g } from "../../lib/utils.js";
|
|
8
|
+
import { Segmented as oe, Panel as he, ShareBar as Te, OutcomeChip as De } from "../delivery-analytics/ui.js";
|
|
9
|
+
import { useParamState as Me } from "../delivery-analytics/url.js";
|
|
10
|
+
import { QueryErrorState as ne } from "../QueryErrorState.js";
|
|
11
|
+
import { Skeleton as B } from "../ui/skeleton.js";
|
|
12
|
+
import { CallDrawer as Oe } from "./call-log/CallDrawer.js";
|
|
13
|
+
import { SavedViews as Pe, MultiPicker as q, MoreFilters as Re } from "./call-log/controls.js";
|
|
14
|
+
import { whenShort as L, featureLabel as F, resultLabel as W, num as u, usd as v, tok as w, secs as T, pctOf as ie, bucketLabel as Le, bucketRange as Ae, resultOf as Fe } from "./call-log/format.js";
|
|
15
|
+
import { apiFilter as Ie, activeChips as Ee, WINDOWS as Ke, clearFilters as de, listOf as N, toggleIn as Be } from "./call-log/url.js";
|
|
16
|
+
const U = 50, Ue = {
|
|
17
|
+
error: "failed",
|
|
18
|
+
max_tokens: "dropped",
|
|
19
|
+
stopped: "suppressed",
|
|
20
|
+
end_turn: "delivered",
|
|
21
|
+
tool_use: "deferred"
|
|
22
|
+
}, je = ["ok", "error", "end_turn", "tool_use", "max_tokens", "stopped"], ce = [
|
|
23
|
+
{ key: "when", label: "When" },
|
|
24
|
+
{ key: "feature", label: "Question / feature" },
|
|
25
|
+
{ key: "person", label: "Person" },
|
|
26
|
+
{ key: "model", label: "Model" },
|
|
27
|
+
{ key: "in", label: "In", right: !0, tip: "Input tokens (cached ones included)" },
|
|
28
|
+
{ key: "cached", label: "Cached", right: !0, tip: "Input tokens read from the prompt cache" },
|
|
29
|
+
{ key: "out", label: "Out", right: !0, tip: "Output tokens" },
|
|
30
|
+
{ key: "cost", label: "Cost", right: !0, tip: "At list price" },
|
|
31
|
+
{ key: "time", label: "Time", right: !0 },
|
|
32
|
+
{ key: "result", label: "Result" }
|
|
33
|
+
];
|
|
34
|
+
function k({
|
|
35
|
+
label: s,
|
|
36
|
+
value: d,
|
|
37
|
+
sub: h,
|
|
38
|
+
onClick: i,
|
|
39
|
+
active: r,
|
|
40
|
+
tip: a,
|
|
41
|
+
className: f
|
|
42
|
+
}) {
|
|
43
|
+
const c = /* @__PURE__ */ o(M, { children: [
|
|
44
|
+
/* @__PURE__ */ t("div", { className: "text-[11px] text-slate-500 dark:text-muted-foreground", children: s }),
|
|
45
|
+
/* @__PURE__ */ t("div", { className: "mt-0.5 text-[17px] font-semibold tabular-nums tracking-[-0.01em] text-slate-900 dark:text-foreground", children: d }),
|
|
46
|
+
h ? /* @__PURE__ */ t("div", { className: "truncate text-[11px] text-slate-500 dark:text-muted-foreground", children: h }) : null
|
|
47
|
+
] }), p = g(
|
|
48
|
+
"min-w-0 bg-white px-3 py-2.5 text-left dark:bg-card",
|
|
49
|
+
f,
|
|
50
|
+
r && "bg-nvr-cyan/10 dark:bg-nvr-cyan/10"
|
|
51
|
+
);
|
|
52
|
+
return i ? /* @__PURE__ */ t(
|
|
53
|
+
"button",
|
|
24
54
|
{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
)) });
|
|
55
|
+
type: "button",
|
|
56
|
+
onClick: i,
|
|
57
|
+
"aria-pressed": r,
|
|
58
|
+
"data-tip": a,
|
|
59
|
+
className: g(
|
|
60
|
+
p,
|
|
61
|
+
"transition-colors hover:bg-slate-50 focus-visible:relative focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-nvr-cyan/50 dark:hover:bg-muted/50"
|
|
62
|
+
),
|
|
63
|
+
children: c
|
|
64
|
+
}
|
|
65
|
+
) : /* @__PURE__ */ t("div", { className: p, "data-tip": a, children: c });
|
|
37
66
|
}
|
|
38
|
-
function
|
|
39
|
-
const
|
|
40
|
-
|
|
67
|
+
function Qe(s) {
|
|
68
|
+
const d = s.bucket === "hour" ? 36e5 : 864e5, h = (p) => {
|
|
69
|
+
const b = new Date(p).toISOString();
|
|
70
|
+
return s.bucket === "hour" ? b.slice(0, 13) : b.slice(0, 10);
|
|
71
|
+
}, i = new Date(s.from).getTime(), r = new Date(s.to).getTime(), a = Math.floor(i / d) * d;
|
|
72
|
+
if (!Number.isFinite(a) || (r - a) / d > 2200) return s.series;
|
|
73
|
+
const f = new Map(s.series.map((p) => [p.bucket, p])), c = [];
|
|
74
|
+
for (let p = a; p < r; p += d) {
|
|
75
|
+
const b = h(p);
|
|
76
|
+
c.push(f.get(b) ?? { bucket: b, calls: 0, errors: 0, cost_usd: 0 });
|
|
77
|
+
}
|
|
78
|
+
return c;
|
|
41
79
|
}
|
|
42
|
-
function
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
80
|
+
function We({ s, onPick: d }) {
|
|
81
|
+
const h = Qe(s), i = Math.max(1, ...h.map((r) => r.calls));
|
|
82
|
+
return s.series.length ? /* @__PURE__ */ t("div", { className: "flex h-28 items-end gap-px overflow-x-auto px-4 pb-3 pt-2", "data-ai-series": !0, children: h.map((r) => {
|
|
83
|
+
const a = Le(r.bucket, s.bucket), f = r.calls / i * 100;
|
|
84
|
+
return /* @__PURE__ */ t(
|
|
85
|
+
"button",
|
|
86
|
+
{
|
|
87
|
+
type: "button",
|
|
88
|
+
disabled: r.calls === 0,
|
|
89
|
+
onClick: () => d(r.bucket),
|
|
90
|
+
"aria-label": `${a}: ${u(r.calls)} calls, ${u(r.errors)} errors, ${v(r.cost_usd)}. Show only these calls`,
|
|
91
|
+
"data-tip": `${a} · ${u(r.calls)} calls${r.errors ? ` · ${u(r.errors)} errors` : ""} · ${v(r.cost_usd)}`,
|
|
92
|
+
className: "group flex h-full min-w-[3px] flex-1 flex-col justify-end rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 disabled:cursor-default",
|
|
93
|
+
children: r.calls > 0 && /* @__PURE__ */ o(
|
|
94
|
+
"span",
|
|
95
|
+
{
|
|
96
|
+
className: "flex flex-col overflow-hidden rounded-t-sm",
|
|
97
|
+
style: { height: `${Math.max(3, f)}%` },
|
|
98
|
+
children: [
|
|
99
|
+
r.errors > 0 && /* @__PURE__ */ t(
|
|
100
|
+
"span",
|
|
101
|
+
{
|
|
102
|
+
className: "block bg-amber-500/90",
|
|
103
|
+
style: { height: `${Math.max(8, r.errors / r.calls * 100)}%` }
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
/* @__PURE__ */ t("span", { className: "block flex-1 bg-nvr-cyan/60 transition-colors group-hover:bg-nvr-cyan" })
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
)
|
|
110
|
+
},
|
|
111
|
+
r.bucket
|
|
112
|
+
);
|
|
113
|
+
}) }) : /* @__PURE__ */ t("p", { className: "px-4 py-8 text-center text-[12px] text-slate-500", children: "No calls in this window." });
|
|
59
114
|
}
|
|
60
|
-
function
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
115
|
+
function A({
|
|
116
|
+
title: s,
|
|
117
|
+
rows: d,
|
|
118
|
+
label: h,
|
|
119
|
+
activeKeys: i,
|
|
120
|
+
onPick: r,
|
|
121
|
+
extra: a
|
|
122
|
+
}) {
|
|
123
|
+
const f = Math.max(1, ...d.map((c) => c.calls));
|
|
124
|
+
return /* @__PURE__ */ t(he, { title: s, id: s, children: d.length === 0 ? /* @__PURE__ */ t("p", { className: "px-4 py-6 text-center text-[12px] text-slate-500", children: "Nothing in this filter." }) : /* @__PURE__ */ t("ul", { className: "max-h-[300px] divide-y divide-slate-100 overflow-y-auto dark:divide-border/60", children: d.map((c) => {
|
|
125
|
+
const p = c.key ?? "system", b = i.includes(p);
|
|
126
|
+
return /* @__PURE__ */ t("li", { children: /* @__PURE__ */ o(
|
|
127
|
+
"button",
|
|
128
|
+
{
|
|
129
|
+
type: "button",
|
|
130
|
+
onClick: () => r(p),
|
|
131
|
+
"aria-pressed": b,
|
|
132
|
+
className: g(
|
|
133
|
+
"grid w-full grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-1 px-4 py-2 text-left text-[12px] transition-colors hover:bg-slate-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-nvr-cyan/50 dark:hover:bg-muted/40",
|
|
134
|
+
b && "bg-nvr-cyan/10 hover:bg-nvr-cyan/15 dark:bg-nvr-cyan/10"
|
|
135
|
+
),
|
|
136
|
+
children: [
|
|
137
|
+
/* @__PURE__ */ t("span", { className: "min-w-0 truncate font-medium text-slate-800 dark:text-slate-100", children: h(c) }),
|
|
138
|
+
/* @__PURE__ */ o("span", { className: "tabular-nums text-slate-600 dark:text-muted-foreground", children: [
|
|
139
|
+
u(c.calls),
|
|
140
|
+
" · ",
|
|
141
|
+
v(c.cost_usd),
|
|
142
|
+
c.errors ? /* @__PURE__ */ o("span", { className: "ml-1 text-red-700 dark:text-[#eaa3a3]", children: [
|
|
143
|
+
"· ",
|
|
144
|
+
u(c.errors),
|
|
145
|
+
" err"
|
|
146
|
+
] }) : null
|
|
147
|
+
] }),
|
|
148
|
+
/* @__PURE__ */ t("span", { className: "col-span-2", children: /* @__PURE__ */ t(Te, { value: c.calls, max: f }) }),
|
|
149
|
+
a && /* @__PURE__ */ t("span", { className: "col-span-2 text-[11px] text-slate-500", children: a(c) })
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
) }, p);
|
|
153
|
+
}) }) });
|
|
154
|
+
}
|
|
155
|
+
function He({
|
|
156
|
+
col: s,
|
|
157
|
+
sort: d,
|
|
158
|
+
onSort: h
|
|
159
|
+
}) {
|
|
160
|
+
const i = d.key === s.key, r = i ? d.dir === "asc" ? we : Ne : _e;
|
|
161
|
+
return /* @__PURE__ */ t(
|
|
162
|
+
"th",
|
|
163
|
+
{
|
|
164
|
+
scope: "col",
|
|
165
|
+
"aria-sort": i ? d.dir === "asc" ? "ascending" : "descending" : "none",
|
|
166
|
+
className: g("whitespace-nowrap px-2 py-2 font-semibold", s.right && "text-right"),
|
|
167
|
+
children: /* @__PURE__ */ o(
|
|
83
168
|
"button",
|
|
84
169
|
{
|
|
85
170
|
type: "button",
|
|
86
|
-
onClick: () =>
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
s
|
|
171
|
+
onClick: () => h(s.key),
|
|
172
|
+
"data-tip": s.tip,
|
|
173
|
+
className: g(
|
|
174
|
+
"inline-flex items-center gap-1 rounded hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:hover:text-foreground",
|
|
175
|
+
i && "text-slate-900 dark:text-foreground",
|
|
176
|
+
s.right && "flex-row-reverse"
|
|
92
177
|
),
|
|
93
|
-
children:
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
178
|
+
children: [
|
|
179
|
+
s.label,
|
|
180
|
+
/* @__PURE__ */ t(r, { className: g("h-3 w-3", i ? "opacity-90" : "opacity-30"), "aria-hidden": !0 })
|
|
181
|
+
]
|
|
182
|
+
}
|
|
183
|
+
)
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
function Ve({ fb: s }) {
|
|
188
|
+
return !s || !s.up && !s.down ? null : /* @__PURE__ */ o("span", { className: "ml-1 inline-flex items-center gap-1 align-middle", children: [
|
|
189
|
+
s.up > 0 && /* @__PURE__ */ t(
|
|
190
|
+
Ce,
|
|
191
|
+
{
|
|
192
|
+
className: "h-3 w-3 text-green-700 dark:text-[#b9d3a6]",
|
|
193
|
+
"aria-label": `${s.up} thumbs up`
|
|
194
|
+
}
|
|
195
|
+
),
|
|
196
|
+
s.down > 0 && /* @__PURE__ */ t(
|
|
197
|
+
Se,
|
|
198
|
+
{
|
|
199
|
+
className: "h-3 w-3 text-red-700 dark:text-[#eaa3a3]",
|
|
200
|
+
"aria-label": `${s.down} thumbs down`
|
|
201
|
+
}
|
|
202
|
+
)
|
|
203
|
+
] });
|
|
204
|
+
}
|
|
205
|
+
function ue({ r: s }) {
|
|
206
|
+
const d = Fe(s);
|
|
207
|
+
return /* @__PURE__ */ o("span", { className: "inline-flex items-center gap-1 whitespace-nowrap", children: [
|
|
208
|
+
/* @__PURE__ */ t(De, { outcome: Ue[d] ?? "neutral", children: W(d) }),
|
|
209
|
+
s.tool_calls ? /* @__PURE__ */ o("span", { className: "text-[11px] text-slate-500", "data-tip": s.tools.join(", ") || void 0, children: [
|
|
210
|
+
s.tool_calls,
|
|
211
|
+
" tool",
|
|
212
|
+
s.tool_calls === 1 ? "" : "s"
|
|
213
|
+
] }) : null,
|
|
214
|
+
/* @__PURE__ */ t(Ve, { fb: s.feedback })
|
|
215
|
+
] });
|
|
216
|
+
}
|
|
217
|
+
function ze({ r: s, onRequest: d }) {
|
|
218
|
+
return /* @__PURE__ */ o("span", { className: "flex min-w-0 flex-col gap-0.5", children: [
|
|
219
|
+
s.question ? /* @__PURE__ */ t(
|
|
220
|
+
"span",
|
|
221
|
+
{
|
|
222
|
+
className: "line-clamp-1 text-slate-900 dark:text-foreground",
|
|
223
|
+
"data-tip": s.question.length > 80 ? s.question : void 0,
|
|
224
|
+
children: s.question
|
|
225
|
+
}
|
|
226
|
+
) : null,
|
|
227
|
+
/* @__PURE__ */ o("span", { className: "flex min-w-0 items-center gap-1.5 text-[11px] text-slate-500 dark:text-muted-foreground", children: [
|
|
228
|
+
/* @__PURE__ */ t("span", { className: "rounded bg-slate-100 px-1.5 py-px text-slate-700 dark:bg-muted dark:text-slate-300", children: F(s.feature) }),
|
|
229
|
+
s.request_id ? /* @__PURE__ */ o(
|
|
98
230
|
"button",
|
|
99
231
|
{
|
|
100
232
|
type: "button",
|
|
101
|
-
|
|
102
|
-
|
|
233
|
+
className: "rounded underline-offset-2 hover:text-slate-900 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:hover:text-foreground",
|
|
234
|
+
"data-tip": "Show every call of this question",
|
|
235
|
+
onClick: (h) => {
|
|
236
|
+
h.stopPropagation(), d(s.request_id);
|
|
103
237
|
},
|
|
104
|
-
className: "inline-flex h-7 items-center gap-1 rounded-md border border-border px-2 text-[12px] text-muted-foreground hover:bg-muted",
|
|
105
238
|
children: [
|
|
106
|
-
|
|
107
|
-
|
|
239
|
+
"#",
|
|
240
|
+
s.request_id.slice(0, 6)
|
|
108
241
|
]
|
|
109
242
|
}
|
|
243
|
+
) : null,
|
|
244
|
+
s.conversation_id ? /* @__PURE__ */ t($e, { className: "h-3 w-3", "aria-label": "Part of a saved conversation" }) : null
|
|
245
|
+
] })
|
|
246
|
+
] });
|
|
247
|
+
}
|
|
248
|
+
function ut({
|
|
249
|
+
search: s,
|
|
250
|
+
onSearchChange: d
|
|
251
|
+
} = {}) {
|
|
252
|
+
var te, ae, le;
|
|
253
|
+
const h = me(), i = qe(), [r, a] = Me(s, d), f = re(() => Ie(r).toString(), [r]), c = r.get("sort") ?? "-when", p = {
|
|
254
|
+
key: c.replace(/^[+-]/, "") || "when",
|
|
255
|
+
dir: c.startsWith("+") ? "asc" : "desc"
|
|
256
|
+
}, b = Math.max(1, Number(r.get("page")) || 1), H = Number(r.get("call")) || null, I = r.get("window") ?? "7d", y = j({
|
|
257
|
+
queryKey: ["nvr-ai-call-log-summary", f],
|
|
258
|
+
queryFn: () => h.request(
|
|
259
|
+
Q("/ai/call-log/summary", Object.fromEntries(new URLSearchParams(f)))
|
|
260
|
+
),
|
|
261
|
+
placeholderData: (e) => e,
|
|
262
|
+
refetchInterval: 12e4
|
|
263
|
+
}), x = j({
|
|
264
|
+
queryKey: ["nvr-ai-call-log", f, c, b],
|
|
265
|
+
queryFn: () => h.request(
|
|
266
|
+
Q("/ai/call-log", {
|
|
267
|
+
...Object.fromEntries(new URLSearchParams(f)),
|
|
268
|
+
sort: c,
|
|
269
|
+
page: b,
|
|
270
|
+
limit: U
|
|
271
|
+
})
|
|
272
|
+
),
|
|
273
|
+
placeholderData: (e) => e
|
|
274
|
+
}), l = (te = y.data) == null ? void 0 : te.data, O = ((ae = x.data) == null ? void 0 : ae.data) ?? [], _ = ((le = x.data) == null ? void 0 : le.total) ?? 0, P = Math.max(1, Math.ceil(_ / U)), V = y.isPlaceholderData || x.isPlaceholderData, [$, z] = K(r.get("q") ?? "");
|
|
275
|
+
se(() => z(r.get("q") ?? ""), [r]), se(() => {
|
|
276
|
+
const e = r.get("q") ?? "";
|
|
277
|
+
if ($.trim() === e) return;
|
|
278
|
+
const n = setTimeout(
|
|
279
|
+
() => a(
|
|
280
|
+
(m) => {
|
|
281
|
+
$.trim() ? m.set("q", $.trim()) : m.delete("q"), m.delete("page");
|
|
282
|
+
},
|
|
283
|
+
{ replace: !0 }
|
|
110
284
|
),
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
)
|
|
140
|
-
|
|
141
|
-
/* @__PURE__ */
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
285
|
+
350
|
|
286
|
+
);
|
|
287
|
+
return () => clearTimeout(n);
|
|
288
|
+
}, [$, r, a]);
|
|
289
|
+
const be = re(
|
|
290
|
+
() => new Map(((l == null ? void 0 : l.facets.people) ?? []).map((e) => [e.value, e.label])),
|
|
291
|
+
[l == null ? void 0 : l.facets.people]
|
|
292
|
+
), E = Ee(r, { people: be }), C = (e, n) => a((m) => Be(m, e, n)), G = (e) => a(
|
|
293
|
+
(n) => {
|
|
294
|
+
const m = p.key === e ? p.dir === "desc" ? `+${e}` : `-${e}` : `-${e}`;
|
|
295
|
+
m === "-when" ? n.delete("sort") : n.set("sort", m), n.delete("page");
|
|
296
|
+
},
|
|
297
|
+
{ replace: !0 }
|
|
298
|
+
), R = (e) => a((n) => {
|
|
299
|
+
n.set("call", String(e)), n.delete("thread");
|
|
300
|
+
}), fe = (e) => {
|
|
301
|
+
if (!l) return;
|
|
302
|
+
const n = Ae(e, l.bucket);
|
|
303
|
+
n && a((m) => {
|
|
304
|
+
m.set("window", "custom"), m.set("from", n.from), m.set("to", n.to), m.delete("page");
|
|
305
|
+
});
|
|
306
|
+
}, [X, J] = K(!1), [Y, Z] = K(!1), xe = async () => {
|
|
307
|
+
J(!0), Z(!1);
|
|
308
|
+
try {
|
|
309
|
+
const e = await fetch(`${i.apiBase}/ai/call-log/export?${f}`, {
|
|
310
|
+
headers: i.authHeaders,
|
|
311
|
+
credentials: i.credentials
|
|
312
|
+
});
|
|
313
|
+
if (!e.ok) throw new Error(String(e.status));
|
|
314
|
+
const n = await e.blob(), m = URL.createObjectURL(n), S = document.createElement("a");
|
|
315
|
+
S.href = m, S.download = `ai-calls-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.csv`, document.body.appendChild(S), S.click(), S.remove(), setTimeout(() => URL.revokeObjectURL(m), 3e4);
|
|
316
|
+
} catch {
|
|
317
|
+
Z(!0);
|
|
318
|
+
} finally {
|
|
319
|
+
J(!1);
|
|
320
|
+
}
|
|
321
|
+
}, ee = I === "custom" && r.get("from") ? `${L(r.get("from"))} – ${r.get("to") ? L(r.get("to")) : "now"}` : null;
|
|
322
|
+
return /* @__PURE__ */ o("div", { className: "flex flex-col gap-4", "data-ai-analytics": !0, children: [
|
|
323
|
+
/* @__PURE__ */ o("div", { className: "flex flex-col gap-2", children: [
|
|
324
|
+
/* @__PURE__ */ o("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
325
|
+
/* @__PURE__ */ t(
|
|
326
|
+
oe,
|
|
327
|
+
{
|
|
328
|
+
ariaLabel: "Window",
|
|
329
|
+
value: I === "custom" ? "custom" : I,
|
|
330
|
+
onChange: (e) => a((n) => {
|
|
331
|
+
e !== "custom" && (n.set("window", e), n.delete("from"), n.delete("to"), n.delete("page"));
|
|
332
|
+
}),
|
|
333
|
+
options: [
|
|
334
|
+
...Ke.map((e) => ({ value: e.value, label: e.label })),
|
|
335
|
+
...ee ? [{ value: "custom", label: ee }] : []
|
|
336
|
+
]
|
|
337
|
+
}
|
|
338
|
+
),
|
|
339
|
+
/* @__PURE__ */ o("label", { className: "relative flex min-w-[200px] flex-1 items-center sm:max-w-[360px]", children: [
|
|
340
|
+
/* @__PURE__ */ t("span", { className: "sr-only", children: "Search the questions people asked" }),
|
|
341
|
+
/* @__PURE__ */ t(
|
|
342
|
+
ge,
|
|
343
|
+
{
|
|
344
|
+
className: "pointer-events-none absolute left-2.5 h-3.5 w-3.5 text-slate-400",
|
|
345
|
+
"aria-hidden": !0
|
|
346
|
+
}
|
|
347
|
+
),
|
|
348
|
+
/* @__PURE__ */ t(
|
|
349
|
+
"input",
|
|
350
|
+
{
|
|
351
|
+
type: "search",
|
|
352
|
+
value: $,
|
|
353
|
+
onChange: (e) => z(e.target.value),
|
|
354
|
+
placeholder: l && !l.search_ready ? "Search needs migration 539" : "Search the questions people asked",
|
|
355
|
+
disabled: !!l && !l.search_ready,
|
|
356
|
+
"data-ai-search": !0,
|
|
357
|
+
className: "h-8 w-full rounded-md border border-slate-200 bg-white pl-8 pr-2 text-[12.5px] text-slate-900 placeholder:text-slate-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 disabled:opacity-60 dark:border-border dark:bg-card dark:text-foreground"
|
|
358
|
+
}
|
|
359
|
+
)
|
|
360
|
+
] }),
|
|
361
|
+
/* @__PURE__ */ o("div", { className: "ml-auto flex items-center gap-2", children: [
|
|
362
|
+
/* @__PURE__ */ t(Pe, { params: r, setParams: a }),
|
|
363
|
+
/* @__PURE__ */ o(
|
|
364
|
+
"button",
|
|
365
|
+
{
|
|
366
|
+
type: "button",
|
|
367
|
+
onClick: () => void xe(),
|
|
368
|
+
disabled: X || _ === 0,
|
|
369
|
+
"data-tip": Y ? "The download failed. Try again." : "Every call in this filter, newest first",
|
|
370
|
+
className: g(
|
|
371
|
+
"inline-flex h-8 items-center gap-1.5 rounded-md border px-2.5 text-[12px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 disabled:opacity-50",
|
|
372
|
+
Y ? "border-red-300 text-red-700 dark:border-[#e08383]/40 dark:text-[#eaa3a3]" : "border-slate-200 bg-white text-slate-600 hover:bg-slate-50 dark:border-border dark:bg-card dark:text-muted-foreground dark:hover:bg-muted"
|
|
373
|
+
),
|
|
374
|
+
children: [
|
|
375
|
+
/* @__PURE__ */ t(ve, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
|
|
376
|
+
X ? "Preparing…" : "CSV"
|
|
377
|
+
]
|
|
378
|
+
}
|
|
379
|
+
),
|
|
380
|
+
/* @__PURE__ */ t(
|
|
381
|
+
"button",
|
|
382
|
+
{
|
|
383
|
+
type: "button",
|
|
384
|
+
"aria-label": "Refresh",
|
|
385
|
+
"data-tip": "Refresh",
|
|
386
|
+
onClick: () => {
|
|
387
|
+
y.refetch(), x.refetch();
|
|
388
|
+
},
|
|
389
|
+
className: "inline-flex h-8 w-8 items-center justify-center rounded-md border border-slate-200 bg-white text-slate-500 hover:bg-slate-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:border-border dark:bg-card dark:hover:bg-muted",
|
|
390
|
+
children: /* @__PURE__ */ t(
|
|
391
|
+
ye,
|
|
392
|
+
{
|
|
393
|
+
className: g(
|
|
394
|
+
"h-3.5 w-3.5",
|
|
395
|
+
(y.isFetching || x.isFetching) && "animate-spin motion-reduce:animate-none"
|
|
396
|
+
),
|
|
397
|
+
"aria-hidden": !0
|
|
398
|
+
}
|
|
399
|
+
)
|
|
400
|
+
}
|
|
401
|
+
)
|
|
402
|
+
] })
|
|
170
403
|
] }),
|
|
171
|
-
/* @__PURE__ */
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
404
|
+
/* @__PURE__ */ o("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
405
|
+
/* @__PURE__ */ t(
|
|
406
|
+
q,
|
|
407
|
+
{
|
|
408
|
+
label: "Feature",
|
|
409
|
+
paramKey: "feature",
|
|
410
|
+
params: r,
|
|
411
|
+
setParams: a,
|
|
412
|
+
options: (l == null ? void 0 : l.facets.features) ?? [],
|
|
413
|
+
render: (e) => F(e.value)
|
|
414
|
+
}
|
|
415
|
+
),
|
|
416
|
+
/* @__PURE__ */ t(
|
|
417
|
+
q,
|
|
418
|
+
{
|
|
419
|
+
label: "Model",
|
|
420
|
+
paramKey: "model",
|
|
421
|
+
params: r,
|
|
422
|
+
setParams: a,
|
|
423
|
+
options: (l == null ? void 0 : l.facets.models) ?? []
|
|
424
|
+
}
|
|
425
|
+
),
|
|
426
|
+
/* @__PURE__ */ t(
|
|
427
|
+
q,
|
|
428
|
+
{
|
|
429
|
+
label: "Person",
|
|
430
|
+
paramKey: "user",
|
|
431
|
+
params: r,
|
|
432
|
+
setParams: a,
|
|
433
|
+
options: (l == null ? void 0 : l.facets.people) ?? []
|
|
434
|
+
}
|
|
435
|
+
),
|
|
436
|
+
/* @__PURE__ */ t(
|
|
437
|
+
q,
|
|
438
|
+
{
|
|
439
|
+
label: "Tool",
|
|
440
|
+
paramKey: "tool",
|
|
441
|
+
params: r,
|
|
442
|
+
setParams: a,
|
|
443
|
+
options: (l == null ? void 0 : l.facets.tools) ?? []
|
|
444
|
+
}
|
|
445
|
+
),
|
|
446
|
+
/* @__PURE__ */ t(
|
|
447
|
+
q,
|
|
448
|
+
{
|
|
449
|
+
label: "Result",
|
|
450
|
+
paramKey: "result",
|
|
451
|
+
params: r,
|
|
452
|
+
setParams: a,
|
|
453
|
+
options: je.map((e) => {
|
|
454
|
+
var n;
|
|
455
|
+
return {
|
|
456
|
+
value: e,
|
|
457
|
+
label: W(e),
|
|
458
|
+
count: ((n = ((l == null ? void 0 : l.by_result) ?? []).find((m) => m.key === e)) == null ? void 0 : n.calls) ?? (e === "ok" ? ((l == null ? void 0 : l.calls) ?? 0) - ((l == null ? void 0 : l.errors) ?? 0) : 0)
|
|
459
|
+
};
|
|
460
|
+
})
|
|
461
|
+
}
|
|
462
|
+
),
|
|
463
|
+
/* @__PURE__ */ t(Re, { params: r, setParams: a })
|
|
464
|
+
] }),
|
|
465
|
+
E.length > 0 && /* @__PURE__ */ o("ul", { className: "flex flex-wrap items-center gap-1.5", "aria-label": "Filters that are on", children: [
|
|
466
|
+
E.map((e) => /* @__PURE__ */ o(
|
|
467
|
+
"li",
|
|
468
|
+
{
|
|
469
|
+
className: "inline-flex h-6 items-center gap-1 rounded-full border border-nvr-cyan/50 bg-nvr-cyan/10 pl-2.5 pr-1 text-[11.5px] text-slate-800 animate-in fade-in-0 zoom-in-95 duration-150 motion-reduce:animate-none dark:text-foreground",
|
|
470
|
+
children: [
|
|
471
|
+
e.label,
|
|
472
|
+
/* @__PURE__ */ t(
|
|
473
|
+
"button",
|
|
474
|
+
{
|
|
475
|
+
type: "button",
|
|
476
|
+
"aria-label": `Remove the filter ${e.label}`,
|
|
477
|
+
onClick: () => a((n) => e.clear(n), { replace: !0 }),
|
|
478
|
+
className: "inline-flex h-4 w-4 items-center justify-center rounded-full text-slate-500 hover:bg-nvr-cyan/20 hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:hover:text-foreground",
|
|
479
|
+
children: /* @__PURE__ */ t(ke, { className: "h-3 w-3", "aria-hidden": !0 })
|
|
480
|
+
}
|
|
481
|
+
)
|
|
187
482
|
]
|
|
188
|
-
})),
|
|
189
|
-
heads: ["Questions", "Calls", "Spend", "Avg", "Err"],
|
|
190
|
-
onPick: (t) => {
|
|
191
|
-
i(t === o ? "" : t), b(1);
|
|
192
483
|
},
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
484
|
+
e.key
|
|
485
|
+
)),
|
|
486
|
+
/* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
|
|
487
|
+
"button",
|
|
488
|
+
{
|
|
489
|
+
type: "button",
|
|
490
|
+
onClick: () => a((e) => de(e), { replace: !0 }),
|
|
491
|
+
className: "rounded px-1.5 text-[11.5px] text-slate-500 underline-offset-2 hover:text-slate-900 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:hover:text-foreground",
|
|
492
|
+
children: "Clear all"
|
|
493
|
+
}
|
|
494
|
+
) })
|
|
495
|
+
] })
|
|
496
|
+
] }),
|
|
497
|
+
y.isError && !l ? /* @__PURE__ */ t(
|
|
498
|
+
ne,
|
|
499
|
+
{
|
|
500
|
+
error: y.error,
|
|
501
|
+
what: "the AI figures",
|
|
502
|
+
onRetry: () => void y.refetch()
|
|
503
|
+
}
|
|
504
|
+
) : /* @__PURE__ */ o(M, { children: [
|
|
505
|
+
/* @__PURE__ */ t(
|
|
506
|
+
"div",
|
|
198
507
|
{
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
508
|
+
className: g(
|
|
509
|
+
"grid grid-cols-2 gap-px overflow-hidden rounded-lg border border-slate-200 bg-slate-200 transition-opacity sm:grid-cols-4 xl:grid-cols-7 dark:border-border dark:bg-border",
|
|
510
|
+
V && "opacity-60"
|
|
511
|
+
),
|
|
512
|
+
"data-ai-stat-strip": !0,
|
|
513
|
+
"aria-busy": V,
|
|
514
|
+
children: l ? /* @__PURE__ */ o(M, { children: [
|
|
515
|
+
/* @__PURE__ */ t(
|
|
516
|
+
k,
|
|
517
|
+
{
|
|
518
|
+
label: "Questions",
|
|
519
|
+
value: u(l.questions),
|
|
520
|
+
sub: `${(l.calls / Math.max(1, l.questions)).toFixed(1)} calls each`
|
|
521
|
+
}
|
|
522
|
+
),
|
|
523
|
+
/* @__PURE__ */ t(
|
|
524
|
+
k,
|
|
525
|
+
{
|
|
526
|
+
label: "Model calls",
|
|
527
|
+
value: u(l.calls),
|
|
528
|
+
sub: `${u(l.tool_calls)} tool calls`
|
|
529
|
+
}
|
|
530
|
+
),
|
|
531
|
+
/* @__PURE__ */ t(k, { label: "Spend", value: v(l.cost_usd), sub: "at list price" }),
|
|
532
|
+
/* @__PURE__ */ t(
|
|
533
|
+
k,
|
|
534
|
+
{
|
|
535
|
+
label: "Tokens",
|
|
536
|
+
value: w(l.input_tokens + l.output_tokens),
|
|
537
|
+
sub: `${w(l.cache_read_tokens)} cached · ${w(l.output_tokens)} out`
|
|
538
|
+
}
|
|
539
|
+
),
|
|
540
|
+
/* @__PURE__ */ t(
|
|
541
|
+
k,
|
|
542
|
+
{
|
|
543
|
+
label: "Time p50 / p95",
|
|
544
|
+
value: `${T(l.p50)} / ${T(l.p95)}`,
|
|
545
|
+
sub: `avg ${T(l.avg_latency)}`
|
|
546
|
+
}
|
|
547
|
+
),
|
|
548
|
+
/* @__PURE__ */ t(
|
|
549
|
+
k,
|
|
550
|
+
{
|
|
551
|
+
label: "Error rate",
|
|
552
|
+
value: ie(l.errors, l.calls),
|
|
553
|
+
sub: `${u(l.errors)} failed`,
|
|
554
|
+
active: N(r, "result").includes("error"),
|
|
555
|
+
onClick: l.errors || N(r, "result").includes("error") ? () => C("result", "error") : void 0,
|
|
556
|
+
tip: "Show only the calls that failed"
|
|
557
|
+
}
|
|
558
|
+
),
|
|
559
|
+
/* @__PURE__ */ t(
|
|
560
|
+
k,
|
|
561
|
+
{
|
|
562
|
+
className: "col-span-2 xl:col-span-1",
|
|
563
|
+
label: "Helpful",
|
|
564
|
+
value: l.feedback.up + l.feedback.down ? ie(l.feedback.up, l.feedback.up + l.feedback.down) : "–",
|
|
565
|
+
sub: `${u(l.feedback.up)} up · ${u(l.feedback.down)} down`,
|
|
566
|
+
active: r.get("feedback") === "any",
|
|
567
|
+
onClick: () => a((e) => {
|
|
568
|
+
e.get("feedback") === "any" ? e.delete("feedback") : e.set("feedback", "any"), e.delete("page");
|
|
569
|
+
}),
|
|
570
|
+
tip: "Show only the questions people rated"
|
|
571
|
+
}
|
|
572
|
+
)
|
|
573
|
+
] }) : Array.from({ length: 7 }, (e, n) => (
|
|
574
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: skeleton cells
|
|
575
|
+
/* @__PURE__ */ o("div", { className: "bg-white px-3 py-2.5 dark:bg-card", children: [
|
|
576
|
+
/* @__PURE__ */ t(B, { className: "h-3 w-16" }),
|
|
577
|
+
/* @__PURE__ */ t(B, { className: "mt-2 h-5 w-20" })
|
|
578
|
+
] }, n)
|
|
579
|
+
))
|
|
212
580
|
}
|
|
213
581
|
),
|
|
214
|
-
/* @__PURE__ */
|
|
215
|
-
|
|
582
|
+
l && /* @__PURE__ */ t(
|
|
583
|
+
he,
|
|
216
584
|
{
|
|
217
|
-
title: "
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
label: t.name,
|
|
221
|
-
cells: [c(t.requests), c(t.calls), m(t.cost_usd)]
|
|
222
|
-
})),
|
|
223
|
-
heads: ["Questions", "Calls", "Spend"]
|
|
585
|
+
title: l.bucket === "hour" ? "Calls per hour" : "Calls per day",
|
|
586
|
+
hint: "The amber part of a bar is calls that failed. Click a bar to see only its calls.",
|
|
587
|
+
children: /* @__PURE__ */ t(We, { s: l, onPick: fe })
|
|
224
588
|
}
|
|
225
|
-
)
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-center gap-2 border-b border-border px-3 py-2", children: [
|
|
230
|
-
/* @__PURE__ */ e("span", { className: "text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Call log" }),
|
|
231
|
-
o ? /* @__PURE__ */ r(
|
|
232
|
-
"button",
|
|
589
|
+
),
|
|
590
|
+
l && /* @__PURE__ */ o("div", { className: "grid gap-3 md:grid-cols-2 xl:grid-cols-4", children: [
|
|
591
|
+
/* @__PURE__ */ t(
|
|
592
|
+
A,
|
|
233
593
|
{
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
o,
|
|
240
|
-
" ×"
|
|
241
|
-
]
|
|
594
|
+
title: "By feature",
|
|
595
|
+
rows: l.by_feature,
|
|
596
|
+
label: (e) => F(e.key ?? ""),
|
|
597
|
+
activeKeys: N(r, "feature"),
|
|
598
|
+
onPick: (e) => C("feature", e)
|
|
242
599
|
}
|
|
243
|
-
)
|
|
244
|
-
/* @__PURE__ */
|
|
245
|
-
|
|
246
|
-
["ok", "OK"],
|
|
247
|
-
["error", "Errors"]
|
|
248
|
-
].map(([t, q]) => /* @__PURE__ */ e(
|
|
249
|
-
"button",
|
|
600
|
+
),
|
|
601
|
+
/* @__PURE__ */ t(
|
|
602
|
+
A,
|
|
250
603
|
{
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
},
|
|
261
|
-
t
|
|
262
|
-
)) }),
|
|
263
|
-
x ? /* @__PURE__ */ r(
|
|
264
|
-
"button",
|
|
604
|
+
title: "By model",
|
|
605
|
+
rows: l.by_model,
|
|
606
|
+
label: (e) => e.key ?? "",
|
|
607
|
+
activeKeys: N(r, "model"),
|
|
608
|
+
onPick: (e) => C("model", e)
|
|
609
|
+
}
|
|
610
|
+
),
|
|
611
|
+
/* @__PURE__ */ t(
|
|
612
|
+
A,
|
|
265
613
|
{
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
x.slice(0, 8),
|
|
272
|
-
" ×"
|
|
273
|
-
]
|
|
614
|
+
title: "By person",
|
|
615
|
+
rows: l.by_person,
|
|
616
|
+
label: (e) => e.name ?? "",
|
|
617
|
+
activeKeys: N(r, "user"),
|
|
618
|
+
onPick: (e) => C("user", e)
|
|
274
619
|
}
|
|
275
|
-
)
|
|
276
|
-
/* @__PURE__ */
|
|
277
|
-
A
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
/* @__PURE__ */
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
"
|
|
620
|
+
),
|
|
621
|
+
/* @__PURE__ */ t(
|
|
622
|
+
A,
|
|
623
|
+
{
|
|
624
|
+
title: "By result",
|
|
625
|
+
rows: l.by_result,
|
|
626
|
+
label: (e) => W(e.key),
|
|
627
|
+
activeKeys: N(r, "result"),
|
|
628
|
+
onPick: (e) => C("result", e)
|
|
629
|
+
}
|
|
630
|
+
)
|
|
631
|
+
] })
|
|
632
|
+
] }),
|
|
633
|
+
/* @__PURE__ */ o(
|
|
634
|
+
"section",
|
|
635
|
+
{
|
|
636
|
+
className: "min-w-0 rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card",
|
|
637
|
+
"data-ai-call-log": !0,
|
|
638
|
+
"aria-label": "Call log",
|
|
639
|
+
children: [
|
|
640
|
+
/* @__PURE__ */ o("header", { className: "flex flex-wrap items-center gap-2 border-b border-slate-100 px-4 py-2.5 dark:border-border/60", children: [
|
|
641
|
+
/* @__PURE__ */ t("h3", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: "Call log" }),
|
|
642
|
+
/* @__PURE__ */ o("span", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: [
|
|
643
|
+
u(_),
|
|
644
|
+
" ",
|
|
645
|
+
_ === 1 ? "call" : "calls",
|
|
646
|
+
_ > U ? ` · page ${b} of ${u(P)}` : ""
|
|
647
|
+
] }),
|
|
648
|
+
/* @__PURE__ */ t("span", { className: "ml-auto hidden text-[11.5px] text-slate-500 sm:inline dark:text-muted-foreground", children: "Click a call to read it. Bodies are kept 30 days." })
|
|
649
|
+
] }),
|
|
650
|
+
x.isError && !x.data ? /* @__PURE__ */ t(
|
|
651
|
+
ne,
|
|
652
|
+
{
|
|
653
|
+
error: x.error,
|
|
654
|
+
what: "the call log",
|
|
655
|
+
onRetry: () => void x.refetch()
|
|
656
|
+
}
|
|
657
|
+
) : /* @__PURE__ */ o(M, { children: [
|
|
658
|
+
/* @__PURE__ */ t(
|
|
659
|
+
"div",
|
|
302
660
|
{
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
"
|
|
306
|
-
|
|
661
|
+
className: g(
|
|
662
|
+
"hidden overflow-x-auto md:block",
|
|
663
|
+
x.isPlaceholderData && "opacity-60"
|
|
664
|
+
),
|
|
665
|
+
children: /* @__PURE__ */ o("table", { className: "w-full text-left text-[12px]", children: [
|
|
666
|
+
/* @__PURE__ */ t("thead", { className: "border-b border-slate-100 text-[11px] text-slate-500 dark:border-border/60 dark:text-muted-foreground", children: /* @__PURE__ */ t("tr", { children: ce.map((e) => /* @__PURE__ */ t(He, { col: e, sort: p, onSort: G }, e.key)) }) }),
|
|
667
|
+
/* @__PURE__ */ t("tbody", { className: "divide-y divide-slate-100 tabular-nums dark:divide-border/60", children: x.isLoading && !O.length ? Array.from({ length: 8 }, (e, n) => (
|
|
668
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: skeleton rows
|
|
669
|
+
/* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", { colSpan: ce.length, className: "px-2 py-2", children: /* @__PURE__ */ t(B, { className: "h-4 w-full" }) }) }, n)
|
|
670
|
+
)) : O.map((e) => /* @__PURE__ */ o(
|
|
671
|
+
"tr",
|
|
672
|
+
{
|
|
673
|
+
"data-ai-call": e.id,
|
|
674
|
+
tabIndex: 0,
|
|
675
|
+
onClick: () => R(e.id),
|
|
676
|
+
onKeyDown: (n) => {
|
|
677
|
+
(n.key === "Enter" || n.key === " ") && (n.preventDefault(), R(e.id));
|
|
678
|
+
},
|
|
679
|
+
"aria-label": `Open call ${e.id}`,
|
|
680
|
+
className: g(
|
|
681
|
+
"cursor-pointer transition-colors hover:bg-slate-50 focus-visible:bg-slate-50 focus-visible:outline-none dark:hover:bg-muted/40 dark:focus-visible:bg-muted/40",
|
|
682
|
+
H === e.id && "bg-nvr-cyan/10 hover:bg-nvr-cyan/10"
|
|
683
|
+
),
|
|
684
|
+
children: [
|
|
685
|
+
/* @__PURE__ */ t(
|
|
686
|
+
"td",
|
|
687
|
+
{
|
|
688
|
+
className: "whitespace-nowrap px-2 py-2 text-slate-600 dark:text-muted-foreground",
|
|
689
|
+
"data-tip": new Date(e.created_at).toLocaleString(),
|
|
690
|
+
children: L(e.created_at)
|
|
691
|
+
}
|
|
692
|
+
),
|
|
693
|
+
/* @__PURE__ */ t("td", { className: "max-w-[380px] px-2 py-2", children: /* @__PURE__ */ t(
|
|
694
|
+
ze,
|
|
695
|
+
{
|
|
696
|
+
r: e,
|
|
697
|
+
onRequest: (n) => a((m) => {
|
|
698
|
+
m.set("request_id", n), m.delete("page");
|
|
699
|
+
})
|
|
700
|
+
}
|
|
701
|
+
) }),
|
|
702
|
+
/* @__PURE__ */ t("td", { className: "max-w-[160px] truncate px-2 py-2", children: e.user_name ?? "System" }),
|
|
703
|
+
/* @__PURE__ */ o("td", { className: "whitespace-nowrap px-2 py-2 font-mono text-[11px]", children: [
|
|
704
|
+
e.model,
|
|
705
|
+
e.tier && /* @__PURE__ */ t(
|
|
706
|
+
"span",
|
|
707
|
+
{
|
|
708
|
+
className: "ml-1.5 rounded bg-slate-100 px-1 py-px font-sans text-[10px] text-slate-500 dark:bg-muted",
|
|
709
|
+
"data-tip": e.tier === "cheap" ? "Started cheap: the small model" : `Moved up to the main model${e.tier_reason ? ` (${e.tier_reason.replace(/_/g, " ")})` : ""}`,
|
|
710
|
+
children: e.tier === "cheap" ? "quick" : "moved up"
|
|
711
|
+
}
|
|
712
|
+
)
|
|
713
|
+
] }),
|
|
714
|
+
/* @__PURE__ */ t("td", { className: "px-2 py-2 text-right", children: w(e.input_tokens) }),
|
|
715
|
+
/* @__PURE__ */ t("td", { className: "px-2 py-2 text-right text-slate-500 dark:text-muted-foreground", children: w(e.cache_read_tokens) }),
|
|
716
|
+
/* @__PURE__ */ t("td", { className: "px-2 py-2 text-right", children: w(e.output_tokens) }),
|
|
717
|
+
/* @__PURE__ */ t("td", { className: "px-2 py-2 text-right", children: v(e.cost_usd, 3) }),
|
|
718
|
+
/* @__PURE__ */ t("td", { className: "px-2 py-2 text-right", children: T(e.latency_ms) }),
|
|
719
|
+
/* @__PURE__ */ t("td", { className: "px-2 py-2", children: /* @__PURE__ */ t(ue, { r: e }) })
|
|
720
|
+
]
|
|
721
|
+
},
|
|
722
|
+
e.id
|
|
723
|
+
)) })
|
|
724
|
+
] })
|
|
725
|
+
}
|
|
726
|
+
),
|
|
727
|
+
/* @__PURE__ */ o("div", { className: "md:hidden", children: [
|
|
728
|
+
/* @__PURE__ */ o("div", { className: "flex items-center gap-2 border-b border-slate-100 px-3 py-2 text-[12px] dark:border-border/60", children: [
|
|
729
|
+
/* @__PURE__ */ t("span", { className: "text-slate-500", children: "Sort" }),
|
|
730
|
+
/* @__PURE__ */ t(
|
|
731
|
+
oe,
|
|
732
|
+
{
|
|
733
|
+
ariaLabel: "Sort",
|
|
734
|
+
value: p.key,
|
|
735
|
+
onChange: (e) => G(e),
|
|
736
|
+
options: [
|
|
737
|
+
{ value: "when", label: "When" },
|
|
738
|
+
{ value: "cost", label: "Cost" },
|
|
739
|
+
{ value: "time", label: "Time" }
|
|
740
|
+
]
|
|
741
|
+
}
|
|
307
742
|
),
|
|
308
|
-
|
|
743
|
+
/* @__PURE__ */ t("span", { className: "text-slate-400", children: p.dir === "asc" ? "↑" : "↓" })
|
|
744
|
+
] }),
|
|
745
|
+
/* @__PURE__ */ t(
|
|
746
|
+
"ul",
|
|
747
|
+
{
|
|
748
|
+
className: g(
|
|
749
|
+
"divide-y divide-slate-100 dark:divide-border/60",
|
|
750
|
+
x.isPlaceholderData && "opacity-60"
|
|
751
|
+
),
|
|
752
|
+
children: O.map((e) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ o(
|
|
753
|
+
"button",
|
|
754
|
+
{
|
|
755
|
+
type: "button",
|
|
756
|
+
onClick: () => R(e.id),
|
|
757
|
+
className: "flex w-full flex-col gap-1 px-3 py-2.5 text-left text-[12px] hover:bg-slate-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-nvr-cyan/50 dark:hover:bg-muted/40",
|
|
758
|
+
children: [
|
|
759
|
+
/* @__PURE__ */ t("span", { className: "line-clamp-2 font-medium text-slate-900 dark:text-foreground", children: e.question || `${F(e.feature)} call` }),
|
|
760
|
+
/* @__PURE__ */ o("span", { className: "flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-slate-500 dark:text-muted-foreground", children: [
|
|
761
|
+
/* @__PURE__ */ t("span", { children: L(e.created_at) }),
|
|
762
|
+
/* @__PURE__ */ t("span", { children: e.user_name ?? "System" }),
|
|
763
|
+
/* @__PURE__ */ o("span", { className: "tabular-nums", children: [
|
|
764
|
+
v(e.cost_usd, 3),
|
|
765
|
+
" · ",
|
|
766
|
+
T(e.latency_ms)
|
|
767
|
+
] }),
|
|
768
|
+
/* @__PURE__ */ t(ue, { r: e })
|
|
769
|
+
] })
|
|
770
|
+
]
|
|
771
|
+
}
|
|
772
|
+
) }, e.id))
|
|
773
|
+
}
|
|
774
|
+
)
|
|
775
|
+
] }),
|
|
776
|
+
O.length === 0 && !x.isLoading && /* @__PURE__ */ t("div", { className: "px-4 py-10 text-center text-[12.5px] text-slate-500 dark:text-muted-foreground", children: E.length ? /* @__PURE__ */ o(M, { children: [
|
|
777
|
+
"No calls match these filters.",
|
|
778
|
+
" ",
|
|
779
|
+
/* @__PURE__ */ t(
|
|
780
|
+
"button",
|
|
781
|
+
{
|
|
782
|
+
type: "button",
|
|
783
|
+
className: "text-nvr-cyan underline-offset-2 hover:underline",
|
|
784
|
+
onClick: () => a((e) => de(e)),
|
|
785
|
+
children: "Clear the filters"
|
|
786
|
+
}
|
|
787
|
+
)
|
|
788
|
+
] }) : "No AI calls in this window. Calls appear here as people use Ask AI and the other AI features." }),
|
|
789
|
+
P > 1 && /* @__PURE__ */ o(
|
|
790
|
+
"nav",
|
|
791
|
+
{
|
|
792
|
+
"aria-label": "Pages",
|
|
793
|
+
className: "flex items-center justify-end gap-2 border-t border-slate-100 px-4 py-2 text-[12px] dark:border-border/60",
|
|
309
794
|
children: [
|
|
310
|
-
/* @__PURE__ */
|
|
311
|
-
|
|
312
|
-
"td",
|
|
795
|
+
/* @__PURE__ */ t(
|
|
796
|
+
"button",
|
|
313
797
|
{
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
798
|
+
type: "button",
|
|
799
|
+
disabled: b <= 1,
|
|
800
|
+
onClick: () => a((e) => {
|
|
801
|
+
b - 1 <= 1 ? e.delete("page") : e.set("page", String(b - 1));
|
|
802
|
+
}),
|
|
803
|
+
className: "rounded-md border border-slate-200 px-2.5 py-1 hover:bg-slate-50 disabled:opacity-40 dark:border-border dark:hover:bg-muted",
|
|
804
|
+
children: "Previous"
|
|
317
805
|
}
|
|
318
806
|
),
|
|
319
|
-
/* @__PURE__ */
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
{
|
|
324
|
-
type: "button",
|
|
325
|
-
className: "ml-1 text-[10.5px] text-muted-foreground underline-offset-2 hover:underline",
|
|
326
|
-
"data-tip": "Show every call of this question",
|
|
327
|
-
onClick: (q) => {
|
|
328
|
-
q.stopPropagation(), S(t.request_id ?? ""), b(1);
|
|
329
|
-
},
|
|
330
|
-
children: [
|
|
331
|
-
"#",
|
|
332
|
-
t.request_id.slice(0, 6)
|
|
333
|
-
]
|
|
334
|
-
}
|
|
335
|
-
) : null
|
|
336
|
-
] }),
|
|
337
|
-
/* @__PURE__ */ e("td", { className: "max-w-[160px] truncate px-2 py-1.5", children: t.user_name ?? (t.user ? "…" : "System") }),
|
|
338
|
-
/* @__PURE__ */ r("td", { className: "px-2 py-1.5 font-mono text-[11px]", children: [
|
|
339
|
-
t.model,
|
|
340
|
-
t.tier && /* @__PURE__ */ e(
|
|
341
|
-
"span",
|
|
342
|
-
{
|
|
343
|
-
className: "ml-1.5 rounded bg-muted px-1 py-px font-sans text-[10px] text-muted-foreground",
|
|
344
|
-
"data-tip": t.tier === "cheap" ? "Started cheap: the small model" : `Moved up to the main model${t.tier_reason ? ` (${t.tier_reason.replace(/_/g, " ")})` : ""}`,
|
|
345
|
-
children: t.tier === "cheap" ? "quick" : "moved up"
|
|
346
|
-
}
|
|
347
|
-
)
|
|
348
|
-
] }),
|
|
349
|
-
/* @__PURE__ */ e("td", { className: "px-2 py-1.5 text-right", children: u(t.input_tokens) }),
|
|
350
|
-
/* @__PURE__ */ e("td", { className: "px-2 py-1.5 text-right text-muted-foreground", children: u(t.cache_read_tokens) }),
|
|
351
|
-
/* @__PURE__ */ e("td", { className: "px-2 py-1.5 text-right", children: u(t.output_tokens) }),
|
|
352
|
-
/* @__PURE__ */ e("td", { className: "px-2 py-1.5 text-right", children: m(t.cost_usd, 3) }),
|
|
353
|
-
/* @__PURE__ */ r("td", { className: "px-2 py-1.5 text-right", children: [
|
|
354
|
-
(t.latency_ms / 1e3).toFixed(1),
|
|
355
|
-
"s"
|
|
807
|
+
/* @__PURE__ */ o("span", { className: "tabular-nums text-slate-500", children: [
|
|
808
|
+
b,
|
|
809
|
+
" / ",
|
|
810
|
+
u(P)
|
|
356
811
|
] }),
|
|
357
|
-
/* @__PURE__ */
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
812
|
+
/* @__PURE__ */ t(
|
|
813
|
+
"button",
|
|
814
|
+
{
|
|
815
|
+
type: "button",
|
|
816
|
+
disabled: b >= P,
|
|
817
|
+
onClick: () => a((e) => e.set("page", String(b + 1))),
|
|
818
|
+
className: "rounded-md border border-slate-200 px-2.5 py-1 hover:bg-slate-50 disabled:opacity-40 dark:border-border dark:hover:bg-muted",
|
|
819
|
+
children: "Next"
|
|
820
|
+
}
|
|
821
|
+
)
|
|
361
822
|
]
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
onClick: () => b(h - 1),
|
|
377
|
-
className: "rounded border border-border px-2 py-0.5 disabled:opacity-40",
|
|
378
|
-
children: "Prev"
|
|
379
|
-
}
|
|
380
|
-
),
|
|
381
|
-
/* @__PURE__ */ e(
|
|
382
|
-
"button",
|
|
383
|
-
{
|
|
384
|
-
type: "button",
|
|
385
|
-
disabled: h >= I,
|
|
386
|
-
onClick: () => b(h + 1),
|
|
387
|
-
className: "rounded border border-border px-2 py-0.5 disabled:opacity-40",
|
|
388
|
-
children: "Next"
|
|
389
|
-
}
|
|
823
|
+
}
|
|
824
|
+
)
|
|
825
|
+
] })
|
|
826
|
+
]
|
|
827
|
+
}
|
|
828
|
+
),
|
|
829
|
+
/* @__PURE__ */ t(
|
|
830
|
+
Ge,
|
|
831
|
+
{
|
|
832
|
+
days: Math.max(
|
|
833
|
+
1,
|
|
834
|
+
Math.round(
|
|
835
|
+
(l ? new Date(l.to).getTime() - new Date(l.from).getTime() : 7 * 864e5) / 864e5
|
|
836
|
+
)
|
|
390
837
|
)
|
|
391
|
-
|
|
392
|
-
|
|
838
|
+
}
|
|
839
|
+
),
|
|
840
|
+
/* @__PURE__ */ t(
|
|
841
|
+
Oe,
|
|
842
|
+
{
|
|
843
|
+
callId: H,
|
|
844
|
+
threadOpen: r.get("thread") === "1",
|
|
845
|
+
onClose: () => a((e) => {
|
|
846
|
+
e.delete("call"), e.delete("thread");
|
|
847
|
+
}),
|
|
848
|
+
onOpenCall: R,
|
|
849
|
+
onThread: (e) => a((n) => {
|
|
850
|
+
e ? n.set("thread", "1") : n.delete("thread");
|
|
851
|
+
})
|
|
852
|
+
}
|
|
853
|
+
)
|
|
393
854
|
] });
|
|
394
855
|
}
|
|
395
|
-
function
|
|
396
|
-
title:
|
|
397
|
-
heads:
|
|
398
|
-
rows:
|
|
399
|
-
onPick:
|
|
400
|
-
active:
|
|
856
|
+
function pe({
|
|
857
|
+
title: s,
|
|
858
|
+
heads: d,
|
|
859
|
+
rows: h,
|
|
860
|
+
onPick: i,
|
|
861
|
+
active: r
|
|
401
862
|
}) {
|
|
402
|
-
return /* @__PURE__ */
|
|
863
|
+
return /* @__PURE__ */ t(
|
|
403
864
|
"div",
|
|
404
865
|
{
|
|
405
866
|
className: "overflow-x-auto rounded-lg border border-border bg-card",
|
|
406
|
-
"data-ai-breakdown":
|
|
407
|
-
children: /* @__PURE__ */
|
|
408
|
-
/* @__PURE__ */
|
|
409
|
-
/* @__PURE__ */
|
|
410
|
-
|
|
867
|
+
"data-ai-breakdown": s,
|
|
868
|
+
children: /* @__PURE__ */ o("table", { className: "w-full text-left text-[12px]", children: [
|
|
869
|
+
/* @__PURE__ */ t("thead", { className: "text-[10.5px] uppercase tracking-wide text-muted-foreground", children: /* @__PURE__ */ o("tr", { className: "border-b border-border", children: [
|
|
870
|
+
/* @__PURE__ */ t("th", { className: "px-3 py-1.5", children: s }),
|
|
871
|
+
d.map((a) => /* @__PURE__ */ t("th", { className: "px-2 py-1.5 text-right", children: a }, a))
|
|
411
872
|
] }) }),
|
|
412
|
-
/* @__PURE__ */
|
|
413
|
-
|
|
873
|
+
/* @__PURE__ */ o("tbody", { className: "divide-y divide-border tabular-nums", children: [
|
|
874
|
+
h.map((a) => /* @__PURE__ */ o(
|
|
414
875
|
"tr",
|
|
415
876
|
{
|
|
416
|
-
className:
|
|
417
|
-
|
|
418
|
-
|
|
877
|
+
className: g(
|
|
878
|
+
i && "cursor-pointer hover:bg-muted/50",
|
|
879
|
+
r === a.key && "bg-nvr-cyan/10"
|
|
419
880
|
),
|
|
420
|
-
onClick: () =>
|
|
881
|
+
onClick: () => i == null ? void 0 : i(a.key),
|
|
421
882
|
children: [
|
|
422
|
-
/* @__PURE__ */
|
|
423
|
-
|
|
883
|
+
/* @__PURE__ */ t("td", { className: "max-w-[220px] truncate px-3 py-1.5", children: a.label }),
|
|
884
|
+
a.cells.map((f, c) => (
|
|
424
885
|
// biome-ignore lint/suspicious/noArrayIndexKey: fixed column order
|
|
425
|
-
/* @__PURE__ */
|
|
886
|
+
/* @__PURE__ */ t("td", { className: "px-2 py-1.5 text-right", children: f }, c)
|
|
426
887
|
))
|
|
427
888
|
]
|
|
428
889
|
},
|
|
429
|
-
|
|
890
|
+
a.key
|
|
430
891
|
)),
|
|
431
|
-
|
|
892
|
+
h.length === 0 ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t(
|
|
432
893
|
"td",
|
|
433
894
|
{
|
|
434
|
-
colSpan:
|
|
895
|
+
colSpan: d.length + 1,
|
|
435
896
|
className: "px-3 py-4 text-center text-muted-foreground",
|
|
436
897
|
children: "Nothing yet"
|
|
437
898
|
}
|
|
@@ -441,65 +902,65 @@ function N({
|
|
|
441
902
|
}
|
|
442
903
|
);
|
|
443
904
|
}
|
|
444
|
-
function
|
|
445
|
-
return
|
|
905
|
+
function D(s, d) {
|
|
906
|
+
return d ? `${Math.round(s / d * 100)}%` : "—";
|
|
446
907
|
}
|
|
447
|
-
function
|
|
448
|
-
var
|
|
449
|
-
const
|
|
450
|
-
queryKey: ["nvr-ai-autofill-analytics",
|
|
451
|
-
queryFn: () =>
|
|
908
|
+
function Ge({ days: s }) {
|
|
909
|
+
var r;
|
|
910
|
+
const d = me(), i = (r = j({
|
|
911
|
+
queryKey: ["nvr-ai-autofill-analytics", s],
|
|
912
|
+
queryFn: () => d.request(Q("/ai/extract-record/analytics", { days: s })),
|
|
452
913
|
refetchInterval: 6e4
|
|
453
|
-
}).data) == null ? void 0 :
|
|
454
|
-
return !
|
|
455
|
-
/* @__PURE__ */
|
|
456
|
-
/* @__PURE__ */
|
|
914
|
+
}).data) == null ? void 0 : r.data;
|
|
915
|
+
return !i || i.documents === 0 ? null : /* @__PURE__ */ o("div", { className: "flex flex-col gap-3", "data-ai-autofill-scorecard": !0, children: [
|
|
916
|
+
/* @__PURE__ */ o("div", { className: "flex items-baseline gap-2", children: [
|
|
917
|
+
/* @__PURE__ */ o("span", { className: "text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: [
|
|
457
918
|
"Document autofill · last ",
|
|
458
|
-
|
|
919
|
+
i.days,
|
|
459
920
|
" days"
|
|
460
921
|
] }),
|
|
461
|
-
/* @__PURE__ */
|
|
462
|
-
|
|
922
|
+
/* @__PURE__ */ o("span", { className: "text-[11.5px] text-muted-foreground", children: [
|
|
923
|
+
u(i.documents),
|
|
463
924
|
" document",
|
|
464
|
-
|
|
925
|
+
i.documents === 1 ? "" : "s",
|
|
465
926
|
" · ",
|
|
466
|
-
|
|
467
|
-
|
|
927
|
+
v(i.cost_usd),
|
|
928
|
+
i.avg_latency_ms ? ` · ${(i.avg_latency_ms / 1e3).toFixed(0)}s per document` : ""
|
|
468
929
|
] })
|
|
469
930
|
] }),
|
|
470
|
-
/* @__PURE__ */
|
|
471
|
-
/* @__PURE__ */
|
|
472
|
-
|
|
931
|
+
/* @__PURE__ */ o("div", { className: "grid gap-3 lg:grid-cols-2", children: [
|
|
932
|
+
/* @__PURE__ */ t(
|
|
933
|
+
pe,
|
|
473
934
|
{
|
|
474
935
|
title: "By collection",
|
|
475
936
|
heads: ["Docs", "Kept", "Changed", "Lines kept", "Asked", "Spend"],
|
|
476
|
-
rows:
|
|
477
|
-
key:
|
|
478
|
-
label:
|
|
937
|
+
rows: i.by_collection.map((a) => ({
|
|
938
|
+
key: a.collection,
|
|
939
|
+
label: a.collection,
|
|
479
940
|
cells: [
|
|
480
|
-
|
|
481
|
-
`${
|
|
482
|
-
|
|
483
|
-
`${
|
|
484
|
-
`${
|
|
485
|
-
|
|
941
|
+
u(a.documents),
|
|
942
|
+
`${D(a.fields_kept, a.fields_proposed)} of ${u(a.fields_proposed)}`,
|
|
943
|
+
D(a.fields_overridden, a.fields_kept),
|
|
944
|
+
`${D(a.lines_kept, a.lines_proposed)} of ${u(a.lines_proposed)}`,
|
|
945
|
+
`${u(a.asks_resolved)}/${u(a.asks)}`,
|
|
946
|
+
v(a.cost_usd)
|
|
486
947
|
]
|
|
487
948
|
}))
|
|
488
949
|
}
|
|
489
950
|
),
|
|
490
|
-
/* @__PURE__ */
|
|
491
|
-
|
|
951
|
+
/* @__PURE__ */ t(
|
|
952
|
+
pe,
|
|
492
953
|
{
|
|
493
954
|
title: "By field",
|
|
494
955
|
heads: ["Proposed", "Kept", "Changed", "Conf."],
|
|
495
|
-
rows:
|
|
496
|
-
key: `${
|
|
497
|
-
label: `${
|
|
956
|
+
rows: i.by_field.slice(0, 25).map((a) => ({
|
|
957
|
+
key: `${a.collection}:${a.field}`,
|
|
958
|
+
label: `${a.collection} · ${a.field}`,
|
|
498
959
|
cells: [
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
960
|
+
u(a.proposed),
|
|
961
|
+
D(a.kept, a.proposed),
|
|
962
|
+
D(a.overridden, a.proposed),
|
|
963
|
+
a.avg_confidence == null ? "—" : `${Math.round(a.avg_confidence * 100)}%`
|
|
503
964
|
]
|
|
504
965
|
}))
|
|
505
966
|
}
|
|
@@ -508,5 +969,5 @@ function V({ days: d }) {
|
|
|
508
969
|
] });
|
|
509
970
|
}
|
|
510
971
|
export {
|
|
511
|
-
|
|
972
|
+
ut as AiAnalyticsView
|
|
512
973
|
};
|