All checks were successful
Build and Test / build-and-test (push) Successful in 37s
Replace the single-line note inputs (which truncated long notes) with wrapping, auto-growing textareas and a per-note Save/Delete row, so the whole correction note is readable and editable. Changelog 0.0.4. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
60 lines
2 KiB
HTML
60 lines
2 KiB
HTML
{{define "title"}}AI{{end}}
|
|
{{define "content"}}
|
|
<header>
|
|
<span><a href="/">← Add receipt</a></span>
|
|
<span><a href="/recent">Recent</a> · <a href="/tally">Tally</a> · <a href="/manage">Manage</a></span>
|
|
</header>
|
|
<h1>AI classifier</h1>
|
|
{{if .Error}}<div class="err">{{.Error}}</div>{{end}}
|
|
|
|
<h2>Correction notes</h2>
|
|
<p><small>Free-text rules appended to the classifier prompt to fix recurring misreads. Editing a note keeps the old version in history.</small></p>
|
|
{{range .Notes}}
|
|
<form class="note" method="post" action="/ai/notes/edit">
|
|
<input type="hidden" name="id" value="{{.ID}}">
|
|
<textarea name="text" rows="2">{{.Text}}</textarea>
|
|
<div class="note-actions">
|
|
<button type="submit">Save</button>
|
|
<button type="submit" formaction="/ai/notes/delete" class="danger">Delete</button>
|
|
</div>
|
|
</form>
|
|
{{end}}
|
|
<form class="note add" method="post" action="/ai/notes">
|
|
<textarea name="text" rows="2" placeholder="New correction note…"></textarea>
|
|
<div class="note-actions"><button type="submit">Add note</button></div>
|
|
</form>
|
|
|
|
<script>
|
|
// Grow each note's textarea to fit its full text, so long notes are readable.
|
|
document.querySelectorAll("form.note textarea").forEach(function (ta) {
|
|
function fit() { ta.style.height = "auto"; ta.style.height = ta.scrollHeight + "px"; }
|
|
ta.addEventListener("input", fit);
|
|
fit();
|
|
});
|
|
</script>
|
|
|
|
<h2>Review misreads {{if .Misses}}({{len .Misses}}){{end}}</h2>
|
|
{{if not .Misses}}
|
|
<p><small>No misreads to review — the AI matched what you submitted (or nothing has been classified yet).</small></p>
|
|
{{else}}
|
|
<ul class="recent">
|
|
{{range .Misses}}
|
|
<li>
|
|
<a class="amt" href="/ai/review/{{.ReceiptID}}">${{.Amount}}</a>
|
|
<span class="meta">{{.When}} · changed: {{.Fields}}</span>
|
|
<span class="when">{{.Model}}</span>
|
|
</li>
|
|
{{end}}
|
|
</ul>
|
|
{{end}}
|
|
|
|
<h2>Current prompt</h2>
|
|
{{if .Prompt}}
|
|
<details>
|
|
<summary>View the exact system prompt sent to the model</summary>
|
|
<pre class="prompt">{{.Prompt}}</pre>
|
|
</details>
|
|
{{else}}
|
|
<p><small>{{.PromptNote}}</small></p>
|
|
{{end}}
|
|
{{end}}
|