@thehammer/template-verification 0.1.2 → 0.2.1
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/components/AuditCallCard.vue.d.ts +12 -0
- package/dist/components/VerificationModal.vue.d.ts +13 -6
- package/dist/components/VerifiedField.vue.d.ts +8 -7
- package/dist/context.d.ts +8 -0
- package/dist/index.d.ts +4 -0
- package/dist/lib/audit.d.ts +25 -0
- package/dist/lib/progress.d.ts +19 -0
- package/dist/style.css +1 -1
- package/dist/template-verification.js +877 -502
- package/dist/types.d.ts +10 -0
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ref as U, watch as
|
|
2
|
-
import { DanxDialog as
|
|
3
|
-
const
|
|
4
|
-
let
|
|
5
|
-
function
|
|
1
|
+
import { ref as U, watch as ce, defineComponent as K, computed as u, openBlock as l, createElementBlock as i, normalizeClass as A, createElementVNode as n, toDisplayString as y, createCommentVNode as _, createBlock as N, unref as r, withCtx as I, createTextVNode as T, createVNode as V, Fragment as L, renderList as M, withKeys as Te, withModifiers as Ue, renderSlot as Ne, withDirectives as Ae, isRef as ge, vModelCheckbox as Re } from "vue";
|
|
2
|
+
import { DanxChip as J, CodeViewer as xe, useToast as _e, DanxDialog as re, DanxProgressBar as we, DanxAlert as ye, DanxTabs as Le, MarkdownEditor as je, DanxFileViewer as be, DanxButton as se, DanxInput as Ee, DanxSkeleton as ze, DanxTooltip as Pe, DanxIcon as Me, gearIcon as Be, DanxBadge as Fe, DanxToastContainer as qe } from "@thehammer/danx-ui";
|
|
3
|
+
const P = "tv-chrome", ke = "template-verification:enabled";
|
|
4
|
+
let te = null;
|
|
5
|
+
function Ye(e) {
|
|
6
6
|
var t;
|
|
7
7
|
try {
|
|
8
8
|
return ((t = globalThis.localStorage) == null ? void 0 : t.getItem(e)) ?? null;
|
|
@@ -10,123 +10,128 @@ function $e(e) {
|
|
|
10
10
|
return null;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
var
|
|
13
|
+
function Je(e, t) {
|
|
14
|
+
var a;
|
|
15
15
|
try {
|
|
16
|
-
(
|
|
16
|
+
(a = globalThis.localStorage) == null || a.setItem(e, t);
|
|
17
17
|
} catch {
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
const t =
|
|
20
|
+
function Ke(e) {
|
|
21
|
+
const t = Ye(ke);
|
|
22
22
|
return t === null ? e : t === "true";
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
const t = U(
|
|
26
|
-
return
|
|
24
|
+
function $e(e) {
|
|
25
|
+
const t = U(Ke((e == null ? void 0 : e.defaultEnabled) ?? !1));
|
|
26
|
+
return ce(
|
|
27
|
+
t,
|
|
28
|
+
(a) => Je(ke, a ? "true" : "false")
|
|
29
|
+
), {
|
|
27
30
|
enabled: t,
|
|
28
31
|
data: (e == null ? void 0 : e.data) ?? {},
|
|
29
32
|
saveOverride: e == null ? void 0 : e.saveOverride,
|
|
30
33
|
workflowInputId: e == null ? void 0 : e.workflowInputId,
|
|
34
|
+
auditUrl: e == null ? void 0 : e.auditUrl,
|
|
31
35
|
comparisonOpen: U(!1)
|
|
32
36
|
};
|
|
33
37
|
}
|
|
34
|
-
function
|
|
35
|
-
return
|
|
38
|
+
function Se() {
|
|
39
|
+
return te || (te = $e()), te;
|
|
36
40
|
}
|
|
37
|
-
function
|
|
38
|
-
|
|
41
|
+
function ha(e) {
|
|
42
|
+
te = $e(e);
|
|
39
43
|
}
|
|
40
|
-
function
|
|
41
|
-
const e =
|
|
44
|
+
function le() {
|
|
45
|
+
const e = Se();
|
|
42
46
|
return {
|
|
43
47
|
enabled: e.enabled,
|
|
44
48
|
data: e.data,
|
|
45
49
|
saveOverride: e.saveOverride,
|
|
46
50
|
workflowInputId: e.workflowInputId,
|
|
51
|
+
auditUrl: e.auditUrl,
|
|
47
52
|
openComparison: () => {
|
|
48
53
|
e.comparisonOpen.value = !0;
|
|
49
54
|
}
|
|
50
55
|
};
|
|
51
56
|
}
|
|
52
|
-
function
|
|
53
|
-
return
|
|
57
|
+
function He() {
|
|
58
|
+
return Se().comparisonOpen;
|
|
54
59
|
}
|
|
55
|
-
function
|
|
60
|
+
function ve(e) {
|
|
56
61
|
return typeof e != "number" || Number.isNaN(e) ? "unverifiable" : e <= 2 ? "low" : e === 3 ? "medium" : "high";
|
|
57
62
|
}
|
|
58
|
-
const
|
|
63
|
+
const Ge = {
|
|
59
64
|
high: "bg-green-50 text-green-700 ring-1 ring-inset ring-green-600/20",
|
|
60
65
|
medium: "bg-yellow-50 text-yellow-700 ring-1 ring-inset ring-yellow-600/20",
|
|
61
66
|
low: "bg-red-50 text-red-700 ring-1 ring-inset ring-red-600/20",
|
|
62
67
|
unverifiable: "bg-gray-50 text-gray-500 ring-1 ring-inset ring-gray-400/20"
|
|
63
|
-
},
|
|
68
|
+
}, ae = {
|
|
64
69
|
high: "High",
|
|
65
70
|
medium: "Medium",
|
|
66
71
|
low: "Low",
|
|
67
72
|
unverifiable: "Unverifiable"
|
|
68
|
-
},
|
|
69
|
-
function
|
|
70
|
-
return e ? e.resolved && e.resolved.source && e.resolved.source !== "none" ? e.resolved :
|
|
73
|
+
}, Ce = ["override", "extracted", "claim"];
|
|
74
|
+
function fe(e) {
|
|
75
|
+
return e ? e.resolved && e.resolved.source && e.resolved.source !== "none" ? e.resolved : Qe(e.candidates) : { value: null, source: "none" };
|
|
71
76
|
}
|
|
72
|
-
function
|
|
77
|
+
function Qe(e) {
|
|
73
78
|
if (e)
|
|
74
|
-
for (const t of
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
77
|
-
return { value:
|
|
79
|
+
for (const t of Ce) {
|
|
80
|
+
const a = e[t];
|
|
81
|
+
if (a != null)
|
|
82
|
+
return { value: a.value, source: t };
|
|
78
83
|
}
|
|
79
84
|
return { value: null, source: "none" };
|
|
80
85
|
}
|
|
81
|
-
function
|
|
82
|
-
var
|
|
83
|
-
const t = (
|
|
86
|
+
function ie(e) {
|
|
87
|
+
var g, d;
|
|
88
|
+
const t = (d = (g = e == null ? void 0 : e.candidates) == null ? void 0 : g.extracted) == null ? void 0 : d.reasoning;
|
|
84
89
|
if (t == null) return null;
|
|
85
|
-
const
|
|
86
|
-
return
|
|
90
|
+
const a = String(t).trim();
|
|
91
|
+
return a === "" ? null : a;
|
|
87
92
|
}
|
|
88
|
-
function
|
|
89
|
-
var
|
|
90
|
-
const t = (
|
|
93
|
+
function oe(e) {
|
|
94
|
+
var g, d;
|
|
95
|
+
const t = (d = (g = e == null ? void 0 : e.candidates) == null ? void 0 : g.extracted) == null ? void 0 : d.cited_text;
|
|
91
96
|
if (t == null) return null;
|
|
92
|
-
const
|
|
93
|
-
return
|
|
97
|
+
const a = String(t).trim();
|
|
98
|
+
return a === "" ? null : a;
|
|
94
99
|
}
|
|
95
|
-
function
|
|
96
|
-
return e ? typeof e.discrepancy == "boolean" ? e.discrepancy :
|
|
100
|
+
function Ve(e) {
|
|
101
|
+
return e ? typeof e.discrepancy == "boolean" ? e.discrepancy : We(e.candidates) : !1;
|
|
97
102
|
}
|
|
98
|
-
function
|
|
103
|
+
function We(e) {
|
|
99
104
|
if (!e) return !1;
|
|
100
|
-
const t =
|
|
105
|
+
const t = Ce.map((a) => e[a]).filter((a) => a != null).map((a) => Xe(a.value));
|
|
101
106
|
return t.length < 2 ? !1 : new Set(t).size > 1;
|
|
102
107
|
}
|
|
103
|
-
function
|
|
108
|
+
function Xe(e) {
|
|
104
109
|
return JSON.stringify(e ?? null);
|
|
105
110
|
}
|
|
106
|
-
function
|
|
107
|
-
var
|
|
108
|
-
const
|
|
109
|
-
if (!e.saveOverride || !
|
|
110
|
-
const
|
|
111
|
-
return async (
|
|
112
|
-
const b = await
|
|
111
|
+
function Ze(e, t, a) {
|
|
112
|
+
var c;
|
|
113
|
+
const g = (c = t.value) == null ? void 0 : c.anchor;
|
|
114
|
+
if (!e.saveOverride || !g) return null;
|
|
115
|
+
const d = e.saveOverride;
|
|
116
|
+
return async (m, s) => {
|
|
117
|
+
const b = await d({
|
|
113
118
|
workflow_input_id: e.workflowInputId,
|
|
114
|
-
object_ids:
|
|
115
|
-
field:
|
|
116
|
-
field_path:
|
|
117
|
-
value:
|
|
118
|
-
source_choice:
|
|
119
|
+
object_ids: g.object_ids,
|
|
120
|
+
field: g.field,
|
|
121
|
+
field_path: g.field_path,
|
|
122
|
+
value: m,
|
|
123
|
+
source_choice: s
|
|
119
124
|
});
|
|
120
|
-
return
|
|
125
|
+
return a(b), b;
|
|
121
126
|
};
|
|
122
127
|
}
|
|
123
|
-
const
|
|
128
|
+
const et = ["data-status", "title"], tt = {
|
|
124
129
|
class: "tv-confidence-glyph",
|
|
125
130
|
"aria-hidden": "true"
|
|
126
|
-
},
|
|
131
|
+
}, at = {
|
|
127
132
|
key: 0,
|
|
128
133
|
class: "tv-confidence-label"
|
|
129
|
-
},
|
|
134
|
+
}, ue = /* @__PURE__ */ K({
|
|
130
135
|
__name: "ConfidenceIcon",
|
|
131
136
|
props: {
|
|
132
137
|
confidence: {},
|
|
@@ -134,9 +139,9 @@ const Ae = ["data-status", "title"], Ne = {
|
|
|
134
139
|
showLabel: { type: Boolean }
|
|
135
140
|
},
|
|
136
141
|
setup(e) {
|
|
137
|
-
const t = e,
|
|
138
|
-
() => t.status ??
|
|
139
|
-
),
|
|
142
|
+
const t = e, a = u(
|
|
143
|
+
() => t.status ?? ve(t.confidence)
|
|
144
|
+
), g = {
|
|
140
145
|
high: "✔",
|
|
141
146
|
// check
|
|
142
147
|
medium: "⚠",
|
|
@@ -144,68 +149,186 @@ const Ae = ["data-status", "title"], Ne = {
|
|
|
144
149
|
low: "✕",
|
|
145
150
|
// x
|
|
146
151
|
unverifiable: "?"
|
|
147
|
-
},
|
|
148
|
-
return (
|
|
149
|
-
class:
|
|
150
|
-
"data-status":
|
|
151
|
-
title:
|
|
152
|
+
}, d = u(() => g[a.value]), c = u(() => Ge[a.value]), m = u(() => ae[a.value]);
|
|
153
|
+
return (s, b) => (l(), i("span", {
|
|
154
|
+
class: A(["tv-confidence-icon inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-semibold leading-none", c.value]),
|
|
155
|
+
"data-status": a.value,
|
|
156
|
+
title: m.value
|
|
152
157
|
}, [
|
|
153
|
-
|
|
154
|
-
e.showLabel ? (l(), i("span",
|
|
155
|
-
], 10,
|
|
158
|
+
n("span", tt, y(d.value), 1),
|
|
159
|
+
e.showLabel ? (l(), i("span", at, y(m.value), 1)) : _("", !0)
|
|
160
|
+
], 10, et));
|
|
156
161
|
}
|
|
157
162
|
});
|
|
158
|
-
function
|
|
163
|
+
async function lt(e, t) {
|
|
164
|
+
const a = t.object_ids.at(-1), g = new URLSearchParams({
|
|
165
|
+
object_id: String(a),
|
|
166
|
+
field: t.field
|
|
167
|
+
}), d = e.includes("?") ? "&" : "?", c = await fetch(`${e}${d}${g}`);
|
|
168
|
+
if (!c.ok)
|
|
169
|
+
throw new Error(
|
|
170
|
+
`data-point-audit ${c.status}: ${await c.text()}`
|
|
171
|
+
);
|
|
172
|
+
return (await c.json()).data ?? [];
|
|
173
|
+
}
|
|
174
|
+
function De(e) {
|
|
159
175
|
if (!e || e.length === 0) return [];
|
|
160
176
|
const t = /* @__PURE__ */ new Map();
|
|
161
|
-
for (const
|
|
162
|
-
const
|
|
163
|
-
let
|
|
164
|
-
|
|
165
|
-
fileLabel:
|
|
166
|
-
fileUrl:
|
|
167
|
-
file:
|
|
177
|
+
for (const a of e) {
|
|
178
|
+
const g = nt(a);
|
|
179
|
+
let d = t.get(g);
|
|
180
|
+
d || (d = {
|
|
181
|
+
fileLabel: st(a),
|
|
182
|
+
fileUrl: a.file_url,
|
|
183
|
+
file: a.file,
|
|
168
184
|
sources: []
|
|
169
|
-
}, t.set(
|
|
185
|
+
}, t.set(g, d)), !d.fileUrl && a.file_url && (d.fileUrl = a.file_url), !d.file && a.file && (d.file = a.file), d.sources.push(a);
|
|
170
186
|
}
|
|
171
187
|
return [...t.values()];
|
|
172
188
|
}
|
|
173
|
-
function
|
|
189
|
+
function nt(e) {
|
|
174
190
|
const t = e.file_name ?? e.file_id ?? e.stored_file_id ?? e.source_id ?? e.id;
|
|
175
191
|
return t != null ? String(t) : "__unknown__";
|
|
176
192
|
}
|
|
177
|
-
function
|
|
193
|
+
function st(e) {
|
|
178
194
|
var t;
|
|
179
195
|
return (t = e.file) != null && t.name ? e.file.name : e.file_name ? e.file_name : e.file_id !== void 0 && e.file_id !== null ? `File ${e.file_id}` : e.stored_file_id !== void 0 && e.stored_file_id !== null ? `File ${e.stored_file_id}` : e.source_type ? e.source_type : "Source";
|
|
180
196
|
}
|
|
181
|
-
function
|
|
197
|
+
function rt(e) {
|
|
182
198
|
return e.page !== void 0 && e.page !== null ? `Page ${e.page}` : e.explanation ? String(e.explanation) : e.source_type ? String(e.source_type) : "Citation";
|
|
183
199
|
}
|
|
184
|
-
const
|
|
185
|
-
key:
|
|
186
|
-
class: "
|
|
187
|
-
},
|
|
200
|
+
const it = { class: "tv-audit-call rounded-lg border border-gray-200 shadow-sm" }, ot = { class: "tv-audit-call-header flex flex-wrap items-center gap-2 border-b border-gray-100 bg-gray-50 px-3 py-2" }, ut = {
|
|
201
|
+
key: 2,
|
|
202
|
+
class: "font-mono text-[11px] text-gray-400"
|
|
203
|
+
}, dt = {
|
|
204
|
+
key: 3,
|
|
205
|
+
class: "text-[11px] font-medium text-gray-500"
|
|
206
|
+
}, ct = {
|
|
207
|
+
key: 4,
|
|
208
|
+
class: "text-[11px] text-gray-400"
|
|
209
|
+
}, vt = { class: "tv-audit-call-body flex flex-col gap-2 p-3" }, ft = /* @__PURE__ */ K({
|
|
210
|
+
__name: "AuditCallCard",
|
|
211
|
+
props: {
|
|
212
|
+
call: {}
|
|
213
|
+
},
|
|
214
|
+
setup(e) {
|
|
215
|
+
const t = e, a = u(() => {
|
|
216
|
+
const s = t.call.status_code;
|
|
217
|
+
return s == null ? "muted" : s >= 200 && s < 300 ? "success" : s >= 400 ? "danger" : "warning";
|
|
218
|
+
}), g = u(() => {
|
|
219
|
+
const s = t.call.run_time_ms;
|
|
220
|
+
return s == null ? null : s >= 1e3 ? `${(s / 1e3).toFixed(1)}s` : `${s}ms`;
|
|
221
|
+
}), d = u(() => {
|
|
222
|
+
if (!t.call.started_at) return null;
|
|
223
|
+
const s = new Date(t.call.started_at);
|
|
224
|
+
return Number.isNaN(s.getTime()) ? t.call.started_at : s.toLocaleString();
|
|
225
|
+
}), c = u(
|
|
226
|
+
() => JSON.stringify(t.call.request ?? null, null, 2)
|
|
227
|
+
), m = u(
|
|
228
|
+
() => JSON.stringify(t.call.response ?? null, null, 2)
|
|
229
|
+
);
|
|
230
|
+
return (s, b) => (l(), i("div", it, [
|
|
231
|
+
n("div", ot, [
|
|
232
|
+
e.call.model ? (l(), N(r(J), {
|
|
233
|
+
key: 0,
|
|
234
|
+
variant: "info",
|
|
235
|
+
size: "xs",
|
|
236
|
+
class: "tv-audit-model"
|
|
237
|
+
}, {
|
|
238
|
+
default: I(() => [
|
|
239
|
+
T(y(e.call.model), 1)
|
|
240
|
+
]),
|
|
241
|
+
_: 1
|
|
242
|
+
})) : _("", !0),
|
|
243
|
+
e.call.service ? (l(), N(r(J), {
|
|
244
|
+
key: 1,
|
|
245
|
+
variant: "muted",
|
|
246
|
+
size: "xxs"
|
|
247
|
+
}, {
|
|
248
|
+
default: I(() => [
|
|
249
|
+
T(y(e.call.service), 1)
|
|
250
|
+
]),
|
|
251
|
+
_: 1
|
|
252
|
+
})) : _("", !0),
|
|
253
|
+
e.call.endpoint ? (l(), i("span", ut, y(e.call.endpoint), 1)) : _("", !0),
|
|
254
|
+
b[0] || (b[0] = n("span", { class: "flex-1" }, null, -1)),
|
|
255
|
+
V(r(J), {
|
|
256
|
+
variant: a.value,
|
|
257
|
+
size: "xxs",
|
|
258
|
+
class: "tv-audit-status"
|
|
259
|
+
}, {
|
|
260
|
+
default: I(() => [
|
|
261
|
+
T(y(e.call.status_code ?? "…"), 1)
|
|
262
|
+
]),
|
|
263
|
+
_: 1
|
|
264
|
+
}, 8, ["variant"]),
|
|
265
|
+
g.value ? (l(), i("span", dt, y(g.value), 1)) : _("", !0),
|
|
266
|
+
d.value ? (l(), i("span", ct, y(d.value), 1)) : _("", !0)
|
|
267
|
+
]),
|
|
268
|
+
n("div", vt, [
|
|
269
|
+
n("div", null, [
|
|
270
|
+
b[1] || (b[1] = n("div", { class: "mb-1 text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Request ", -1)),
|
|
271
|
+
V(r(xe), {
|
|
272
|
+
"model-value": c.value,
|
|
273
|
+
format: "json",
|
|
274
|
+
collapsible: "",
|
|
275
|
+
"default-collapsed": "",
|
|
276
|
+
class: "tv-audit-request"
|
|
277
|
+
}, null, 8, ["model-value"])
|
|
278
|
+
]),
|
|
279
|
+
n("div", null, [
|
|
280
|
+
b[2] || (b[2] = n("div", { class: "mb-1 text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Response ", -1)),
|
|
281
|
+
V(r(xe), {
|
|
282
|
+
"model-value": m.value,
|
|
283
|
+
format: "json",
|
|
284
|
+
collapsible: "",
|
|
285
|
+
"default-collapsed": "",
|
|
286
|
+
class: "tv-audit-response"
|
|
287
|
+
}, null, 8, ["model-value"])
|
|
288
|
+
])
|
|
289
|
+
])
|
|
290
|
+
]));
|
|
291
|
+
}
|
|
292
|
+
}), pt = { class: "tv-modal flex h-full flex-col gap-4 overflow-y-auto p-1" }, mt = { class: "tv-modal-resolved flex flex-col gap-3 rounded-xl border border-gray-200 bg-gradient-to-br from-gray-50 to-white p-4 shadow-sm" }, gt = { class: "flex flex-wrap items-start justify-between gap-4" }, xt = { class: "min-w-0 flex-1" }, yt = { class: "tv-resolved-value mt-1 break-words font-mono text-xl font-semibold leading-snug text-gray-900" }, bt = { class: "mt-1 text-[11px] text-gray-400" }, ht = { class: "tv-resolved-source font-medium text-gray-500" }, _t = { class: "tv-confidence-meter w-56 shrink-0" }, wt = { class: "mt-2" }, kt = {
|
|
293
|
+
key: 1,
|
|
294
|
+
class: "tv-confidence-value text-sm text-gray-400"
|
|
295
|
+
}, $t = {
|
|
188
296
|
key: 0,
|
|
189
|
-
class: "tv-
|
|
190
|
-
},
|
|
297
|
+
class: "tv-tab-evidence flex min-h-0 flex-1 flex-col gap-4"
|
|
298
|
+
}, St = {
|
|
191
299
|
key: 0,
|
|
192
|
-
class: "tv-
|
|
193
|
-
},
|
|
300
|
+
class: "tv-reasoning-card rounded-lg border border-gray-200 p-3"
|
|
301
|
+
}, Ct = {
|
|
194
302
|
key: 1,
|
|
195
|
-
class: "tv-
|
|
196
|
-
},
|
|
303
|
+
class: "tv-cited-text rounded-lg border-l-4 border-blue-200 bg-blue-50/50 px-4 py-3 text-sm italic leading-relaxed text-gray-700"
|
|
304
|
+
}, Vt = {
|
|
197
305
|
key: 2,
|
|
198
|
-
class: "tv-
|
|
199
|
-
},
|
|
306
|
+
class: "tv-evidence-viewer flex min-h-[24rem] flex-1 flex-col overflow-hidden rounded-lg border border-gray-200"
|
|
307
|
+
}, Dt = {
|
|
308
|
+
key: 0,
|
|
309
|
+
class: "tv-page-context border-t border-gray-100 bg-gray-50 px-3 py-2 text-xs text-gray-500"
|
|
310
|
+
}, Ot = {
|
|
200
311
|
key: 3,
|
|
201
|
-
class: "tv-source
|
|
202
|
-
},
|
|
312
|
+
class: "tv-no-source rounded-lg border border-dashed border-gray-200 p-6 text-center text-sm text-gray-400"
|
|
313
|
+
}, It = {
|
|
314
|
+
key: 4,
|
|
315
|
+
class: "tv-full-documents flex flex-wrap items-center gap-2"
|
|
316
|
+
}, Tt = {
|
|
317
|
+
key: 1,
|
|
318
|
+
class: "tv-tab-candidates flex flex-col gap-3"
|
|
319
|
+
}, Ut = { class: "flex flex-wrap items-center justify-between gap-3" }, Nt = { class: "min-w-0 flex-1" }, At = { class: "flex items-center gap-2" }, Rt = { class: "mt-2 break-words font-mono text-base text-gray-900" }, Lt = { class: "mt-1 text-xs text-gray-400" }, jt = {
|
|
203
320
|
key: 0,
|
|
204
|
-
class: "tv-
|
|
205
|
-
},
|
|
321
|
+
class: "tv-custom-entry flex items-center gap-2 rounded-lg border border-dashed border-gray-300 p-4"
|
|
322
|
+
}, Et = {
|
|
206
323
|
key: 1,
|
|
207
|
-
class: "tv-
|
|
208
|
-
},
|
|
324
|
+
class: "tv-read-only text-center text-xs text-gray-400"
|
|
325
|
+
}, zt = {
|
|
326
|
+
key: 2,
|
|
327
|
+
class: "tv-tab-audit flex flex-col gap-3"
|
|
328
|
+
}, Pt = {
|
|
329
|
+
key: 2,
|
|
330
|
+
class: "tv-audit-empty rounded-lg border border-dashed border-gray-200 p-6 text-center text-sm text-gray-400"
|
|
331
|
+
}, Mt = /* @__PURE__ */ K({
|
|
209
332
|
__name: "VerificationModal",
|
|
210
333
|
props: {
|
|
211
334
|
modelValue: { type: Boolean },
|
|
@@ -215,255 +338,391 @@ const Pe = { class: "tv-modal flex flex-col gap-5 p-4 text-sm text-gray-700" },
|
|
|
215
338
|
},
|
|
216
339
|
emits: ["update:modelValue", "saved"],
|
|
217
340
|
setup(e, { emit: t }) {
|
|
218
|
-
const
|
|
219
|
-
get: () =>
|
|
220
|
-
set: (
|
|
221
|
-
}),
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
341
|
+
const a = e, g = t, d = le(), c = _e(), m = u({
|
|
342
|
+
get: () => a.modelValue,
|
|
343
|
+
set: (f) => g("update:modelValue", f)
|
|
344
|
+
}), s = u(() => fe(a.meta)), b = u(() => a.meta.candidates.extracted), $ = u(() => a.meta.candidates.claim), h = u(() => a.meta.candidates.override), x = u(() => {
|
|
345
|
+
var f;
|
|
346
|
+
return ((f = b.value) == null ? void 0 : f.confidence) ?? null;
|
|
347
|
+
}), k = u(() => ve(x.value)), S = u(() => ie(a.meta)), R = u(() => oe(a.meta)), O = u(() => {
|
|
348
|
+
var f;
|
|
349
|
+
return De((f = b.value) == null ? void 0 : f.sources);
|
|
350
|
+
}), j = u(() => (a.meta.anchor.field_path || a.label || "Data point").split(".").map(
|
|
351
|
+
(o) => o.replace(/\[\d+\]/g, "").replace(/_/g, " ").replace(/^\w/, (C) => C.toUpperCase())
|
|
352
|
+
).join(" › ")), H = {
|
|
353
|
+
high: "success",
|
|
354
|
+
medium: "warning",
|
|
355
|
+
low: "danger",
|
|
356
|
+
unverifiable: "muted"
|
|
357
|
+
}, E = U("evidence"), W = u(() => !!d.auditUrl), X = u(() => {
|
|
358
|
+
var o;
|
|
359
|
+
const f = [
|
|
360
|
+
{
|
|
361
|
+
value: "evidence",
|
|
362
|
+
label: "Evidence",
|
|
363
|
+
count: O.value.reduce((C, v) => C + v.sources.length, 0)
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
value: "candidates",
|
|
367
|
+
label: "Candidates",
|
|
368
|
+
count: Q.value.length
|
|
369
|
+
}
|
|
370
|
+
];
|
|
371
|
+
return W.value && f.push({
|
|
372
|
+
value: "audit",
|
|
373
|
+
label: "Audit trail",
|
|
374
|
+
count: ((o = F.value) == null ? void 0 : o.length) ?? void 0
|
|
375
|
+
}), f;
|
|
376
|
+
}), q = u(
|
|
377
|
+
() => O.value.map((f) => f.file).filter((f) => !!f)
|
|
378
|
+
), p = U(null), w = u(() => {
|
|
379
|
+
const f = p.value ?? q.value[0];
|
|
380
|
+
if (!f) return null;
|
|
381
|
+
const o = O.value.find(
|
|
382
|
+
(v) => v.file && String(v.file.id) === String(f.id)
|
|
383
|
+
);
|
|
384
|
+
if (!o) return null;
|
|
385
|
+
const C = o.sources.find((v) => v.explanation);
|
|
386
|
+
return (C == null ? void 0 : C.explanation) ?? null;
|
|
387
|
+
}), D = u(() => {
|
|
388
|
+
const f = /* @__PURE__ */ new Map();
|
|
389
|
+
for (const o of O.value)
|
|
390
|
+
for (const C of o.sources) {
|
|
391
|
+
const v = C.original_file;
|
|
392
|
+
v && !f.has(String(v.id)) && f.set(String(v.id), v);
|
|
393
|
+
}
|
|
394
|
+
return [...f.values()];
|
|
395
|
+
}), z = U(null), G = u({
|
|
396
|
+
get: () => z.value !== null,
|
|
397
|
+
set: (f) => {
|
|
398
|
+
f || (z.value = null);
|
|
235
399
|
}
|
|
236
|
-
})
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
400
|
+
}), Q = u(() => {
|
|
401
|
+
const f = [];
|
|
402
|
+
return h.value && f.push({
|
|
403
|
+
key: "override",
|
|
404
|
+
title: "Human override",
|
|
405
|
+
variant: "success",
|
|
406
|
+
value: h.value.value,
|
|
407
|
+
detail: [
|
|
408
|
+
h.value.source_choice ? `basis: ${h.value.source_choice}` : null,
|
|
409
|
+
h.value.set_at ? new Date(h.value.set_at).toLocaleString() : null
|
|
410
|
+
].filter(Boolean).join(" · "),
|
|
411
|
+
winner: s.value.source === "override"
|
|
412
|
+
}), b.value && f.push({
|
|
413
|
+
key: "extracted",
|
|
414
|
+
title: "Extracted",
|
|
415
|
+
variant: H[k.value],
|
|
244
416
|
value: b.value.value,
|
|
245
|
-
detail:
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
417
|
+
detail: x.value != null ? `Confidence ${x.value}/5 · ${ae[k.value]}` : "No confidence recorded",
|
|
418
|
+
accept: a.save ? () => {
|
|
419
|
+
var o;
|
|
420
|
+
return ne(pe((o = b.value) == null ? void 0 : o.value), "extracted");
|
|
421
|
+
} : void 0,
|
|
422
|
+
winner: s.value.source === "extracted"
|
|
423
|
+
}), $.value && f.push({
|
|
424
|
+
key: "claim",
|
|
425
|
+
title: "Claim",
|
|
426
|
+
variant: "info",
|
|
427
|
+
value: $.value.value,
|
|
428
|
+
detail: $.value.claim_set_label ?? "Reference output",
|
|
429
|
+
accept: a.save ? () => {
|
|
430
|
+
var o;
|
|
431
|
+
return ne(pe((o = $.value) == null ? void 0 : o.value), "claim");
|
|
432
|
+
} : void 0,
|
|
433
|
+
winner: s.value.source === "claim"
|
|
434
|
+
}), f;
|
|
435
|
+
}), B = U(""), Y = U(!1);
|
|
436
|
+
async function ne(f, o) {
|
|
437
|
+
if (!(!a.save || Y.value)) {
|
|
438
|
+
Y.value = !0;
|
|
265
439
|
try {
|
|
266
|
-
const
|
|
267
|
-
|
|
440
|
+
const C = await a.save(f, o);
|
|
441
|
+
g("saved", C), c.success(`Verified — ${j.value} locked in`);
|
|
442
|
+
} catch {
|
|
443
|
+
c.danger(`Could not save ${j.value} — try again`);
|
|
268
444
|
} finally {
|
|
269
|
-
|
|
445
|
+
Y.value = !1;
|
|
270
446
|
}
|
|
271
447
|
}
|
|
272
448
|
}
|
|
273
|
-
const
|
|
274
|
-
|
|
275
|
-
return
|
|
276
|
-
}, fe = () => {
|
|
277
|
-
var s;
|
|
278
|
-
return K(Z((s = g.value) == null ? void 0 : s.value), "claim");
|
|
279
|
-
}, ve = () => K(M.value, "custom");
|
|
280
|
-
function Z(s) {
|
|
281
|
-
return s == null ? null : String(s);
|
|
449
|
+
const Ie = () => ne(B.value, "custom");
|
|
450
|
+
function pe(f) {
|
|
451
|
+
return f == null ? null : String(f);
|
|
282
452
|
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
453
|
+
function me(f) {
|
|
454
|
+
return f == null ? "—" : String(f);
|
|
455
|
+
}
|
|
456
|
+
const F = U(null), Z = U(!1), ee = U(null);
|
|
457
|
+
return ce(
|
|
458
|
+
[E, m],
|
|
459
|
+
async ([f, o]) => {
|
|
460
|
+
if (!(f !== "audit" || !o || F.value !== null || Z.value) && d.auditUrl) {
|
|
461
|
+
Z.value = !0, ee.value = null;
|
|
462
|
+
try {
|
|
463
|
+
F.value = await lt(
|
|
464
|
+
d.auditUrl,
|
|
465
|
+
a.meta.anchor
|
|
466
|
+
);
|
|
467
|
+
} catch (C) {
|
|
468
|
+
ee.value = C instanceof Error ? C.message : String(C);
|
|
469
|
+
} finally {
|
|
470
|
+
Z.value = !1;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
},
|
|
474
|
+
{ immediate: !0 }
|
|
475
|
+
), (f, o) => (l(), i(L, null, [
|
|
476
|
+
V(r(re), {
|
|
477
|
+
modelValue: m.value,
|
|
478
|
+
"onUpdate:modelValue": o[3] || (o[3] = (C) => m.value = C),
|
|
479
|
+
title: j.value,
|
|
480
|
+
width: 90,
|
|
481
|
+
height: 90,
|
|
288
482
|
"close-x": "",
|
|
289
|
-
class:
|
|
483
|
+
class: A(r(P))
|
|
290
484
|
}, {
|
|
291
|
-
default:
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
u[3] || (u[3] = E(" source: ", -1)),
|
|
304
|
-
a("span", Ye, p(o.value.source), 1)
|
|
305
|
-
]),
|
|
306
|
-
e.meta.discrepancy ? (l(), i("div", Ge, " ⚠ Sources disagree ")) : h("", !0)
|
|
307
|
-
]),
|
|
308
|
-
a("section", He, [
|
|
309
|
-
u[5] || (u[5] = a("div", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Candidates ", -1)),
|
|
310
|
-
a("div", qe, [
|
|
311
|
-
(l(!0), i(O, null, T(B.value, (m) => (l(), i("div", {
|
|
312
|
-
key: m.source,
|
|
313
|
-
class: "tv-candidate-row flex items-center gap-3 px-3 py-2"
|
|
314
|
-
}, [
|
|
315
|
-
a("span", Je, p(m.source), 1),
|
|
316
|
-
a("span", Qe, p(V(m.value)), 1),
|
|
317
|
-
a("span", We, p(m.detail), 1)
|
|
318
|
-
]))), 128))
|
|
319
|
-
])
|
|
320
|
-
]),
|
|
321
|
-
c.value ? (l(), i("section", Xe, [
|
|
322
|
-
a("div", Ze, [
|
|
323
|
-
u[6] || (u[6] = a("div", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Confidence ", -1)),
|
|
324
|
-
a("div", et, p(S(c.value.confidence)), 1)
|
|
325
|
-
]),
|
|
326
|
-
y.value ? (l(), i(O, { key: 0 }, [
|
|
327
|
-
u[7] || (u[7] = a("div", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Reasoning ", -1)),
|
|
328
|
-
a("p", tt, p(y.value), 1)
|
|
329
|
-
], 64)) : h("", !0),
|
|
330
|
-
v.value ? (l(), i(O, { key: 1 }, [
|
|
331
|
-
u[8] || (u[8] = a("div", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Cited text ", -1)),
|
|
332
|
-
a("blockquote", nt, [
|
|
333
|
-
E(p(v.value) + " ", 1),
|
|
334
|
-
a("span", {
|
|
335
|
-
class: I([
|
|
336
|
-
"tv-cited-verified ml-1 not-italic text-[11px] font-medium",
|
|
337
|
-
c.value.cited_text_verified ? "text-green-600" : "text-gray-400"
|
|
485
|
+
default: I(() => {
|
|
486
|
+
var C;
|
|
487
|
+
return [
|
|
488
|
+
n("div", pt, [
|
|
489
|
+
n("section", mt, [
|
|
490
|
+
n("div", gt, [
|
|
491
|
+
n("div", xt, [
|
|
492
|
+
o[6] || (o[6] = n("div", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Resolved value ", -1)),
|
|
493
|
+
n("div", yt, y(me(s.value.value)), 1),
|
|
494
|
+
n("div", bt, [
|
|
495
|
+
o[5] || (o[5] = T(" source of truth: ", -1)),
|
|
496
|
+
n("span", ht, y(s.value.source), 1)
|
|
338
497
|
])
|
|
339
|
-
}, p(c.value.cited_text_verified ? "✔ verified" : "unverified"), 3)
|
|
340
|
-
])
|
|
341
|
-
], 64)) : h("", !0)
|
|
342
|
-
])) : h("", !0),
|
|
343
|
-
a("section", lt, [
|
|
344
|
-
u[9] || (u[9] = a("div", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Sources ", -1)),
|
|
345
|
-
$.value.length === 0 ? (l(), i("div", at, " No source recorded ")) : (l(), i("div", st, [
|
|
346
|
-
(l(!0), i(O, null, T($.value, (m) => (l(), i("div", {
|
|
347
|
-
key: m.fileLabel,
|
|
348
|
-
class: "tv-source-group flex flex-col items-center gap-1"
|
|
349
|
-
}, [
|
|
350
|
-
a("div", it, [
|
|
351
|
-
m.file ? (l(), F(x(he), {
|
|
352
|
-
key: 0,
|
|
353
|
-
file: m.file,
|
|
354
|
-
size: "sm",
|
|
355
|
-
class: "tv-source-thumb cursor-pointer rounded-md ring-1 ring-gray-200 transition duration-150 hover:-translate-y-0.5 hover:shadow-md hover:ring-gray-300",
|
|
356
|
-
onClick: (ee) => N(m)
|
|
357
|
-
}, null, 8, ["file", "onClick"])) : m.fileUrl ? (l(), i("a", {
|
|
358
|
-
key: 1,
|
|
359
|
-
href: m.fileUrl,
|
|
360
|
-
class: "tv-source-link flex h-16 w-16 items-center justify-center rounded-md bg-gray-50 p-1 text-center text-[11px] font-medium leading-tight text-blue-600 underline ring-1 ring-gray-200",
|
|
361
|
-
target: "_blank",
|
|
362
|
-
rel: "noopener"
|
|
363
|
-
}, p(m.fileLabel), 9, rt)) : (l(), i("span", ot, p(m.fileLabel), 1)),
|
|
364
|
-
m.sources.length > 1 ? (l(), i("span", ut, "×" + p(m.sources.length), 1)) : h("", !0)
|
|
365
498
|
]),
|
|
366
|
-
|
|
367
|
-
class: "
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
499
|
+
n("div", _t, [
|
|
500
|
+
o[7] || (o[7] = n("div", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Extraction confidence ", -1)),
|
|
501
|
+
n("div", wt, [
|
|
502
|
+
x.value != null ? (l(), N(r(we), {
|
|
503
|
+
key: 0,
|
|
504
|
+
value: x.value,
|
|
505
|
+
max: 5,
|
|
506
|
+
size: "md",
|
|
507
|
+
variant: H[k.value],
|
|
508
|
+
gradient: "",
|
|
509
|
+
shimmer: "",
|
|
510
|
+
"show-text": "",
|
|
511
|
+
"text-position": "beside",
|
|
512
|
+
label: `${x.value}/5`
|
|
513
|
+
}, null, 8, ["value", "variant", "label"])) : (l(), i("div", kt, " No confidence recorded "))
|
|
514
|
+
]),
|
|
515
|
+
n("div", {
|
|
516
|
+
class: A(["tv-confidence-label mt-1 text-right text-xs font-medium", {
|
|
517
|
+
"text-green-600": k.value === "high",
|
|
518
|
+
"text-yellow-600": k.value === "medium",
|
|
519
|
+
"text-red-600": k.value === "low",
|
|
520
|
+
"text-gray-400": k.value === "unverifiable"
|
|
521
|
+
}])
|
|
522
|
+
}, y(r(ae)[k.value]), 3)
|
|
523
|
+
])
|
|
524
|
+
]),
|
|
525
|
+
e.meta.discrepancy ? (l(), N(r(ye), {
|
|
383
526
|
key: 0,
|
|
384
|
-
variant: "
|
|
385
|
-
|
|
386
|
-
class: "tv-accept-extracted",
|
|
387
|
-
disabled: _.value,
|
|
388
|
-
onClick: de
|
|
527
|
+
variant: "warning",
|
|
528
|
+
class: "tv-discrepancy"
|
|
389
529
|
}, {
|
|
390
|
-
default:
|
|
391
|
-
|
|
530
|
+
default: I(() => [...o[8] || (o[8] = [
|
|
531
|
+
T(" Sources disagree on this value — review the candidates and pick a winner. ", -1)
|
|
392
532
|
])]),
|
|
393
533
|
_: 1
|
|
394
|
-
}
|
|
395
|
-
g.value ? (l(), F(x(Y), {
|
|
396
|
-
key: 1,
|
|
397
|
-
variant: "muted",
|
|
398
|
-
size: "sm",
|
|
399
|
-
class: "tv-accept-claim",
|
|
400
|
-
disabled: _.value,
|
|
401
|
-
onClick: fe
|
|
402
|
-
}, {
|
|
403
|
-
default: j(() => [...u[11] || (u[11] = [
|
|
404
|
-
E("Accept claim", -1)
|
|
405
|
-
])]),
|
|
406
|
-
_: 1
|
|
407
|
-
}, 8, ["disabled"])) : h("", !0)
|
|
534
|
+
})) : _("", !0)
|
|
408
535
|
]),
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
536
|
+
V(r(Le), {
|
|
537
|
+
modelValue: E.value,
|
|
538
|
+
"onUpdate:modelValue": o[0] || (o[0] = (v) => E.value = v),
|
|
539
|
+
tabs: X.value,
|
|
540
|
+
class: "tv-modal-tabs"
|
|
541
|
+
}, null, 8, ["modelValue", "tabs"]),
|
|
542
|
+
E.value === "evidence" ? (l(), i("section", $t, [
|
|
543
|
+
S.value ? (l(), i("div", St, [
|
|
544
|
+
o[9] || (o[9] = n("div", { class: "mb-1 text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Reasoning ", -1)),
|
|
545
|
+
V(r(je), {
|
|
546
|
+
"model-value": S.value,
|
|
547
|
+
readonly: "",
|
|
548
|
+
class: "tv-reasoning"
|
|
549
|
+
}, null, 8, ["model-value"])
|
|
550
|
+
])) : _("", !0),
|
|
551
|
+
R.value ? (l(), i("blockquote", Ct, [
|
|
552
|
+
T(" “" + y(R.value) + "” ", 1),
|
|
553
|
+
V(r(J), {
|
|
554
|
+
variant: (C = b.value) != null && C.cited_text_verified ? "success" : "muted",
|
|
555
|
+
size: "xxs",
|
|
556
|
+
class: "tv-cited-verified ml-2 not-italic"
|
|
557
|
+
}, {
|
|
558
|
+
default: I(() => {
|
|
559
|
+
var v;
|
|
560
|
+
return [
|
|
561
|
+
T(y((v = b.value) != null && v.cited_text_verified ? "✔ verified in source" : "unverified"), 1)
|
|
562
|
+
];
|
|
563
|
+
}),
|
|
564
|
+
_: 1
|
|
565
|
+
}, 8, ["variant"])
|
|
566
|
+
])) : _("", !0),
|
|
567
|
+
q.value.length ? (l(), i("div", Vt, [
|
|
568
|
+
V(r(be), {
|
|
569
|
+
file: q.value[0],
|
|
570
|
+
"file-in-preview": p.value,
|
|
571
|
+
"onUpdate:fileInPreview": o[1] || (o[1] = (v) => p.value = v),
|
|
572
|
+
"related-files": q.value,
|
|
573
|
+
"layout-toggles": ["sidebar", "continuous"],
|
|
574
|
+
"default-sidebar": "",
|
|
575
|
+
zoomable: "",
|
|
576
|
+
"storage-key": "tv-evidence-viewer",
|
|
577
|
+
class: "h-full min-h-0 flex-1"
|
|
578
|
+
}, null, 8, ["file", "file-in-preview", "related-files"]),
|
|
579
|
+
w.value ? (l(), i("div", Dt, y(w.value), 1)) : _("", !0)
|
|
580
|
+
])) : (l(), i("div", Ot, " No source pages recorded for this data point ")),
|
|
581
|
+
D.value.length ? (l(), i("div", It, [
|
|
582
|
+
o[10] || (o[10] = n("span", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, "Full documents:", -1)),
|
|
583
|
+
(l(!0), i(L, null, M(D.value, (v) => (l(), N(r(se), {
|
|
584
|
+
key: String(v.id),
|
|
585
|
+
size: "sm",
|
|
586
|
+
variant: "info",
|
|
587
|
+
class: "tv-open-document",
|
|
588
|
+
onClick: (xa) => z.value = v
|
|
589
|
+
}, {
|
|
590
|
+
default: I(() => [
|
|
591
|
+
T(y(v.name), 1)
|
|
592
|
+
]),
|
|
593
|
+
_: 2
|
|
594
|
+
}, 1032, ["onClick"]))), 128))
|
|
595
|
+
])) : _("", !0)
|
|
596
|
+
])) : _("", !0),
|
|
597
|
+
E.value === "candidates" ? (l(), i("section", Tt, [
|
|
598
|
+
(l(!0), i(L, null, M(Q.value, (v) => (l(), i("div", {
|
|
599
|
+
key: v.key,
|
|
600
|
+
class: A(["tv-candidate-row rounded-lg border p-4 transition-shadow", [
|
|
601
|
+
v.winner ? "border-gray-300 bg-gray-50 shadow-sm" : "border-gray-200",
|
|
602
|
+
e.meta.discrepancy && !v.winner ? "tv-candidate-disagrees border-amber-200" : ""
|
|
603
|
+
]])
|
|
604
|
+
}, [
|
|
605
|
+
n("div", Ut, [
|
|
606
|
+
n("div", Nt, [
|
|
607
|
+
n("div", At, [
|
|
608
|
+
V(r(J), {
|
|
609
|
+
variant: v.variant,
|
|
610
|
+
size: "xs"
|
|
611
|
+
}, {
|
|
612
|
+
default: I(() => [
|
|
613
|
+
T(y(v.title), 1)
|
|
614
|
+
]),
|
|
615
|
+
_: 2
|
|
616
|
+
}, 1032, ["variant"]),
|
|
617
|
+
v.winner ? (l(), N(r(J), {
|
|
618
|
+
key: 0,
|
|
619
|
+
variant: "success",
|
|
620
|
+
size: "xxs",
|
|
621
|
+
class: "tv-winner-chip"
|
|
622
|
+
}, {
|
|
623
|
+
default: I(() => [...o[11] || (o[11] = [
|
|
624
|
+
T("current value", -1)
|
|
625
|
+
])]),
|
|
626
|
+
_: 1
|
|
627
|
+
})) : _("", !0)
|
|
628
|
+
]),
|
|
629
|
+
n("div", Rt, y(me(v.value)), 1),
|
|
630
|
+
n("div", Lt, y(v.detail), 1)
|
|
631
|
+
]),
|
|
632
|
+
v.accept && !v.winner ? (l(), N(r(se), {
|
|
633
|
+
key: 0,
|
|
634
|
+
size: "sm",
|
|
635
|
+
variant: v.variant,
|
|
636
|
+
loading: Y.value,
|
|
637
|
+
class: A(`tv-accept-${v.key}`),
|
|
638
|
+
onClick: v.accept
|
|
639
|
+
}, {
|
|
640
|
+
default: I(() => [...o[12] || (o[12] = [
|
|
641
|
+
T("Accept this value", -1)
|
|
642
|
+
])]),
|
|
643
|
+
_: 1
|
|
644
|
+
}, 8, ["variant", "loading", "class", "onClick"])) : _("", !0)
|
|
645
|
+
])
|
|
646
|
+
], 2))), 128)),
|
|
647
|
+
e.save ? (l(), i("div", jt, [
|
|
648
|
+
V(r(Ee), {
|
|
649
|
+
modelValue: B.value,
|
|
650
|
+
"onUpdate:modelValue": o[2] || (o[2] = (v) => B.value = v),
|
|
651
|
+
size: "sm",
|
|
652
|
+
class: "tv-custom-input flex-1",
|
|
653
|
+
placeholder: "Type the correct value…",
|
|
654
|
+
disabled: Y.value
|
|
655
|
+
}, null, 8, ["modelValue", "disabled"]),
|
|
656
|
+
V(r(se), {
|
|
657
|
+
variant: "success",
|
|
658
|
+
size: "sm",
|
|
659
|
+
class: "tv-accept-custom",
|
|
660
|
+
loading: Y.value,
|
|
661
|
+
disabled: !B.value,
|
|
662
|
+
onClick: Ie
|
|
663
|
+
}, {
|
|
664
|
+
default: I(() => [...o[13] || (o[13] = [
|
|
665
|
+
T("Save custom value", -1)
|
|
666
|
+
])]),
|
|
667
|
+
_: 1
|
|
668
|
+
}, 8, ["loading", "disabled"])
|
|
669
|
+
])) : (l(), i("div", Et, " Read-only render — corrections are disabled here "))
|
|
670
|
+
])) : _("", !0),
|
|
671
|
+
E.value === "audit" ? (l(), i("section", zt, [
|
|
672
|
+
Z.value ? (l(), i(L, { key: 0 }, M(2, (v) => V(r(ze), {
|
|
673
|
+
key: v,
|
|
674
|
+
shape: "rounded",
|
|
675
|
+
class: "tv-audit-skeleton h-24 w-full"
|
|
676
|
+
})), 64)) : ee.value ? (l(), N(r(ye), {
|
|
677
|
+
key: 1,
|
|
678
|
+
variant: "danger",
|
|
679
|
+
class: "tv-audit-error"
|
|
424
680
|
}, {
|
|
425
|
-
default:
|
|
426
|
-
|
|
427
|
-
])
|
|
681
|
+
default: I(() => [
|
|
682
|
+
T(" Could not load the audit trail: " + y(ee.value), 1)
|
|
683
|
+
]),
|
|
428
684
|
_: 1
|
|
429
|
-
},
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
685
|
+
})) : F.value && F.value.length === 0 ? (l(), i("div", Pt, " No LLM calls recorded for this data point ")) : F.value ? (l(!0), i(L, { key: 3 }, M(F.value, (v) => (l(), N(ft, {
|
|
686
|
+
key: String(v.id),
|
|
687
|
+
call: v
|
|
688
|
+
}, null, 8, ["call"]))), 128)) : _("", !0)
|
|
689
|
+
])) : _("", !0)
|
|
690
|
+
])
|
|
691
|
+
];
|
|
692
|
+
}),
|
|
434
693
|
_: 1
|
|
435
694
|
}, 8, ["modelValue", "title", "class"]),
|
|
436
|
-
|
|
695
|
+
z.value ? (l(), N(r(re), {
|
|
437
696
|
key: 0,
|
|
438
|
-
modelValue:
|
|
439
|
-
"onUpdate:modelValue":
|
|
697
|
+
modelValue: G.value,
|
|
698
|
+
"onUpdate:modelValue": o[4] || (o[4] = (C) => G.value = C),
|
|
699
|
+
title: z.value.name,
|
|
440
700
|
width: 90,
|
|
441
701
|
height: 90,
|
|
442
702
|
"close-x": "",
|
|
443
|
-
class:
|
|
703
|
+
class: A(r(P))
|
|
444
704
|
}, {
|
|
445
|
-
default:
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
"related-files": L.value,
|
|
450
|
-
"children-label": "Pages",
|
|
451
|
-
continuous: "",
|
|
452
|
-
sidebar: "",
|
|
705
|
+
default: I(() => [
|
|
706
|
+
V(r(be), {
|
|
707
|
+
file: z.value,
|
|
708
|
+
downloadable: "",
|
|
453
709
|
zoomable: "",
|
|
454
|
-
class: "h-full"
|
|
455
|
-
}, null, 8, ["file"
|
|
710
|
+
class: "tv-document-viewer h-full"
|
|
711
|
+
}, null, 8, ["file"])
|
|
456
712
|
]),
|
|
457
713
|
_: 1
|
|
458
|
-
}, 8, ["modelValue", "class"])) :
|
|
714
|
+
}, 8, ["modelValue", "title", "class"])) : _("", !0)
|
|
459
715
|
], 64));
|
|
460
716
|
}
|
|
461
|
-
}),
|
|
462
|
-
key:
|
|
463
|
-
class: "tv-
|
|
464
|
-
|
|
717
|
+
}), Bt = { class: "tv-field inline-flex items-baseline gap-1" }, Ft = ["contenteditable", "data-editable"], qt = {
|
|
718
|
+
key: 1,
|
|
719
|
+
class: "tv-verified-chip inline-flex items-center gap-1 rounded-full bg-green-600 px-2 py-0.5 text-[11px] font-semibold leading-none text-white",
|
|
720
|
+
"data-status": "verified"
|
|
721
|
+
}, Yt = {
|
|
722
|
+
key: 2,
|
|
723
|
+
class: "tv-discrepancy-indicator ml-0.5 text-amber-500",
|
|
465
724
|
"aria-label": "discrepancy"
|
|
466
|
-
},
|
|
725
|
+
}, _a = /* @__PURE__ */ K({
|
|
467
726
|
__name: "VerifiedField",
|
|
468
727
|
props: {
|
|
469
728
|
source: {},
|
|
@@ -472,278 +731,394 @@ const Pe = { class: "tv-modal flex flex-col gap-5 p-4 text-sm text-gray-700" },
|
|
|
472
731
|
format: { type: Function }
|
|
473
732
|
},
|
|
474
733
|
setup(e) {
|
|
475
|
-
const t = e,
|
|
476
|
-
var
|
|
477
|
-
return
|
|
478
|
-
}),
|
|
479
|
-
if (t.original !== void 0 && t.original !== null)
|
|
480
|
-
|
|
734
|
+
const t = e, a = le(), g = u(() => a.enabled.value), d = U(null), c = u(() => {
|
|
735
|
+
var p;
|
|
736
|
+
return d.value ? d.value : t.source && t.field ? ((p = t.source.__meta) == null ? void 0 : p[t.field]) ?? null : null;
|
|
737
|
+
}), m = u(() => fe(c.value)), s = u(() => {
|
|
738
|
+
if (t.original !== void 0 && t.original !== null)
|
|
739
|
+
return t.original;
|
|
740
|
+
if (c.value && m.value.value !== null && m.value.value !== void 0)
|
|
741
|
+
return m.value.value;
|
|
481
742
|
if (t.source && t.field) return t.source[t.field];
|
|
482
|
-
}), b =
|
|
483
|
-
const
|
|
484
|
-
return
|
|
485
|
-
}),
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
743
|
+
}), b = u(() => {
|
|
744
|
+
const p = s.value;
|
|
745
|
+
return p == null ? "" : t.format ? t.format(p) : String(p);
|
|
746
|
+
}), $ = u(
|
|
747
|
+
() => {
|
|
748
|
+
var p, w, D;
|
|
749
|
+
return ve((D = (w = (p = c.value) == null ? void 0 : p.candidates) == null ? void 0 : w.extracted) == null ? void 0 : D.confidence);
|
|
750
|
+
}
|
|
751
|
+
), h = u(() => Ve(c.value)), x = u(() => {
|
|
752
|
+
var p, w;
|
|
753
|
+
return !!((w = (p = c.value) == null ? void 0 : p.candidates) != null && w.override);
|
|
754
|
+
}), k = u(() => {
|
|
755
|
+
var w;
|
|
756
|
+
const p = (w = c.value) == null ? void 0 : w.candidates;
|
|
757
|
+
return !!(p != null && p.override || p != null && p.extracted || p != null && p.claim);
|
|
758
|
+
}), S = u(() => g.value && !!c.value), R = u(() => {
|
|
759
|
+
var G, Q, B;
|
|
760
|
+
const p = (Q = (G = c.value) == null ? void 0 : G.candidates) == null ? void 0 : Q.extracted;
|
|
761
|
+
if (!p) return "No verification data";
|
|
762
|
+
const w = [], D = ae[$.value];
|
|
763
|
+
w.push(
|
|
764
|
+
p.confidence != null ? `${D} (${p.confidence}/5)` : D
|
|
765
|
+
);
|
|
766
|
+
const z = ((B = p.sources) == null ? void 0 : B.length) ?? 0;
|
|
767
|
+
return z > 0 && w.push(`${z} source ${z === 1 ? "page" : "pages"}`), h.value && w.push("sources disagree"), w.join(" · ");
|
|
768
|
+
});
|
|
769
|
+
function O(p) {
|
|
770
|
+
var w;
|
|
771
|
+
d.value = p, (w = t.source) != null && w.__meta && t.field && (t.source.__meta[t.field] = p);
|
|
492
772
|
}
|
|
493
|
-
const
|
|
494
|
-
function
|
|
495
|
-
|
|
773
|
+
const j = u(() => Ze(a, c, O)), H = u(() => !!j.value), E = U(!1), W = U(!1);
|
|
774
|
+
function X() {
|
|
775
|
+
c.value && (E.value = !0);
|
|
496
776
|
}
|
|
497
|
-
async function
|
|
498
|
-
|
|
499
|
-
const
|
|
500
|
-
!
|
|
777
|
+
async function q(p) {
|
|
778
|
+
W.value = !1;
|
|
779
|
+
const D = (p.target.textContent ?? "").trim();
|
|
780
|
+
!j.value || D === b.value || await j.value(D, "custom");
|
|
501
781
|
}
|
|
502
|
-
return (
|
|
503
|
-
|
|
504
|
-
class:
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
782
|
+
return (p, w) => (l(), i("span", Bt, [
|
|
783
|
+
n("span", {
|
|
784
|
+
class: A([
|
|
785
|
+
"tv-field-value",
|
|
786
|
+
S.value && !k.value ? "tv-field-unverified cursor-pointer border-b border-dotted border-gray-300" : ""
|
|
787
|
+
]),
|
|
788
|
+
contenteditable: H.value,
|
|
789
|
+
"data-editable": H.value ? "true" : "false",
|
|
790
|
+
onFocus: w[0] || (w[0] = (D) => W.value = !0),
|
|
791
|
+
onBlur: q,
|
|
792
|
+
onKeydown: w[1] || (w[1] = Te(Ue((D) => D.target.blur(), ["prevent"]), ["enter"])),
|
|
793
|
+
onClick: w[2] || (w[2] = (D) => S.value && !k.value ? X() : void 0)
|
|
510
794
|
}, [
|
|
511
|
-
|
|
512
|
-
value:
|
|
795
|
+
Ne(p.$slots, "default", {
|
|
796
|
+
value: s.value,
|
|
513
797
|
formatted: b.value
|
|
514
798
|
}, () => [
|
|
515
|
-
|
|
799
|
+
T(y(b.value), 1)
|
|
516
800
|
])
|
|
517
|
-
],
|
|
518
|
-
|
|
801
|
+
], 42, Ft),
|
|
802
|
+
S.value && k.value ? (l(), N(r(Pe), {
|
|
519
803
|
key: 0,
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
804
|
+
tooltip: R.value,
|
|
805
|
+
placement: "top"
|
|
806
|
+
}, {
|
|
807
|
+
trigger: I(() => [
|
|
808
|
+
n("button", {
|
|
809
|
+
type: "button",
|
|
810
|
+
class: A(["tv-overlay inline-flex cursor-pointer items-center align-middle transition-transform duration-150 hover:scale-110", r(P)]),
|
|
811
|
+
onClick: X
|
|
812
|
+
}, [
|
|
813
|
+
x.value ? (l(), i("span", qt, "✔")) : (l(), N(ue, {
|
|
814
|
+
key: 0,
|
|
815
|
+
status: $.value
|
|
816
|
+
}, null, 8, ["status"])),
|
|
817
|
+
h.value && !x.value ? (l(), i("span", Yt, "⚠")) : _("", !0)
|
|
818
|
+
], 2)
|
|
819
|
+
]),
|
|
820
|
+
_: 1
|
|
821
|
+
}, 8, ["tooltip"])) : _("", !0),
|
|
822
|
+
c.value ? (l(), N(Mt, {
|
|
529
823
|
key: 1,
|
|
530
|
-
modelValue:
|
|
531
|
-
"onUpdate:modelValue":
|
|
532
|
-
meta:
|
|
824
|
+
modelValue: E.value,
|
|
825
|
+
"onUpdate:modelValue": w[3] || (w[3] = (D) => E.value = D),
|
|
826
|
+
meta: c.value,
|
|
533
827
|
label: e.field,
|
|
534
|
-
save:
|
|
535
|
-
}, null, 8, ["modelValue", "meta", "label", "save"])) :
|
|
828
|
+
save: j.value
|
|
829
|
+
}, null, 8, ["modelValue", "meta", "label", "save"])) : _("", !0)
|
|
536
830
|
]));
|
|
537
831
|
}
|
|
538
|
-
}),
|
|
539
|
-
function
|
|
540
|
-
const
|
|
541
|
-
return
|
|
832
|
+
}), Jt = /* @__PURE__ */ new Set(["name", "type"]);
|
|
833
|
+
function Oe(e, t = "") {
|
|
834
|
+
const a = [];
|
|
835
|
+
return de(e, t, a), a;
|
|
542
836
|
}
|
|
543
|
-
function
|
|
837
|
+
function de(e, t, a) {
|
|
544
838
|
if (Array.isArray(e)) {
|
|
545
|
-
e.forEach((
|
|
839
|
+
e.forEach((c, m) => de(c, `${t}[${m}]`, a));
|
|
546
840
|
return;
|
|
547
841
|
}
|
|
548
|
-
if (!
|
|
549
|
-
const
|
|
550
|
-
for (const [
|
|
551
|
-
if (
|
|
552
|
-
const
|
|
553
|
-
if (Array.isArray(
|
|
554
|
-
|
|
842
|
+
if (!he(e)) return;
|
|
843
|
+
const d = e.__meta ?? {};
|
|
844
|
+
for (const [c, m] of Object.entries(e)) {
|
|
845
|
+
if (c === "__meta") continue;
|
|
846
|
+
const s = t ? `${t}.${c}` : c;
|
|
847
|
+
if (Array.isArray(m) || he(m)) {
|
|
848
|
+
de(m, s, a);
|
|
555
849
|
continue;
|
|
556
850
|
}
|
|
557
|
-
const b =
|
|
558
|
-
!b &&
|
|
559
|
-
path:
|
|
560
|
-
label:
|
|
851
|
+
const b = d[c];
|
|
852
|
+
!b && Jt.has(c) || a.push({
|
|
853
|
+
path: s,
|
|
854
|
+
label: c,
|
|
561
855
|
meta: b ?? null,
|
|
562
|
-
value:
|
|
856
|
+
value: m,
|
|
563
857
|
unanchored: !b
|
|
564
858
|
});
|
|
565
859
|
}
|
|
566
860
|
}
|
|
567
|
-
function
|
|
861
|
+
function he(e) {
|
|
568
862
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
569
863
|
}
|
|
570
|
-
|
|
864
|
+
function Kt(e) {
|
|
865
|
+
var c;
|
|
866
|
+
const t = Oe(e).filter(
|
|
867
|
+
(m) => m.meta !== null
|
|
868
|
+
), a = t.length;
|
|
869
|
+
let g = 0, d = 0;
|
|
870
|
+
for (const m of t) {
|
|
871
|
+
if (m.meta.candidates.override) {
|
|
872
|
+
g++;
|
|
873
|
+
continue;
|
|
874
|
+
}
|
|
875
|
+
const s = (c = m.meta.candidates.extracted) == null ? void 0 : c.confidence;
|
|
876
|
+
(m.meta.discrepancy || s == null || s <= 2) && d++;
|
|
877
|
+
}
|
|
878
|
+
return {
|
|
879
|
+
total: a,
|
|
880
|
+
verified: g,
|
|
881
|
+
needsReview: d,
|
|
882
|
+
percent: a === 0 ? 100 : Math.round(g / a * 100)
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
const Ht = { class: "tv-comparison-page flex flex-col gap-4" }, Gt = {
|
|
571
886
|
key: 0,
|
|
572
887
|
class: "tv-comparison-empty text-gray-400"
|
|
573
|
-
},
|
|
888
|
+
}, Qt = {
|
|
574
889
|
key: 1,
|
|
575
890
|
class: "tv-anchored-group flex flex-col gap-3"
|
|
576
|
-
},
|
|
891
|
+
}, Wt = { class: "flex items-center gap-2" }, Xt = { class: "tv-datapoint-path font-mono text-xs text-gray-500" }, Zt = { class: "tv-datapoint-resolved font-medium" }, ea = {
|
|
577
892
|
key: 0,
|
|
578
893
|
class: "tv-datapoint-discrepancy text-xs font-medium text-amber-600"
|
|
579
|
-
},
|
|
894
|
+
}, ta = { class: "tv-datapoint-candidates ml-4 text-xs text-gray-600" }, aa = { class: "font-medium" }, la = {
|
|
580
895
|
key: 0,
|
|
581
896
|
class: "tv-datapoint-reasoning ml-4 text-xs italic text-gray-500"
|
|
582
|
-
},
|
|
897
|
+
}, na = {
|
|
583
898
|
key: 1,
|
|
584
899
|
class: "tv-datapoint-cited ml-4 text-xs text-gray-500"
|
|
585
|
-
},
|
|
900
|
+
}, sa = { class: "tv-datapoint-sources ml-4 text-xs text-gray-500" }, ra = ["href"], ia = { key: 1 }, oa = { class: "ml-1" }, ua = {
|
|
586
901
|
key: 2,
|
|
587
902
|
class: "tv-unanchored-group flex flex-col gap-1"
|
|
588
|
-
},
|
|
903
|
+
}, da = { class: "tv-datapoint-path font-mono text-xs text-gray-500" }, ca = { class: "tv-datapoint-value" }, va = /* @__PURE__ */ K({
|
|
589
904
|
__name: "ComparisonPage",
|
|
590
905
|
setup(e) {
|
|
591
|
-
const t =
|
|
592
|
-
function
|
|
593
|
-
const
|
|
594
|
-
return
|
|
906
|
+
const t = le(), a = u(() => Oe(t.data)), g = u(() => a.value.filter(($) => !$.unanchored)), d = u(() => a.value.filter(($) => $.unanchored));
|
|
907
|
+
function c($) {
|
|
908
|
+
const h = fe($).value;
|
|
909
|
+
return h == null ? "" : String(h);
|
|
595
910
|
}
|
|
596
|
-
function
|
|
597
|
-
return
|
|
911
|
+
function m($) {
|
|
912
|
+
return $ == null ? "" : String($);
|
|
598
913
|
}
|
|
599
|
-
function
|
|
600
|
-
var
|
|
601
|
-
return (
|
|
914
|
+
function s($) {
|
|
915
|
+
var h, x, k;
|
|
916
|
+
return (k = (x = (h = $.meta) == null ? void 0 : h.candidates) == null ? void 0 : x.extracted) == null ? void 0 : k.confidence;
|
|
602
917
|
}
|
|
603
|
-
function b(
|
|
604
|
-
var
|
|
605
|
-
const
|
|
606
|
-
if (!
|
|
607
|
-
const
|
|
608
|
-
return
|
|
918
|
+
function b($) {
|
|
919
|
+
var k;
|
|
920
|
+
const h = (k = $.meta) == null ? void 0 : k.candidates;
|
|
921
|
+
if (!h) return [];
|
|
922
|
+
const x = [];
|
|
923
|
+
return h.override && x.push({ source: "override", value: h.override.value }), h.extracted && x.push({ source: "extracted", value: h.extracted.value }), h.claim && x.push({ source: "claim", value: h.claim.value }), x;
|
|
609
924
|
}
|
|
610
|
-
return (
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
(l(!0), i(
|
|
615
|
-
var
|
|
925
|
+
return ($, h) => (l(), i("div", Ht, [
|
|
926
|
+
h[1] || (h[1] = n("h2", { class: "tv-comparison-title text-lg font-semibold" }, "Verification comparison", -1)),
|
|
927
|
+
a.value.length === 0 ? (l(), i("p", Gt, " No data points to compare. ")) : _("", !0),
|
|
928
|
+
g.value.length ? (l(), i("section", Qt, [
|
|
929
|
+
(l(!0), i(L, null, M(g.value, (x) => {
|
|
930
|
+
var k, S, R;
|
|
616
931
|
return l(), i("div", {
|
|
617
|
-
key:
|
|
932
|
+
key: x.path,
|
|
618
933
|
class: "tv-datapoint border-t border-gray-100 pt-2"
|
|
619
934
|
}, [
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
confidence:
|
|
935
|
+
n("div", Wt, [
|
|
936
|
+
n("span", Xt, y(x.path), 1),
|
|
937
|
+
n("span", Zt, y(c(x.meta)), 1),
|
|
938
|
+
V(ue, {
|
|
939
|
+
confidence: s(x),
|
|
625
940
|
"show-label": ""
|
|
626
941
|
}, null, 8, ["confidence"]),
|
|
627
|
-
|
|
942
|
+
r(Ve)(x.meta) ? (l(), i("span", ea, "⚠ discrepancy")) : _("", !0)
|
|
628
943
|
]),
|
|
629
|
-
|
|
630
|
-
(l(!0), i(
|
|
631
|
-
key:
|
|
944
|
+
n("ul", ta, [
|
|
945
|
+
(l(!0), i(L, null, M(b(x), (O) => (l(), i("li", {
|
|
946
|
+
key: O.source,
|
|
632
947
|
class: "tv-candidate"
|
|
633
948
|
}, [
|
|
634
|
-
|
|
635
|
-
|
|
949
|
+
n("span", aa, y(O.source) + ":", 1),
|
|
950
|
+
T(" " + y(m(O.value)), 1)
|
|
636
951
|
]))), 128))
|
|
637
952
|
]),
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
(l(!0), i(
|
|
642
|
-
key:
|
|
953
|
+
r(ie)(x.meta) ? (l(), i("p", la, y(r(ie)(x.meta)), 1)) : _("", !0),
|
|
954
|
+
r(oe)(x.meta) ? (l(), i("p", na, " “" + y(r(oe)(x.meta)) + "” ", 1)) : _("", !0),
|
|
955
|
+
n("ul", sa, [
|
|
956
|
+
(l(!0), i(L, null, M(r(De)((R = (S = (k = x.meta) == null ? void 0 : k.candidates) == null ? void 0 : S.extracted) == null ? void 0 : R.sources), (O, j) => (l(), i("li", {
|
|
957
|
+
key: j,
|
|
643
958
|
class: "tv-source-group"
|
|
644
959
|
}, [
|
|
645
|
-
|
|
960
|
+
O.fileUrl ? (l(), i("a", {
|
|
646
961
|
key: 0,
|
|
647
|
-
href:
|
|
962
|
+
href: O.fileUrl,
|
|
648
963
|
class: "tv-source-link text-blue-600 underline",
|
|
649
964
|
target: "_blank",
|
|
650
965
|
rel: "noopener"
|
|
651
|
-
},
|
|
652
|
-
|
|
966
|
+
}, y(O.fileLabel), 9, ra)) : (l(), i("span", ia, y(O.fileLabel), 1)),
|
|
967
|
+
n("span", oa, "(" + y(O.sources.map(r(rt)).join(", ")) + ")", 1)
|
|
653
968
|
]))), 128))
|
|
654
969
|
])
|
|
655
970
|
]);
|
|
656
971
|
}), 128))
|
|
657
|
-
])) :
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
(l(!0), i(
|
|
661
|
-
key:
|
|
972
|
+
])) : _("", !0),
|
|
973
|
+
d.value.length ? (l(), i("section", ua, [
|
|
974
|
+
h[0] || (h[0] = n("h3", { class: "tv-unanchored-title text-sm font-semibold text-gray-500" }, " Unanchored / not from source ", -1)),
|
|
975
|
+
(l(!0), i(L, null, M(d.value, (x) => (l(), i("div", {
|
|
976
|
+
key: x.path,
|
|
662
977
|
class: "tv-unanchored-datapoint flex items-center gap-2 text-sm"
|
|
663
978
|
}, [
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
979
|
+
n("span", da, y(x.path), 1),
|
|
980
|
+
n("span", ca, y(m(x.value)), 1),
|
|
981
|
+
V(ue, { status: "unverifiable" })
|
|
667
982
|
]))), 128))
|
|
668
|
-
])) :
|
|
983
|
+
])) : _("", !0)
|
|
669
984
|
]));
|
|
670
985
|
}
|
|
671
|
-
}),
|
|
986
|
+
}), fa = { class: "tv-enable-toggle flex items-center justify-between text-sm font-medium text-gray-700" }, pa = { class: "tv-progress-block" }, ma = { class: "mb-1 flex items-baseline justify-between" }, ga = { class: "tv-progress-count text-xs font-semibold text-gray-600" }, wa = /* @__PURE__ */ K({
|
|
672
987
|
__name: "VerificationChrome",
|
|
673
988
|
setup(e) {
|
|
674
|
-
const { enabled:
|
|
675
|
-
|
|
676
|
-
|
|
989
|
+
const t = le(), { enabled: a, openComparison: g } = t, d = He(), c = _e(), m = U(!1), s = u(() => Kt(t.data)), b = U(!1);
|
|
990
|
+
ce(
|
|
991
|
+
() => s.value.percent,
|
|
992
|
+
(k) => {
|
|
993
|
+
k === 100 && s.value.total > 0 && !b.value && (b.value = !0, c.success("All data points verified 🎯"));
|
|
994
|
+
}
|
|
995
|
+
);
|
|
996
|
+
let $ = 0;
|
|
997
|
+
function h() {
|
|
998
|
+
const k = document.querySelectorAll(
|
|
999
|
+
".tv-discrepancy-indicator, .tv-confidence-icon[data-status='low'], .tv-confidence-icon[data-status='unverifiable']"
|
|
1000
|
+
);
|
|
1001
|
+
if (!k.length) return;
|
|
1002
|
+
$ = $ % k.length;
|
|
1003
|
+
const S = k[$];
|
|
1004
|
+
$++, S.scrollIntoView({ behavior: "smooth", block: "center" }), S.animate(
|
|
1005
|
+
[
|
|
1006
|
+
{ boxShadow: "0 0 0 0 rgba(245, 158, 11, 0.8)" },
|
|
1007
|
+
{ boxShadow: "0 0 0 12px rgba(245, 158, 11, 0)" }
|
|
1008
|
+
],
|
|
1009
|
+
{ duration: 900, iterations: 2 }
|
|
1010
|
+
);
|
|
1011
|
+
}
|
|
1012
|
+
function x() {
|
|
1013
|
+
g(), m.value = !1;
|
|
677
1014
|
}
|
|
678
|
-
return (
|
|
679
|
-
|
|
1015
|
+
return (k, S) => (l(), i(L, null, [
|
|
1016
|
+
n("button", {
|
|
680
1017
|
type: "button",
|
|
681
|
-
class:
|
|
682
|
-
title: "Verification
|
|
683
|
-
onClick:
|
|
1018
|
+
class: A(["tv-settings-button fixed bottom-4 right-4 z-50 flex h-11 w-11 items-center justify-center rounded-full bg-gray-900 text-white shadow-lg transition-transform hover:scale-105", r(P)]),
|
|
1019
|
+
title: "Verification",
|
|
1020
|
+
onClick: S[0] || (S[0] = (R) => m.value = !m.value)
|
|
684
1021
|
}, [
|
|
685
|
-
|
|
686
|
-
icon:
|
|
1022
|
+
V(r(Me), {
|
|
1023
|
+
icon: r(Be),
|
|
687
1024
|
class: "h-5 w-5"
|
|
688
|
-
}, null, 8, ["icon"])
|
|
1025
|
+
}, null, 8, ["icon"]),
|
|
1026
|
+
r(a) && s.value.needsReview > 0 ? (l(), N(r(Fe), {
|
|
1027
|
+
key: 0,
|
|
1028
|
+
value: s.value.needsReview,
|
|
1029
|
+
variant: "warning",
|
|
1030
|
+
class: "tv-needs-review-badge absolute -right-1 -top-1"
|
|
1031
|
+
}, null, 8, ["value"])) : _("", !0)
|
|
689
1032
|
], 2),
|
|
690
|
-
|
|
1033
|
+
m.value ? (l(), i("div", {
|
|
691
1034
|
key: 0,
|
|
692
|
-
class:
|
|
1035
|
+
class: A(["tv-settings-panel fixed bottom-20 right-4 z-50 flex w-72 flex-col gap-4 rounded-xl bg-white p-4 shadow-2xl ring-1 ring-gray-200", r(P)])
|
|
693
1036
|
}, [
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
"onUpdate:modelValue":
|
|
1037
|
+
n("label", fa, [
|
|
1038
|
+
S[3] || (S[3] = n("span", null, "Verification overlay", -1)),
|
|
1039
|
+
Ae(n("input", {
|
|
1040
|
+
"onUpdate:modelValue": S[1] || (S[1] = (R) => ge(a) ? a.value = R : null),
|
|
698
1041
|
type: "checkbox",
|
|
699
|
-
class: "tv-enable-checkbox"
|
|
1042
|
+
class: "tv-enable-checkbox h-4 w-4 accent-gray-900"
|
|
700
1043
|
}, null, 512), [
|
|
701
|
-
[
|
|
1044
|
+
[Re, r(a)]
|
|
702
1045
|
])
|
|
703
1046
|
]),
|
|
704
|
-
a(
|
|
1047
|
+
r(a) && s.value.total > 0 ? (l(), i(L, { key: 0 }, [
|
|
1048
|
+
n("div", pa, [
|
|
1049
|
+
n("div", ma, [
|
|
1050
|
+
S[4] || (S[4] = n("span", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, "Review progress", -1)),
|
|
1051
|
+
n("span", ga, y(s.value.verified) + " / " + y(s.value.total), 1)
|
|
1052
|
+
]),
|
|
1053
|
+
V(r(we), {
|
|
1054
|
+
value: s.value.verified,
|
|
1055
|
+
max: s.value.total,
|
|
1056
|
+
size: "md",
|
|
1057
|
+
variant: s.value.percent === 100 ? "success" : "info",
|
|
1058
|
+
striped: s.value.percent < 100,
|
|
1059
|
+
"animate-stripes": s.value.percent < 100,
|
|
1060
|
+
glow: s.value.percent === 100,
|
|
1061
|
+
gradient: ""
|
|
1062
|
+
}, null, 8, ["value", "max", "variant", "striped", "animate-stripes", "glow"])
|
|
1063
|
+
]),
|
|
1064
|
+
s.value.needsReview > 0 ? (l(), i("button", {
|
|
1065
|
+
key: 0,
|
|
1066
|
+
type: "button",
|
|
1067
|
+
class: A(["tv-next-flagged flex items-center justify-between rounded-lg bg-amber-50 px-3 py-2 text-left text-xs font-medium text-amber-700 ring-1 ring-inset ring-amber-600/20 transition hover:bg-amber-100", r(P)]),
|
|
1068
|
+
onClick: h
|
|
1069
|
+
}, [
|
|
1070
|
+
n("span", null, y(s.value.needsReview) + " need" + y(s.value.needsReview === 1 ? "s" : "") + " review", 1),
|
|
1071
|
+
S[5] || (S[5] = n("span", { "aria-hidden": "true" }, "→", -1))
|
|
1072
|
+
], 2)) : _("", !0)
|
|
1073
|
+
], 64)) : _("", !0),
|
|
1074
|
+
n("button", {
|
|
705
1075
|
type: "button",
|
|
706
|
-
class:
|
|
707
|
-
onClick:
|
|
708
|
-
}, "Open comparison page", 2)
|
|
709
|
-
], 2)) :
|
|
710
|
-
|
|
711
|
-
modelValue:
|
|
712
|
-
"onUpdate:modelValue":
|
|
1076
|
+
class: A(["tv-open-comparison rounded-lg border border-gray-200 px-3 py-2 text-sm font-medium text-gray-600 transition hover:bg-gray-50", r(P)]),
|
|
1077
|
+
onClick: x
|
|
1078
|
+
}, " Open comparison page ", 2)
|
|
1079
|
+
], 2)) : _("", !0),
|
|
1080
|
+
V(r(re), {
|
|
1081
|
+
modelValue: r(d),
|
|
1082
|
+
"onUpdate:modelValue": S[2] || (S[2] = (R) => ge(d) ? d.value = R : null),
|
|
713
1083
|
title: "Verification comparison",
|
|
714
1084
|
width: 80,
|
|
715
1085
|
"close-x": "",
|
|
716
|
-
class:
|
|
1086
|
+
class: A(r(P))
|
|
717
1087
|
}, {
|
|
718
|
-
default:
|
|
719
|
-
|
|
1088
|
+
default: I(() => [
|
|
1089
|
+
V(va)
|
|
720
1090
|
]),
|
|
721
1091
|
_: 1
|
|
722
|
-
}, 8, ["modelValue", "class"])
|
|
1092
|
+
}, 8, ["modelValue", "class"]),
|
|
1093
|
+
V(r(qe), {
|
|
1094
|
+
class: A(r(P))
|
|
1095
|
+
}, null, 8, ["class"])
|
|
723
1096
|
], 64));
|
|
724
1097
|
}
|
|
725
1098
|
});
|
|
726
1099
|
export {
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
1100
|
+
P as CHROME_CLASS,
|
|
1101
|
+
va as ComparisonPage,
|
|
1102
|
+
ue as ConfidenceIcon,
|
|
1103
|
+
ke as ENABLED_STORAGE_KEY,
|
|
1104
|
+
Ce as RESOLUTION_PRIORITY,
|
|
1105
|
+
Ge as STATUS_COLORS,
|
|
1106
|
+
ae as STATUS_LABELS,
|
|
1107
|
+
wa as VerificationChrome,
|
|
1108
|
+
Mt as VerificationModal,
|
|
1109
|
+
_a as VerifiedField,
|
|
1110
|
+
ve as bucketConfidence,
|
|
1111
|
+
We as candidatesDisagree,
|
|
1112
|
+
oe as citedTextOf,
|
|
1113
|
+
Kt as computeProgress,
|
|
1114
|
+
lt as fetchDataPointAudit,
|
|
1115
|
+
De as groupSources,
|
|
1116
|
+
Ve as hasDiscrepancy,
|
|
1117
|
+
ha as initVerification,
|
|
1118
|
+
ie as reasoningOf,
|
|
1119
|
+
Qe as resolveCandidates,
|
|
1120
|
+
fe as resolveDataPoint,
|
|
1121
|
+
rt as sourceRowLabel,
|
|
1122
|
+
le as useVerification,
|
|
1123
|
+
Oe as walkDataPoints
|
|
749
1124
|
};
|