PDF sources and administrator accounts
Upload and publish a PDF
Section titled “Upload and publish a PDF”Open Dokumen PDF → Unggah PDF. Select a PDF, title, category, visibility, and optional expiry (end of the selected day in WIB). Uploading immediately queues local processing. The dashboard polls progress; inside a document use Perbarui. No WhatsApp messages are sent by document management.
The default is process → review → publish. Open Tinjau dokumen, inspect extraction warnings and each section, correct text/questions/keywords where necessary, and use Setujui & terbitkan. The document test searches that document’s sections, including drafts, and shows supporting text/page references without calling Google. Published public sections also appear in Pengetahuan and its normal retrieval test. Editing an imported section from that list opens the owning document.
Internal means administrator-only storage/review: even an approved internal document is excluded from both the bot’s retrieval and its topic catalog. All WhatsApp senders, including staff phone numbers, currently share the public knowledge boundary. This is not a staff-only WhatsApp retrieval feature. Every original PDF requires an authenticated dashboard administrator to download it; public publication shares indexed text, not a public PDF URL.
Trusted text PDFs may opt into auto-publication at upload. OCR documents always require review. Expired documents and unavailable replacement targets do not auto-publish. Automatic extraction can miss columns, diagrams, table relationships, or captions; the system flags this limitation rather than claiming complete visual understanding. Do not publish confidential or unverified content.
Replacement, withdrawal, and correction
Section titled “Replacement, withdrawal, and correction”Unggah versi baru keeps the selected old version available until the replacement is approved. Publishing the replacement atomically retires the selected old source and its sections. Review the replacement’s expiry/visibility: publishing it as internal will also retire that old public source. An expired replacement cannot be published.
Tarik dari publikasi removes its sections from answers. Changing settings or section text withdraws the whole published document pending approval again. Changes use version checks, so an older open editor cannot overwrite newer edits. Hapus dokumen permanently removes the source PDF and its indexed sections. Deletion is blocked while processing. Coba proses ulang requeues a failed upload; corrupted files need a corrected upload instead.
The document detail screen includes Pratinjau PDF. Expand it to render a page privately as an image. Use the page number or previous/next buttons to navigate. For a queued document with an unknown page count, refresh the detail after processing to navigate beyond page 1. The original PDF remains available through the download action.
WhatsApp citations for PDF passages show the original filename, document title, and page. The bot keeps the original-file download and preview behind dashboard authentication.
Technical operation
Section titled “Technical operation”The existing PostgreSQL database stores the PDF (bytea), SHA-256 duplicate key, metadata, lifecycle, progress, and review warnings in knowledge_documents. Sections live in faq with document_id, original page bounds, source name, and keywords. Original section text remains the evidence; searchable headings/keywords are derived locally. There is no AI rewrite, optional enrichment job, embedding service, or new vector database. No PDF content is sent to Google during import. Once published, relevant sanitized evidence can be sent to the configured model through the existing answer flow.
Published public sections use the existing full-text, synonym, fuzzy, conversational-context ranking and citation validation. An independent document visibility/status/expiry check is applied at retrieval, even if an individual FAQ publication flag were incorrect. Source footers identify the document and page. The fixed prompt explains that excerpts are partial evidence, and instructions embedded in documents cannot override helpdesk rules. Citation checks establish attribution, not a guarantee that every generated claim is correct.
pdf-worker is separate from the WhatsApp worker, has only the database environment, no provider/WAHA keys, no published ports, and only the internal Docker network. It runs as the existing unprivileged user with a read-only filesystem and temporary storage. Poppler performs local text extraction; image-only/sparse pages use Tesseract Indonesian + English. A separate extraction process has memory/CPU/file limits; the worker enforces a 30-minute document deadline and terminates its process group on timeout. OCR and complex extraction may time out; split the document and retry.
Limits: 32 MB / PDF, 250 pages, 5 queued or processing sources, 100 stored documents, 200 MB total original PDFs. Extraction is also capped at 40,000 characters per page and six million characters per PDF. A page is rendered at at most 2,000 pixels along its longest side for OCR. The service uses 640 MB RAM and 0.75 CPU limits. Reclaimed processing jobs resume after a worker restart under a PostgreSQL session advisory lock. Temporary files are removed at completion/failure. Normal PostgreSQL dumps now include original PDFs. These sources remain until an administrator deletes them; expiry stops retrieval but does not delete the files.
Management routes: /manage/api/documents (list/raw-PDF upload), /{id} (detail/settings/delete), /{id}/file (private original), /{id}/sections/{section_id} (review correction), and /{id}/publish|unpublish|retry|search. Mutations require dashboard session, same-origin request, and CSRF token. Existing 64 KB body limits remain except authenticated PDF uploads (32 MB).
Administrator CRUD
Section titled “Administrator CRUD”Open Akun administrator to create, search/read, edit, enable/disable, or delete dashboard logins. New users receive an unguessable generated password that is never displayed. After creation, use the existing Buat tautan reset kata sandi control to let the owner set a password. Links remain single-use and valid for 30 minutes. Sharing opens the admin’s chosen application for manual sending; no automatic messages or email deliveries are performed.
Creating an account grants the full administrator role. For a person already registered as a member, manage that existing profile and dashboard login through Anggota & akses, avoiding duplicate phone identities. Profile/name/email/phone/username are editable; changing contacts/username or disabling a login revokes sessions and outstanding reset links. An inactive member must be reactivated in the profile before enabling a login.
You cannot disable/delete your current login or remove the last available active administrator. Deleting a login revokes its sessions/reset links and removes the dashboard account, while preserving member identity, member role, tickets, cases, and audit history. To revoke the member’s admin role or WhatsApp access as well, use Anggota & akses. This feature manages helpdesk dashboard credentials, not App Hub accounts.
Verification and rollback
Section titled “Verification and rollback”Run the disposable database suite with docker compose -f compose.test.yaml run --rm tests; never point tests or fixture seeders at production. scripts/check_pdf_admin_browser.py exercises upload, review, publication, correction, grounded retrieval, admin CRUD, and responsive layouts against synthetic staging only. OCR tests use an actual generated scanned PDF and local Tesseract.
Pre-deployment source is in /opt/dirman-assist/code-backups/before-pdf-admin/app; a protected PostgreSQL dump was taken before migration. A rollback can stop pdf-worker, restore that app source, rebuild, and recreate only API/worker/dashboard. New additive tables/columns can stay in place; prior code ignores them. Before rolling back retrieval, withdraw document sections or set faq.approved=false WHERE document_id IS NOT NULL, so prior code cannot use them without document lifecycle checks. Do not drop project data or restart the shared proxy, database, or WAHA as part of a routine code rollback.