redact: UX overhaul — engine simplification, credits, spinner, save-to-docs, badges

- Remove GPU/regex engine options; keep only azure_mini (1 credit) and azure_full (2 credits)
- Variable credit cost: engine-aware pre-check and charge in api/redact.php; PricingCatalog base = 1
- Fix ATTORNEY not preserved when keepOfficials=true: add to LLM prompt, generic-tag, pseudonym regexes
- Replace Azure credits hint with per-engine credit cost text (all 4 languages)
- Single-file upload only (was: up to 5); simplify status messages
- Clear previous redaction output and show pulsing spinner when a new run starts
- Add "Save to My Docs" button in redact output panel (corpus-save.js path)
- corpus-save.js: capture source_doc_ids from button dataset, pass in POST payload
- api/save-to-corpus.php: accept source_doc_ids, store first as source_url=corpus-doc:{id}
- doc-picker.js: show "✂ Redacted" badge for documents saved from the redact tool
- CSS: .redact-working spinner, doc-item__badge--redact pill styles

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-25 08:18:51 +02:00
parent a821d39dcd
commit 56cd87dd7b
10 changed files with 117 additions and 50 deletions
+3 -5
View File
@@ -19,10 +19,8 @@ require_once __DIR__ . '/includes/layout.php';
<span class="control-label" data-i18n="redactEngine">Engine</span>
<label><input type="radio" name="redactEngine" value="azure_mini" checked id="redactEngineAzureMini"> <span data-i18n="redactEngineAzureMini">Azure gpt-4o-mini</span> &#9733; <small class="control-hint">(fast)</small></label>
<label><input type="radio" name="redactEngine" value="azure_full" id="redactEngineAzureFull"> <span data-i18n="redactEngineAzureFull">Azure gpt-4o</span> <small class="control-hint">(best)</small></label>
<label><input type="radio" name="redactEngine" value="gpu" id="redactEngineGpu"> <span data-i18n="redactEngineGpu">GPU (cuttlefish)</span> <small class="control-hint">(local)</small></label>
<label><input type="radio" name="redactEngine" value="regex" id="redactEngineRegex"> <span data-i18n="redactEngineRegex">Regex only</span> <small class="control-hint">(free)</small></label>
</div>
<p class="upload-hint" data-i18n="redactEngineHint">Azure engines use your BNL Azure credits. GPU runs the local LiteLLM proxy. Regex-only is instant and free but finds no names or organisations.</p>
<p class="upload-hint" data-i18n="redactEngineHint">gpt-4o-mini: 1 credit — fast, handles most documents well. gpt-4o: 2 credits — higher accuracy for complex or multi-person cases.</p>
<details class="advanced-panel" id="redactAdvanced">
<summary class="advanced-toggle" data-i18n="redactAdvancedToggle">Advanced settings</summary>
@@ -95,10 +93,10 @@ require_once __DIR__ . '/includes/layout.php';
</div>
<div class="upload-zone" id="uploadZone" role="region" aria-label="File upload" data-i18n-aria="redactUploadAria">
<input type="file" id="uploadInput" multiple accept=".pdf,.docx,.txt" aria-label="Choose files">
<input type="file" id="uploadInput" accept=".pdf,.docx,.txt" aria-label="Choose file">
<div id="uploadPrompt" class="upload-prompt">
<span class="upload-icon" aria-hidden="true">&#8679;</span>
<p><span data-i18n="redactUploadDrop">Drop up to 5 files here, or</span> <label for="uploadInput" class="upload-browse" data-i18n="redactUploadBrowse">browse</label></p>
<p><span data-i18n="redactUploadDrop">Drop one file here, or</span> <label for="uploadInput" class="upload-browse" data-i18n="redactUploadBrowse">browse</label></p>
<p class="upload-hint"><strong>PDF</strong>, <strong>DOCX</strong>, <strong>TXT</strong> &mdash; <span data-i18n="redactUploadHint">text extracted in memory, never stored</span></p>
</div>
<div id="uploadFileInfo" class="upload-file is-hidden">