fix: audit perbaikan NATS subject, worker spawn, frontend options, pipeline PDF output

Bug fixes:
1. NATS subject doubled prefix — gateway publish ke tools.tools.scan.*
   padahal workers subscribe ke tools.scan.*. Fix: pakai group() method
2. Worker subscriptions pake tokio::select! — cuma satu subscription
   yang diproses, sisanya di-cancel. Fix: ganti ke tokio::spawn + loop
3. WebSocket URL hardcoded ke localhost:3001 — gak jalan di prod.
   Fix: infer dari window.location atau env var
4. Frontend scan options hardcoded — user gak bisa atur OCR/enhance/format.
   Fix: interactive toggles, selects, slider
5. Frontend compress quality hardcoded — user gak bisa atur kualitas.
   Fix: quality range slider
6. Pipeline cuma output PNG — gak ada PDF/OCR.
   Fix: generate searchable PDF kalo tesseract feature enabled

Enhancements:
- Tool::group() method added — returns 'scan', 'image', 'pdf' dll
- Dockerfile: --features tesseract pas cargo build
- leptess OCR: proper API usage (set_image_from_mem, recognize, etc.)

Co-Authored-By: Kilo <kilo@kilo.ai>
This commit is contained in:
asepharyana
2026-07-24 18:24:22 +07:00
co-authored by Kilo
parent 37cc3a7486
commit d2bfcb83a0
9 changed files with 290 additions and 121 deletions
+7 -7
View File
@@ -36,21 +36,21 @@ pub enum Tool {
}
impl Tool {
/// Returns the NATS subject prefix for this tool.
pub fn subject_prefix(&self) -> &'static str {
/// Returns the NATS subject group (without "tools." prefix).
pub fn group(&self) -> &'static str {
match self {
Tool::Scan => "tools.scan",
Tool::Scan => "scan",
Tool::ImageCompress
| Tool::ImageResize
| Tool::ImageConvert
| Tool::RemoveBg => "tools.image",
| Tool::RemoveBg => "image",
Tool::PdfMerge
| Tool::PdfSplit
| Tool::ImagesToPdf
| Tool::PdfCompress
| Tool::PdfToImages => "tools.pdf",
Tool::VideoCompress | Tool::VideoTrim | Tool::GifMaker => "tools.video",
Tool::AudioExtract | Tool::AudioConvert => "tools.audio",
| Tool::PdfToImages => "pdf",
Tool::VideoCompress | Tool::VideoTrim | Tool::GifMaker => "video",
Tool::AudioExtract | Tool::AudioConvert => "audio",
}
}