Ask what an error means before deciding it is dealt with
The row could open the log or acknowledge it, both of which assume you already know what the line is telling you.
This commit is contained in:
@@ -943,6 +943,12 @@ mark { background: #5d4037; color: #ffcc80; border-radius: 2px; }
|
|||||||
.vv-ack-btn { margin-left: auto; font-size: 10px; padding: 1px 6px;
|
.vv-ack-btn { margin-left: auto; font-size: 10px; padding: 1px 6px;
|
||||||
color: #555; border-color: #333; flex-shrink: 0; }
|
color: #555; border-color: #333; flex-shrink: 0; }
|
||||||
.vv-ack-btn:hover { color: #aaa; border-color: #555; }
|
.vv-ack-btn:hover { color: #aaa; border-color: #555; }
|
||||||
|
/* Same size as Ack beside it, but not the same weight. Ack is the quiet, frequent action; asking
|
||||||
|
what an error means is the rarer one and the one worth noticing on a row you do not understand,
|
||||||
|
so it carries the assistant's blue rather than dissolving into the border. */
|
||||||
|
.vv-why-btn { font-size: 10px; padding: 1px 6px; flex-shrink: 0;
|
||||||
|
color: #5c7cfa; border-color: #26324a; background: #0d1220; }
|
||||||
|
.vv-why-btn:hover { color: #8ba4ff; border-color: #3a4a6a; }
|
||||||
.vv-err-line { color: #888; font-size: 11px; word-break: break-all; line-height: 1.4; }
|
.vv-err-line { color: #888; font-size: 11px; word-break: break-all; line-height: 1.4; }
|
||||||
/* The error text opens the log at that line. Underlined on hover only — a permanently decorated
|
/* The error text opens the log at that line. Underlined on hover only — a permanently decorated
|
||||||
line of log output is harder to read, and this block exists to be read first. */
|
line of log output is harder to read, and this block exists to be read first. */
|
||||||
|
|||||||
@@ -2877,6 +2877,30 @@ function vvMarkLogLine(pre, display, invert) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hand one error line to the assistant, scoped to the script it came from.
|
||||||
|
//
|
||||||
|
// The scope is what does the work. Pointing the troubleshoot profile at a script is what attaches
|
||||||
|
// that script's run record and log to the prompt, so the model reads the surrounding lines rather
|
||||||
|
// than the one sentence quoted here — which is the difference between "that string usually means
|
||||||
|
// a permissions problem" and "it failed here, after this, because of that".
|
||||||
|
//
|
||||||
|
// Deliberately does not acknowledge. Every other control on the row does, because opening the log
|
||||||
|
// at the line is something you do once you have seen it; asking what it means is something you do
|
||||||
|
// before deciding anything. Acking here would clear the row out from under the answer.
|
||||||
|
function vvErrExplain(script, line) {
|
||||||
|
if (!vvAiDockOn()) return;
|
||||||
|
const label = script.split('/').pop().replace(/_/g, ' ');
|
||||||
|
vvAiDockScope('troubleshoot', label, script);
|
||||||
|
|
||||||
|
const inp = document.getElementById('vv-sched-ai-input');
|
||||||
|
if (!inp) return;
|
||||||
|
// The line is quoted into the question rather than left for the model to find: the log may hold
|
||||||
|
// several errors and this is the one that was clicked.
|
||||||
|
inp.value = 'This error line came from ' + script + ':\n\n' + line
|
||||||
|
+ '\n\nWhat caused it, and what should I do about it?';
|
||||||
|
vvSchedChat.send();
|
||||||
|
}
|
||||||
|
|
||||||
function vvAckError(script, ts, btn) {
|
function vvAckError(script, ts, btn) {
|
||||||
localStorage.setItem('vv-ack-' + script, ts);
|
localStorage.setItem('vv-ack-' + script, ts);
|
||||||
const row = btn.closest('.vv-err-row');
|
const row = btn.closest('.vv-err-row');
|
||||||
@@ -2926,6 +2950,14 @@ function vvUpdateErrors(errors) {
|
|||||||
+ ' onclick="vvErrOpenAtLine(' + scriptJs + ',' + e.ts + ',' + lineJs + ',this)">'
|
+ ' onclick="vvErrOpenAtLine(' + scriptJs + ',' + e.ts + ',' + lineJs + ',this)">'
|
||||||
+ vvEscHtml(label) + '</span>'
|
+ vvEscHtml(label) + '</span>'
|
||||||
+ '<span class="vv-err-age">' + vvFmtAge(now - e.ts) + '</span>'
|
+ '<span class="vv-err-age">' + vvFmtAge(now - e.ts) + '</span>'
|
||||||
|
// Only where there is an assistant to ask. Rendered before Ack because it is the
|
||||||
|
// question you have before you decide the error is dealt with — and unlike every other
|
||||||
|
// control on this row it deliberately does NOT acknowledge, since wanting to know what
|
||||||
|
// an error means is the opposite of having finished with it.
|
||||||
|
+ (vvAiDockOn()
|
||||||
|
? '<button class="vv-btn-sm vv-why-btn" title="Ask the assistant what caused this"'
|
||||||
|
+ ' onclick="vvErrExplain(' + scriptJs + ',' + lineJs + ')">Why?</button>'
|
||||||
|
: '')
|
||||||
+ '<button class="vv-btn-sm vv-ack-btn" onclick="vvAckError(' + scriptJs + ',' + e.ts + ',this)">Ack</button>'
|
+ '<button class="vv-btn-sm vv-ack-btn" onclick="vvAckError(' + scriptJs + ',' + e.ts + ',this)">Ack</button>'
|
||||||
+ '</div>'
|
+ '</div>'
|
||||||
+ '<div class="vv-err-line vv-err-line-open"'
|
+ '<div class="vv-err-line vv-err-line-open"'
|
||||||
|
|||||||
Reference in New Issue
Block a user