askback 0.1.0__py3-none-any.whl
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.
- askback/__init__.py +29 -0
- askback/__main__.py +8 -0
- askback/adapters/__init__.py +11 -0
- askback/adapters/base.py +189 -0
- askback/adapters/factory.py +176 -0
- askback/adapters/http.py +443 -0
- askback/adapters/in_process.py +135 -0
- askback/adapters/payload.py +207 -0
- askback/adapters/scripted.py +117 -0
- askback/adapters/socketio_adapter.py +885 -0
- askback/api/__init__.py +18 -0
- askback/api/corpus_store.py +85 -0
- askback/api/dashboard.py +444 -0
- askback/api/server.py +200 -0
- askback/api/state.py +82 -0
- askback/api/static/app.css +423 -0
- askback/api/static/app.js +98 -0
- askback/api/static/core.js +201 -0
- askback/api/static/index.html +175 -0
- askback/api/static/panels.js +651 -0
- askback/cli.py +618 -0
- askback/core/__init__.py +58 -0
- askback/core/config.py +224 -0
- askback/core/contracts.py +201 -0
- askback/core/errors.py +35 -0
- askback/core/logging.py +57 -0
- askback/core/registry.py +73 -0
- askback/core/text.py +151 -0
- askback/datasets/__init__.py +14 -0
- askback/datasets/loader.py +268 -0
- askback/datasets/schema.py +525 -0
- askback/demo/__init__.py +42 -0
- askback/demo/agent.py +195 -0
- askback/demo/suites/demo.yaml +100 -0
- askback/evaluation/__init__.py +70 -0
- askback/evaluation/base.py +214 -0
- askback/evaluation/calibration.py +405 -0
- askback/evaluation/citation_eval.py +580 -0
- askback/evaluation/clarification.py +477 -0
- askback/evaluation/engine.py +193 -0
- askback/evaluation/escalation_eval.py +109 -0
- askback/evaluation/gates.py +351 -0
- askback/evaluation/judge_cache.py +94 -0
- askback/evaluation/llm_judge.py +463 -0
- askback/evaluation/patterns.py +48 -0
- askback/evaluation/pii_eval.py +252 -0
- askback/evaluation/rag_eval.py +168 -0
- askback/evaluation/regression.py +438 -0
- askback/evaluation/results.py +588 -0
- askback/evaluation/rule_based.py +198 -0
- askback/evaluation/safety_eval.py +170 -0
- askback/providers/__init__.py +10 -0
- askback/providers/base.py +157 -0
- askback/providers/openai_compat.py +340 -0
- askback/py.typed +0 -0
- askback/reporting/__init__.py +77 -0
- askback/reporting/excel_report.py +117 -0
- askback/reporting/html_report.py +283 -0
- askback/reporting/json_report.py +27 -0
- askback/reporting/markdown_report.py +95 -0
- askback/reporting/redaction.py +185 -0
- askback/runner/__init__.py +5 -0
- askback/runner/responders.py +279 -0
- askback/runner/test_runner.py +424 -0
- askback-0.1.0.dist-info/METADATA +504 -0
- askback-0.1.0.dist-info/RECORD +71 -0
- askback-0.1.0.dist-info/WHEEL +5 -0
- askback-0.1.0.dist-info/entry_points.txt +2 -0
- askback-0.1.0.dist-info/licenses/LICENSE +176 -0
- askback-0.1.0.dist-info/licenses/NOTICE +15 -0
- askback-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
/* Dashboard styling.
|
|
2
|
+
*
|
|
3
|
+
* One token set, defined light-first on :root, then overridden for dark under
|
|
4
|
+
* both prefers-color-scheme and [data-theme="dark"] so the manual toggle wins
|
|
5
|
+
* in either direction. Same palette as the generated HTML evaluation report, so
|
|
6
|
+
* the tool and its output look like one product.
|
|
7
|
+
*
|
|
8
|
+
* No external fonts or stylesheets: this has to render from a container with no
|
|
9
|
+
* network access.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
:root {
|
|
13
|
+
--bg: #f4f6f8;
|
|
14
|
+
--panel: #ffffff;
|
|
15
|
+
--panel-2: #fafbfc;
|
|
16
|
+
--ink: #14181f;
|
|
17
|
+
--muted: #5b6472;
|
|
18
|
+
--faint: #8b95a3;
|
|
19
|
+
--line: #e2e6ec;
|
|
20
|
+
--line-strong: #cfd6df;
|
|
21
|
+
|
|
22
|
+
--accent: #2c5fd4;
|
|
23
|
+
--accent-soft: #e8effc;
|
|
24
|
+
--pass: #17794a;
|
|
25
|
+
--pass-bg: #e8f5ee;
|
|
26
|
+
--fail: #c02a2a;
|
|
27
|
+
--fail-bg: #fdeaea;
|
|
28
|
+
--warn: #9a6700;
|
|
29
|
+
--warn-bg: #fdf5e2;
|
|
30
|
+
|
|
31
|
+
--radius: 10px;
|
|
32
|
+
--radius-sm: 7px;
|
|
33
|
+
--mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
|
|
34
|
+
--sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
35
|
+
--shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@media (prefers-color-scheme: dark) {
|
|
39
|
+
:root:not([data-theme="light"]) {
|
|
40
|
+
--bg: #101317;
|
|
41
|
+
--panel: #181c22;
|
|
42
|
+
--panel-2: #1e232a;
|
|
43
|
+
--ink: #e8ecf2;
|
|
44
|
+
--muted: #9aa4b2;
|
|
45
|
+
--faint: #6b7684;
|
|
46
|
+
--line: #272d36;
|
|
47
|
+
--line-strong: #353d48;
|
|
48
|
+
|
|
49
|
+
--accent: #7aa2ff;
|
|
50
|
+
--accent-soft: #1b2740;
|
|
51
|
+
--pass: #4ec98a;
|
|
52
|
+
--pass-bg: #14251d;
|
|
53
|
+
--fail: #ff8080;
|
|
54
|
+
--fail-bg: #2a1a1c;
|
|
55
|
+
--warn: #e0b341;
|
|
56
|
+
--warn-bg: #2a2417;
|
|
57
|
+
--shadow: 0 1px 2px rgba(0, 0, 0, .3);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
:root[data-theme="dark"] {
|
|
62
|
+
--bg: #101317;
|
|
63
|
+
--panel: #181c22;
|
|
64
|
+
--panel-2: #1e232a;
|
|
65
|
+
--ink: #e8ecf2;
|
|
66
|
+
--muted: #9aa4b2;
|
|
67
|
+
--faint: #6b7684;
|
|
68
|
+
--line: #272d36;
|
|
69
|
+
--line-strong: #353d48;
|
|
70
|
+
|
|
71
|
+
--accent: #7aa2ff;
|
|
72
|
+
--accent-soft: #1b2740;
|
|
73
|
+
--pass: #4ec98a;
|
|
74
|
+
--pass-bg: #14251d;
|
|
75
|
+
--fail: #ff8080;
|
|
76
|
+
--fail-bg: #2a1a1c;
|
|
77
|
+
--warn: #e0b341;
|
|
78
|
+
--warn-bg: #2a2417;
|
|
79
|
+
--shadow: 0 1px 2px rgba(0, 0, 0, .3);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
* { box-sizing: border-box; }
|
|
83
|
+
|
|
84
|
+
html, body { height: 100%; }
|
|
85
|
+
|
|
86
|
+
body {
|
|
87
|
+
margin: 0;
|
|
88
|
+
background: var(--bg);
|
|
89
|
+
color: var(--ink);
|
|
90
|
+
font: 14px/1.55 var(--sans);
|
|
91
|
+
display: flex;
|
|
92
|
+
flex-direction: column;
|
|
93
|
+
overflow: hidden;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0; font-weight: 650; }
|
|
97
|
+
p { margin: 0 0 8px; }
|
|
98
|
+
code, .mono { font-family: var(--mono); font-size: 12px; }
|
|
99
|
+
.muted { color: var(--muted); }
|
|
100
|
+
.faint { color: var(--faint); }
|
|
101
|
+
|
|
102
|
+
/* ───────────────────────────────────────────────────────────────── topbar */
|
|
103
|
+
|
|
104
|
+
.topbar {
|
|
105
|
+
display: flex;
|
|
106
|
+
align-items: center;
|
|
107
|
+
gap: 20px;
|
|
108
|
+
padding: 0 16px;
|
|
109
|
+
height: 52px;
|
|
110
|
+
flex: none;
|
|
111
|
+
background: var(--panel);
|
|
112
|
+
border-bottom: 1px solid var(--line);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.brand { display: flex; align-items: baseline; gap: 7px; }
|
|
116
|
+
.brand-mark {
|
|
117
|
+
width: 10px; height: 10px; border-radius: 3px;
|
|
118
|
+
background: var(--accent); align-self: center;
|
|
119
|
+
}
|
|
120
|
+
.brand-name { font-weight: 680; letter-spacing: -.01em; }
|
|
121
|
+
.brand-sub { color: var(--faint); font-size: 12px; }
|
|
122
|
+
|
|
123
|
+
.tabs { display: flex; gap: 2px; margin-left: 8px; }
|
|
124
|
+
.tab {
|
|
125
|
+
appearance: none; border: 0; background: transparent; cursor: pointer;
|
|
126
|
+
font: inherit; font-size: 13px; font-weight: 550; color: var(--muted);
|
|
127
|
+
padding: 6px 12px; border-radius: var(--radius-sm);
|
|
128
|
+
}
|
|
129
|
+
.tab:hover { background: var(--panel-2); color: var(--ink); }
|
|
130
|
+
.tab.active { background: var(--accent-soft); color: var(--accent); }
|
|
131
|
+
|
|
132
|
+
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
|
|
133
|
+
|
|
134
|
+
.engine-chip {
|
|
135
|
+
display: flex; align-items: center; gap: 7px;
|
|
136
|
+
font-size: 12px; color: var(--muted);
|
|
137
|
+
background: var(--panel-2); border: 1px solid var(--line);
|
|
138
|
+
padding: 4px 10px; border-radius: 999px;
|
|
139
|
+
font-family: var(--mono);
|
|
140
|
+
}
|
|
141
|
+
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
|
|
142
|
+
.dot.ok { background: var(--pass); }
|
|
143
|
+
.dot.bad { background: var(--fail); }
|
|
144
|
+
|
|
145
|
+
/* ──────────────────────────────────────────────────────── buttons & inputs */
|
|
146
|
+
|
|
147
|
+
button { font: inherit; }
|
|
148
|
+
|
|
149
|
+
.primary-btn {
|
|
150
|
+
appearance: none; border: 0; cursor: pointer;
|
|
151
|
+
background: var(--accent); color: #fff;
|
|
152
|
+
font-size: 13px; font-weight: 600;
|
|
153
|
+
padding: 8px 16px; border-radius: var(--radius-sm);
|
|
154
|
+
}
|
|
155
|
+
.primary-btn:hover { filter: brightness(1.08); }
|
|
156
|
+
.primary-btn:disabled { opacity: .5; cursor: default; filter: none; }
|
|
157
|
+
|
|
158
|
+
.ghost-btn, .icon-btn {
|
|
159
|
+
appearance: none; cursor: pointer;
|
|
160
|
+
background: var(--panel); color: var(--muted);
|
|
161
|
+
border: 1px solid var(--line); border-radius: var(--radius-sm);
|
|
162
|
+
font-size: 12px; font-weight: 550; padding: 5px 10px;
|
|
163
|
+
}
|
|
164
|
+
.ghost-btn:hover, .icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }
|
|
165
|
+
.ghost-btn.danger:hover { color: var(--fail); border-color: var(--fail); }
|
|
166
|
+
|
|
167
|
+
input, select, textarea {
|
|
168
|
+
font: inherit; color: var(--ink);
|
|
169
|
+
background: var(--panel); border: 1px solid var(--line);
|
|
170
|
+
border-radius: var(--radius-sm); padding: 7px 10px;
|
|
171
|
+
}
|
|
172
|
+
input:focus, select:focus, textarea:focus {
|
|
173
|
+
outline: 2px solid var(--accent-soft); outline-offset: -1px; border-color: var(--accent);
|
|
174
|
+
}
|
|
175
|
+
textarea { resize: vertical; font-family: inherit; }
|
|
176
|
+
textarea.mono-area { font-family: var(--mono); font-size: 12px; line-height: 1.6; }
|
|
177
|
+
label { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
|
|
178
|
+
|
|
179
|
+
/* ─────────────────────────────────────────────────────────────── layout */
|
|
180
|
+
|
|
181
|
+
main { flex: 1; min-height: 0; display: flex; }
|
|
182
|
+
.panel { display: none; flex: 1; min-height: 0; }
|
|
183
|
+
.panel.active { display: flex; }
|
|
184
|
+
|
|
185
|
+
.empty-state { margin: auto; max-width: 420px; padding: 40px 24px; text-align: center; color: var(--muted); }
|
|
186
|
+
.empty-state h3 { margin-bottom: 8px; }
|
|
187
|
+
.empty-state p { font-size: 13px; line-height: 1.6; }
|
|
188
|
+
|
|
189
|
+
.rail-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 10px; }
|
|
190
|
+
.rail-foot { padding: 10px 14px; border-top: 1px solid var(--line); font-size: 11px; color: var(--faint); font-family: var(--mono); }
|
|
191
|
+
.section-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 10px; }
|
|
192
|
+
|
|
193
|
+
/* ────────────────────────────────────────────────────────── console panel */
|
|
194
|
+
|
|
195
|
+
.split { display: flex; flex: 1; min-height: 0; width: 100%; }
|
|
196
|
+
.chat-column { flex: 1 1 56%; min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
|
|
197
|
+
|
|
198
|
+
.chat-toolbar {
|
|
199
|
+
display: flex; align-items: center; gap: 14px;
|
|
200
|
+
padding: 9px 16px; border-bottom: 1px solid var(--line);
|
|
201
|
+
background: var(--panel); flex: none;
|
|
202
|
+
}
|
|
203
|
+
.chat-toolbar input, .chat-toolbar select { padding: 4px 8px; font-size: 12px; }
|
|
204
|
+
.chat-toolbar .ghost-btn { margin-left: auto; }
|
|
205
|
+
|
|
206
|
+
.chat-log { flex: 1; overflow-y: auto; padding: 20px 18px; display: flex; flex-direction: column; gap: 14px; }
|
|
207
|
+
|
|
208
|
+
.msg { max-width: 82%; display: flex; flex-direction: column; gap: 5px; }
|
|
209
|
+
.msg.user { align-self: flex-end; align-items: flex-end; }
|
|
210
|
+
.msg.bot { align-self: flex-start; }
|
|
211
|
+
|
|
212
|
+
.bubble {
|
|
213
|
+
padding: 10px 14px; border-radius: 14px;
|
|
214
|
+
white-space: pre-wrap; word-break: break-word; line-height: 1.6;
|
|
215
|
+
}
|
|
216
|
+
.msg.user .bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 5px; }
|
|
217
|
+
.msg.bot .bubble {
|
|
218
|
+
background: var(--panel); border: 1px solid var(--line);
|
|
219
|
+
border-bottom-left-radius: 5px; cursor: pointer;
|
|
220
|
+
}
|
|
221
|
+
.msg.bot .bubble:hover { border-color: var(--accent); }
|
|
222
|
+
.msg.bot.selected .bubble { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
|
|
223
|
+
.msg.bot.refused .bubble { background: var(--fail-bg); border-color: var(--fail); }
|
|
224
|
+
.msg.bot.no_answer .bubble { background: var(--warn-bg); border-color: var(--warn); }
|
|
225
|
+
|
|
226
|
+
.msg-meta { font-size: 11px; color: var(--faint); font-family: var(--mono); display: flex; gap: 8px; flex-wrap: wrap; }
|
|
227
|
+
.cite-tag { color: var(--accent); }
|
|
228
|
+
|
|
229
|
+
.suggestions { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 18px 8px; flex: none; }
|
|
230
|
+
.suggestion {
|
|
231
|
+
appearance: none; cursor: pointer; text-align: left;
|
|
232
|
+
background: var(--panel); border: 1px solid var(--line);
|
|
233
|
+
color: var(--muted); font-size: 12px; padding: 4px 10px; border-radius: 999px;
|
|
234
|
+
}
|
|
235
|
+
.suggestion:hover { border-color: var(--accent); color: var(--accent); }
|
|
236
|
+
|
|
237
|
+
.composer { display: flex; gap: 10px; padding: 12px 18px 16px; border-top: 1px solid var(--line); background: var(--panel); flex: none; }
|
|
238
|
+
.composer textarea { flex: 1; max-height: 140px; min-height: 38px; }
|
|
239
|
+
|
|
240
|
+
/* inspector */
|
|
241
|
+
|
|
242
|
+
.inspector { flex: 1 1 44%; min-width: 340px; overflow-y: auto; background: var(--panel-2); display: flex; }
|
|
243
|
+
.inspector > .insp-content { flex: 1; padding: 16px 18px 40px; }
|
|
244
|
+
|
|
245
|
+
.verdict-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; margin-bottom: 18px; }
|
|
246
|
+
.verdict {
|
|
247
|
+
background: var(--panel); border: 1px solid var(--line);
|
|
248
|
+
border-radius: var(--radius-sm); padding: 8px 10px;
|
|
249
|
+
}
|
|
250
|
+
.verdict .k { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
|
|
251
|
+
.verdict .v { font-size: 12.5px; font-weight: 620; margin-top: 2px; overflow-wrap: anywhere; font-family: var(--mono); }
|
|
252
|
+
.verdict .v.pass { color: var(--pass); }
|
|
253
|
+
.verdict .v.fail { color: var(--fail); }
|
|
254
|
+
.verdict .v.warn { color: var(--warn); }
|
|
255
|
+
|
|
256
|
+
.insp-section { margin-bottom: 20px; }
|
|
257
|
+
.insp-section > h3 { margin-bottom: 9px; }
|
|
258
|
+
|
|
259
|
+
.bar-row { display: grid; grid-template-columns: minmax(90px, 1fr) 46px; gap: 8px; align-items: center; margin-bottom: 5px; font-size: 12px; }
|
|
260
|
+
.bar-label { font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
261
|
+
.bar-track { grid-column: 1 / -1; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: -3px; margin-bottom: 6px; }
|
|
262
|
+
.bar-fill { height: 100%; background: var(--accent); border-radius: 2px; }
|
|
263
|
+
.bar-fill.dim { background: var(--line-strong); }
|
|
264
|
+
.bar-value { text-align: right; font-family: var(--mono); color: var(--muted); }
|
|
265
|
+
.bar-row.winner .bar-label { color: var(--accent); font-weight: 600; }
|
|
266
|
+
|
|
267
|
+
.chunk {
|
|
268
|
+
background: var(--panel); border: 1px solid var(--line);
|
|
269
|
+
border-radius: var(--radius-sm); padding: 9px 11px; margin-bottom: 7px;
|
|
270
|
+
}
|
|
271
|
+
.chunk-head { display: flex; align-items: baseline; gap: 8px; font-size: 12px; }
|
|
272
|
+
.chunk-id { font-family: var(--mono); color: var(--accent); font-weight: 600; }
|
|
273
|
+
.chunk-title { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
274
|
+
.chunk-score { margin-left: auto; font-family: var(--mono); color: var(--faint); }
|
|
275
|
+
.chunk-text { font-size: 12px; line-height: 1.6; color: var(--muted); margin-top: 6px; white-space: pre-wrap; max-height: 84px; overflow: hidden; position: relative; }
|
|
276
|
+
.chunk-text.open { max-height: none; }
|
|
277
|
+
.chunk-toggle { font-size: 11px; color: var(--accent); cursor: pointer; margin-top: 4px; display: inline-block; }
|
|
278
|
+
|
|
279
|
+
.kv { display: flex; gap: 8px; font-size: 12px; padding: 4px 0; border-bottom: 1px solid var(--line); }
|
|
280
|
+
.kv:last-child { border-bottom: 0; }
|
|
281
|
+
.kv .k { color: var(--muted); min-width: 92px; font-family: var(--mono); }
|
|
282
|
+
.kv .v { flex: 1; word-break: break-word; }
|
|
283
|
+
|
|
284
|
+
/* ─────────────────────────────────────────────────────── evaluation panel */
|
|
285
|
+
|
|
286
|
+
.eval-layout { display: flex; flex: 1; min-height: 0; width: 100%; }
|
|
287
|
+
.runs-rail { flex: 0 0 232px; border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
|
|
288
|
+
.runs-list { flex: 1; overflow-y: auto; padding: 0 8px 12px; }
|
|
289
|
+
|
|
290
|
+
.run-item {
|
|
291
|
+
padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer;
|
|
292
|
+
border: 1px solid transparent; margin-bottom: 3px;
|
|
293
|
+
}
|
|
294
|
+
.run-item:hover { background: var(--panel-2); }
|
|
295
|
+
.run-item.active { background: var(--accent-soft); border-color: var(--accent); }
|
|
296
|
+
.run-item .name { font-family: var(--mono); font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
297
|
+
.run-item .sub { font-size: 11px; color: var(--faint); display: flex; gap: 7px; margin-top: 2px; }
|
|
298
|
+
|
|
299
|
+
.eval-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
|
|
300
|
+
|
|
301
|
+
.run-controls {
|
|
302
|
+
padding: 12px 18px; border-bottom: 1px solid var(--line);
|
|
303
|
+
background: var(--panel); display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; flex: none;
|
|
304
|
+
}
|
|
305
|
+
.control-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
|
|
306
|
+
.control-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }
|
|
307
|
+
.control-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
|
|
308
|
+
|
|
309
|
+
.chip-row { display: flex; gap: 5px; flex-wrap: wrap; }
|
|
310
|
+
.chip {
|
|
311
|
+
appearance: none; cursor: pointer;
|
|
312
|
+
background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
|
|
313
|
+
font-size: 12px; padding: 3px 9px; border-radius: 999px; font-family: var(--mono);
|
|
314
|
+
}
|
|
315
|
+
.chip:hover { border-color: var(--line-strong); }
|
|
316
|
+
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
|
|
317
|
+
|
|
318
|
+
#eval-body { flex: 1; overflow-y: auto; padding: 16px 18px 40px; }
|
|
319
|
+
|
|
320
|
+
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(122px, 1fr)); gap: 10px; margin-bottom: 18px; }
|
|
321
|
+
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
|
|
322
|
+
.card .k { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
|
|
323
|
+
.card .v { font-size: 24px; font-weight: 660; margin-top: 3px; letter-spacing: -.02em; }
|
|
324
|
+
.card .v.pass { color: var(--pass); }
|
|
325
|
+
.card .v.fail { color: var(--fail); }
|
|
326
|
+
|
|
327
|
+
table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 18px; }
|
|
328
|
+
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: top; }
|
|
329
|
+
th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); font-weight: 600; background: var(--panel-2); }
|
|
330
|
+
tr:last-child td { border-bottom: 0; }
|
|
331
|
+
td.num, th.num { text-align: right; font-family: var(--mono); }
|
|
332
|
+
|
|
333
|
+
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 650; font-family: var(--mono); }
|
|
334
|
+
.pill.pass { background: var(--pass-bg); color: var(--pass); }
|
|
335
|
+
.pill.fail { background: var(--fail-bg); color: var(--fail); }
|
|
336
|
+
.pill.warn { background: var(--warn-bg); color: var(--warn); }
|
|
337
|
+
.pill.neutral { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
|
|
338
|
+
|
|
339
|
+
.case {
|
|
340
|
+
background: var(--panel); border: 1px solid var(--line);
|
|
341
|
+
border-radius: var(--radius-sm); margin-bottom: 6px; overflow: hidden;
|
|
342
|
+
}
|
|
343
|
+
.case-head { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; }
|
|
344
|
+
.case-head:hover { background: var(--panel-2); }
|
|
345
|
+
.case.failed { border-color: var(--fail); }
|
|
346
|
+
.case-id { font-family: var(--mono); font-size: 12px; color: var(--accent); flex: 0 0 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
347
|
+
.case-msg { flex: 1; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
348
|
+
.case-body { padding: 0 12px 12px; border-top: 1px solid var(--line); }
|
|
349
|
+
.case-reply { background: var(--panel-2); border-radius: var(--radius-sm); padding: 9px 11px; margin: 10px 0; font-size: 13px; white-space: pre-wrap; line-height: 1.6; }
|
|
350
|
+
.check-row td { font-size: 12px; }
|
|
351
|
+
.check-row.bad td { background: var(--fail-bg); }
|
|
352
|
+
|
|
353
|
+
.filter-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
|
|
354
|
+
|
|
355
|
+
/* ──────────────────────────────────────────────────────── knowledge panel */
|
|
356
|
+
|
|
357
|
+
.editor-layout { display: flex; flex: 1; min-height: 0; width: 100%; }
|
|
358
|
+
.doc-rail { flex: 0 0 268px; border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
|
|
359
|
+
.rail-filter { margin: 0 12px 10px; }
|
|
360
|
+
.doc-list { flex: 1; overflow-y: auto; padding: 0 8px 12px; }
|
|
361
|
+
|
|
362
|
+
.doc-item { padding: 7px 10px; border-radius: var(--radius-sm); cursor: pointer; border: 1px solid transparent; margin-bottom: 2px; }
|
|
363
|
+
.doc-item:hover { background: var(--panel-2); }
|
|
364
|
+
.doc-item.active { background: var(--accent-soft); border-color: var(--accent); }
|
|
365
|
+
.doc-item .id { font-family: var(--mono); font-size: 12px; font-weight: 600; }
|
|
366
|
+
.doc-item .title { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
367
|
+
.doc-item .tags { font-size: 10px; color: var(--faint); font-family: var(--mono); margin-top: 2px; }
|
|
368
|
+
|
|
369
|
+
.doc-editor { flex: 1; min-width: 0; overflow-y: auto; display: flex; }
|
|
370
|
+
.doc-form { flex: 1; padding: 18px 22px 40px; max-width: 900px; }
|
|
371
|
+
.field { margin-bottom: 14px; display: flex; flex-direction: column; gap: 5px; }
|
|
372
|
+
.field > label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }
|
|
373
|
+
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
|
|
374
|
+
.form-actions { display: flex; gap: 8px; align-items: center; padding-top: 6px; }
|
|
375
|
+
.form-actions .spacer { flex: 1; }
|
|
376
|
+
.hint { font-size: 11px; color: var(--faint); }
|
|
377
|
+
|
|
378
|
+
/* ────────────────────────────────────────────────────────── routing panel */
|
|
379
|
+
|
|
380
|
+
.routing-layout { display: flex; flex: 1; min-height: 0; width: 100%; }
|
|
381
|
+
.routing-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
|
|
382
|
+
#intents-body { flex: 1; overflow-y: auto; padding: 0 18px 40px; }
|
|
383
|
+
|
|
384
|
+
.view-switch { display: flex; gap: 2px; background: var(--panel-2); padding: 2px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
|
|
385
|
+
.seg {
|
|
386
|
+
appearance: none; border: 0; background: transparent; cursor: pointer;
|
|
387
|
+
font-size: 12px; font-weight: 550; color: var(--muted); padding: 4px 12px; border-radius: 5px;
|
|
388
|
+
}
|
|
389
|
+
.seg.active { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
|
|
390
|
+
|
|
391
|
+
.kw { display: inline-block; background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin: 1px 3px 1px 0; font-family: var(--mono); font-size: 11px; }
|
|
392
|
+
|
|
393
|
+
.route-tester { flex: 0 0 320px; border-left: 1px solid var(--line); background: var(--panel); padding: 14px 16px; overflow-y: auto; }
|
|
394
|
+
.route-tester h3 { margin-bottom: 6px; }
|
|
395
|
+
.route-tester p { font-size: 12px; line-height: 1.5; }
|
|
396
|
+
.route-tester input { width: 100%; margin: 8px 0 14px; }
|
|
397
|
+
|
|
398
|
+
/* ───────────────────────────────────────────────────────────────── toasts */
|
|
399
|
+
|
|
400
|
+
.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
|
|
401
|
+
.toast {
|
|
402
|
+
background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--accent);
|
|
403
|
+
border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px;
|
|
404
|
+
box-shadow: 0 4px 14px rgba(16, 24, 40, .12); max-width: 400px;
|
|
405
|
+
animation: slide-in .16s ease-out;
|
|
406
|
+
}
|
|
407
|
+
.toast.error { border-left-color: var(--fail); }
|
|
408
|
+
.toast.success { border-left-color: var(--pass); }
|
|
409
|
+
@keyframes slide-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
|
|
410
|
+
|
|
411
|
+
@media (prefers-reduced-motion: reduce) {
|
|
412
|
+
.toast { animation: none; }
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/* ─────────────────────────────────────────────────────────────── narrow */
|
|
416
|
+
|
|
417
|
+
@media (max-width: 1080px) {
|
|
418
|
+
.split, .eval-layout, .editor-layout, .routing-layout { flex-direction: column; overflow-y: auto; }
|
|
419
|
+
.inspector, .route-tester { border-left: 0; border-top: 1px solid var(--line); min-width: 0; }
|
|
420
|
+
.runs-rail, .doc-rail { flex: none; border-right: 0; border-bottom: 1px solid var(--line); max-height: 220px; }
|
|
421
|
+
.chat-column { border-right: 0; }
|
|
422
|
+
.brand-sub { display: none; }
|
|
423
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/* Bootstrap: tabs, theme, the engine status chip, and starting the panels.
|
|
2
|
+
*
|
|
3
|
+
* Loaded last. Everything it uses comes from core.js and panels.js.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const App = {
|
|
7
|
+
panels: {
|
|
8
|
+
console: ConsolePanel,
|
|
9
|
+
evaluation: EvaluationPanel,
|
|
10
|
+
knowledge: KnowledgePanel,
|
|
11
|
+
routing: RoutingPanel,
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
current: null,
|
|
15
|
+
|
|
16
|
+
init() {
|
|
17
|
+
this.initTheme();
|
|
18
|
+
|
|
19
|
+
$('tabs').addEventListener('click', (event) => {
|
|
20
|
+
const tab = event.target.closest('.tab');
|
|
21
|
+
if (tab) this.show(tab.dataset.panel);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
$('reload-engine').addEventListener('click', guard(async (event) =>
|
|
25
|
+
withBusy(event.target, '…', async () => {
|
|
26
|
+
await api.post('/api/system/reload', {});
|
|
27
|
+
toast('Engine reloaded from disk', 'success');
|
|
28
|
+
await this.refreshEngineChip();
|
|
29
|
+
// The corpus may have changed underneath these two, so re-read them.
|
|
30
|
+
KnowledgePanel.loaded = false;
|
|
31
|
+
RoutingPanel.loaded = false;
|
|
32
|
+
})));
|
|
33
|
+
|
|
34
|
+
for (const panel of Object.values(this.panels)) panel.init();
|
|
35
|
+
|
|
36
|
+
// Deep-linkable: /#evaluation opens that tab directly, and pasting a new
|
|
37
|
+
// hash into an already-open tab switches panel rather than doing nothing.
|
|
38
|
+
const fromHash = () => window.location.hash.replace('#', '');
|
|
39
|
+
window.addEventListener('hashchange', () => {
|
|
40
|
+
const name = fromHash();
|
|
41
|
+
if (this.panels[name]) this.show(name);
|
|
42
|
+
});
|
|
43
|
+
this.show(this.panels[fromHash()] ? fromHash() : 'console');
|
|
44
|
+
|
|
45
|
+
this.refreshEngineChip();
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
show(name) {
|
|
49
|
+
if (this.current === name) return;
|
|
50
|
+
this.current = name;
|
|
51
|
+
window.history.replaceState(null, '', `#${name}`);
|
|
52
|
+
|
|
53
|
+
for (const tab of $('tabs').children) {
|
|
54
|
+
tab.classList.toggle('active', tab.dataset.panel === name);
|
|
55
|
+
}
|
|
56
|
+
for (const [key, panel] of Object.entries(this.panels)) {
|
|
57
|
+
$(`panel-${key}`).classList.toggle('active', key === name);
|
|
58
|
+
if (key === name) guard(() => panel.activate())();
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
/** Theme follows the OS until the user picks one, then the choice sticks. */
|
|
63
|
+
initTheme() {
|
|
64
|
+
const stored = localStorage.getItem('askback-theme');
|
|
65
|
+
if (stored) document.documentElement.dataset.theme = stored;
|
|
66
|
+
|
|
67
|
+
$('theme-toggle').addEventListener('click', () => {
|
|
68
|
+
const root = document.documentElement;
|
|
69
|
+
const isDark = root.dataset.theme
|
|
70
|
+
? root.dataset.theme === 'dark'
|
|
71
|
+
: window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
72
|
+
const next = isDark ? 'light' : 'dark';
|
|
73
|
+
root.dataset.theme = next;
|
|
74
|
+
localStorage.setItem('askback-theme', next);
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
/** The top-right chip: what the engine is actually wired to right now. */
|
|
79
|
+
async refreshEngineChip() {
|
|
80
|
+
try {
|
|
81
|
+
const info = await api.get('/api/system/info');
|
|
82
|
+
$('engine-dot').className = 'dot ok';
|
|
83
|
+
$('engine-summary').textContent =
|
|
84
|
+
`${info.llm} · ${info.retriever} · ${info.agents.length} agents`;
|
|
85
|
+
$('engine-chip').title =
|
|
86
|
+
`LLM: ${info.llm}\nRetriever: ${info.retriever}\n`
|
|
87
|
+
+ `Agents: ${info.agents.join(', ')}\nTools: ${info.tools.join(', ')}\n`
|
|
88
|
+
+ `Guards: ${info.guards.join(', ')}\nReloads: ${info.reload_count}`;
|
|
89
|
+
} catch (error) {
|
|
90
|
+
$('engine-dot').className = 'dot bad';
|
|
91
|
+
$('engine-summary').textContent = 'engine unavailable';
|
|
92
|
+
$('engine-chip').title = error.message;
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
window.App = App;
|
|
98
|
+
document.addEventListener('DOMContentLoaded', () => App.init());
|