feat: RapidOCR default OCR engine, office-only ocr_engine, drop operator toggle
ci / smoke (push) Canceled after 0s
ci / smoke (push) Canceled after 0s
This commit is contained in:
1 parent
080237ad3b
commit
fbba169507
16 files changed
+137
-112
No files matched your search
+1
-45
@@ -312,14 +312,6 @@
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.ocr-row select {
|
||||
padding: 6px 10px;
|
||||
border-radius: var(--radius-md);
|
||||
border: 1px solid var(--border-color);
|
||||
background: var(--bg-base);
|
||||
color: var(--text-primary);
|
||||
font-size: 13px;
|
||||
}
|
||||
.mode-badge {
|
||||
display: inline-block;
|
||||
padding: 4px 12px;
|
||||
@@ -401,7 +393,6 @@
|
||||
<div id="doPanel" class="do-panel">
|
||||
<h4>
|
||||
<span><i class="fa-solid fa-file-lines"></i> Foto DO (Smartphone)</span>
|
||||
<span id="doEngineBadge" style="font-size:11px;font-weight:600;color:var(--text-secondary);"></span>
|
||||
</h4>
|
||||
<input type="file" id="doPhotoInput" accept="image/*" capture="environment" multiple
|
||||
style="display:none" onchange="uploadDoPhotos(this.files)">
|
||||
@@ -413,15 +404,6 @@
|
||||
<div id="doCards"></div>
|
||||
<div id="doGroupPreview"></div>
|
||||
<div id="doWarn" class="do-warn" style="display:none;"></div>
|
||||
<div class="ocr-row">
|
||||
<span>OCR:</span>
|
||||
<select id="ocrEngineSelect" onchange="setOcrEngine(this.value)">
|
||||
<option value="tesseract">Tesseract</option>
|
||||
<option value="paddle">PaddleOCR</option>
|
||||
<option value="none">Off (manual)</option>
|
||||
</select>
|
||||
<span id="ocrEngineHint"></span>
|
||||
</div>
|
||||
<div id="doRequirePlateRow" class="ocr-row" style="display:none;">
|
||||
<label><input type="checkbox" id="requirePlateChk" onchange="setRequirePlate(this.checked)"> Wajib plat nomor</label>
|
||||
</div>
|
||||
@@ -474,7 +456,7 @@
|
||||
let isBatchActive = false;
|
||||
let currentMode = 'auto';
|
||||
let stagedDos = [];
|
||||
let settings = { require_plate: false, require_do: true, ocr_engine: 'tesseract', editable: false };
|
||||
let settings = { require_plate: false, require_do: true, editable: false };
|
||||
|
||||
function closeModal(id) {
|
||||
document.getElementById(id).style.display = 'none';
|
||||
@@ -531,12 +513,6 @@
|
||||
const data = await res.json();
|
||||
if (!data.success) return;
|
||||
settings = data;
|
||||
const sel = document.getElementById('ocrEngineSelect');
|
||||
if (sel && data.ocr_engine) sel.value = data.ocr_engine;
|
||||
const hint = document.getElementById('ocrEngineHint');
|
||||
if (hint) hint.textContent = 'engine: ' + (data.ocr_engine || 'tesseract');
|
||||
const badge = document.getElementById('doEngineBadge');
|
||||
if (badge) badge.textContent = (data.ocr_engine || 'tesseract');
|
||||
const chk = document.getElementById('requirePlateChk');
|
||||
const row = document.getElementById('doRequirePlateRow');
|
||||
if (chk) chk.checked = !!data.require_plate;
|
||||
@@ -544,26 +520,6 @@
|
||||
} catch (e) { console.error(e); }
|
||||
}
|
||||
|
||||
async function setOcrEngine(eng) {
|
||||
try {
|
||||
const res = await fetch('/api/do/settings', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ ocr_engine: eng })
|
||||
});
|
||||
const data = await res.json();
|
||||
if (!data.success) {
|
||||
alert('Gagal set OCR: ' + (data.error || res.status));
|
||||
loadDoSettings();
|
||||
return;
|
||||
}
|
||||
loadDoSettings();
|
||||
} catch (e) {
|
||||
alert('Gagal terhubung ke server');
|
||||
loadDoSettings();
|
||||
}
|
||||
}
|
||||
|
||||
async function setRequirePlate(val) {
|
||||
try {
|
||||
const res = await fetch('/api/do/settings', {
|
||||
|
||||
Reference in new issue
Block a user