AI Configuration
Use Konfigurasi AI in the admin dashboard. Unsaved edits are drafts. Simpan & aktifkan creates an audited version applied to subsequent model requests; an already-running request keeps the settings it started with. Concurrent admin saves are rejected with a conflict rather than overwriting a newer configuration.
Models and generation settings
Section titled “Models and generation settings”The allowed models are gemma-4-26b-a4b-it and gemma-4-31b-it. No arbitrary model/provider URL, API key, paid fallback or credential field is exposed. Default model remains 26B. The Google API key stays in the existing API/worker environment; the public dashboard retains only its existing database configuration.
Google’s Gemma API documentation specifies minimal for thinking off and high for thinking on. Low/medium levels and thinkingBudget are not offered here. Responses expose only final answers; provider parts marked as thoughts are filtered and never replayed into conversation history or displayed in the test UI.
Application defaults preserve the prior generation settings: thinking off, temperature0.2, output budget450. Optional Top-P/Top-K are omitted from API calls when blank; provider metadata at inspection reported defaults0.95/64. Supported dashboard ranges are application bounds, not claims of the model’s absolute maximum: temperature0–2, Top-P greater than0 up to1, Top-K1–64, output128–8192. Thinking on requires at least2048 output tokens in this app to leave room for an answer; selecting thinking on or switching to31B raises a smaller draft budget to2048. Administrators should test any nondefault settings before activating them.
High thinking can consume more tokens and take longer. The worker allows120s for a high-thinking request, otherwise the existing30s text/75s image timeout applies. Existing Google provider quotas, persisted429 cooldown and requester throttles remain intact. No local thinking traces are stored. JSON parsing and length limits still reject malformed or overlong final answers safely.
Live generic probes: 26B returned valid helpdesk replies with thinking off and on, including explicit Top-P/Top-K settings. 31B initially produced no usable reply with a450-token budget, then returned HTTP200/STOP and valid JSON with2048 tokens. This is a point-in-time check, not an availability guarantee. An unrelated poetry prompt selected scope unrelated. No WhatsApp messages or ticket actions were sent by these probes.
Structured system prompt
Section titled “Structured system prompt”Ten required editable sections cover identity/objective, scope, grounding/uncertainty, support workflow, continuity, ticket actions/consent, privacy, language/style, refusal/escalation and examples. Each section shows its default example and a restore control. Sections require20–3000 characters each and at most14000 total; missing sections, unexpected setting fields and recognizable Google key literals are rejected.
Fixed system rules are appended after the editable guidance, followed by the mode-specific JSON contract. These include P3MDI scope, factual accuracy, sensitive-data handling, untrusted inputs and action boundaries. These prompt rules do not replace backend enforcement: ticket ownership/consent, allowed action enums, admin authentication and credential restrictions remain code-enforced. Backend-generated refusals, quota messages and ticket receipts keep their existing wording. Prompt edits do not grant access to user profiles, staff notes, arbitrary tools or account changes.
Pratinjau prompt draf validates and assembles the current unsaved draft without contacting Google. Choose text/ticket mode or screenshot mode. Screenshot mode adds its image guardrail and excludes the ticket action contract. Contoh default system prompt lengkap always shows the built-in text/action example, independently of custom edits. A copy of that example is in default-system-prompt.md, generated from the same compiler/defaults.
Loading a previous revision fills a draft only. Saving it creates a new version, preserving the intervening history. Restore-all defaults is also a draft operation. The UI lists the latest50 revision records; revisions remain accessible by ID to admins. The model receives approved FAQ/current question and bounded15-exchange memory as before; neither the history size nor archive retention is editable through the prompt.
Test without sending
Section titled “Test without sending”The test UI now offers an opt-in Gunakan pengetahuan terbit pada uji ini checkbox. When enabled, the worker retrieves eligible public knowledge, applies the same grounding/citation checks and returns a sourced dry-run answer. It still supplies no real user history, executes no ticket actions and sends no messages. See knowledge retrieval.
Uji draf queues a private worker test using the draft configuration and sample question. It supplies no real user history or case FAQ and never invokes the ticket executor, case archive or WhatsApp sender. It may display the action the model proposes, clearly marked as a dry run. Tests use the actual Google quota/backoff when run in production. The dashboard itself does not call Google or receive the key.
The test queue holds at most5 requests, with5 submissions per admin per minute. Normal bot jobs take priority. Only the requesting active admin can read the result. Test data expires after1h and is excluded from reads immediately on expiry; hourly cleanup removes it. The sample question is sanitized before queuing and cleared after completion. The UI polls up to3min; under load, the test may remain queued longer. Tests and previews do not publish settings.
Validation and rollout
Section titled “Validation and rollout”Coverage includes parameter delivery, thought filtering, required/default sections, fixed-rule compilation, active configuration loading, revision saves/restores, stale edits, missing-pointer initialization, CSRF/auth, private/expired tests, rate limits and dry-run isolation. Synthetic staging browser checks cover section examples/restores, both preview modes, save/persistence, queued dry runs, default/revision restoration and mobile widths; staging model results are stubbed, while real Google behavior is checked separately with generic probes.
Schema changes are additive. Schema migrations take a transaction advisory lock to serialize API/worker/dashboard startup. Back up the database and preserve source under server code-backups/before-ai-settings/app before recreating API, worker and dashboard. WAHA/PostgreSQL/shared proxy remain running. Rollback source can be restored and rebuilt without dropping the new configuration tables; old application code resumes its former static defaults. No synthetic production users/tickets or test WhatsApp messages are required for deployment verification.
Context and consecutive messages
Section titled “Context and consecutive messages”The model still receives up to fifteen exchanges. Short turns are preserved. Longer turns retain their beginning and end, with an explicit truncation marker. The latest four turns receive larger text budgets. The received-message archive retains the original messages.
Retrieval sends up to 12 catalog topics, grouping sections under their source PDF title. Evidence is bounded to 10,000 serialized characters and deduplicates identical passage text from the same source with matching applicability. Full selected passages retain their citations.
Ordinary WhatsApp text receives a three-second collection window. Up to six consecutive messages from the same member and case can form one request, bounded to 2,000 characters. Commands, screenshots, handoff, ticket language, confirmations, cancellations, unsafe content, and pending ticket confirmations preserve individual processing. A member’s earliest queued job gates later processing. Original inbound messages remain in the case transcript. Earlier grouped jobs reference the final job through merged_into and display a grouped message state. The final message receives the answer.
Retries preserve the group’s input messages and roll back partial database effects. A human takeover still suppresses AI delivery. API requests retain immediate individual processing. Usage monitoring counts actual provider calls rather than treating each grouped WhatsApp message as a separate AI call.
Cloudflare Gemma fallback
Section titled “Cloudflare Gemma fallback”Cloudflare-hosted @cf/google/gemma-4-26b-a4b-it is an optional fallback for Google quota exhaustion, transient service errors, and transport failures. Google model-specific quota rolling happens first. Google validation, authentication, permission, and successful content-filter responses preserve their existing handling. Explicit Google draft tests stay on the selected model.
The adapter preserves system instructions, conversation history, screenshot bytes, and JSON output instructions. Backend scope, ticket consent, access checks, and citation validation still apply to the returned response. Temperature, top-P, output token limits, and the thinking template flag are forwarded. Top-K is Google-only.
A configured fallback reserves part of the request deadline for Cloudflare. The worker applies local request caps and Cloudflare backoff. Cloudflare error 3036 pauses this provider until the next UTC midnight. No WhatsApp message is sent by the setup test.
Create a Workers AI token with Workers AI Read and Edit permissions scoped to the intended account. Use a Workers Free account to retain Cloudflare’s hard daily free allowance. Setup asks the operator to confirm that plan. Paid accounts can incur charges above their free allocation.
Run these commands from an interactive SSH session.
cd /opt/dirman-assistpython3 scripts/configure_cloudflare.pyThe script accepts the Account ID and a hidden token. It verifies a small synthetic JSON generation before saving credentials atomically to the server’s private .env file. It then restarts only the API and worker and records a credential-free status for the dashboard. A successful connection test confirms basic account, model, and JSON access. Full screenshot and helpdesk validation requires a configured provider.
Runtime usage is stored under cloudflare/@cf/google/gemma-4-26b-a4b-it and appears in Konfigurasi AI > Penggunaan. The Cloudflare daily counters use UTC. The shared historical chart uses Pacific dates, as labeled. Remaining Neurons are checked in Cloudflare’s account dashboard because response token counts do not directly measure the account’s remaining free allocation.
Cloudflare stays inactive until CLOUDFLARE_ACCOUNT_ID, CLOUDFLARE_API_TOKEN, CLOUDFLARE_AI_ENABLED=true, and CLOUDFLARE_FREE_PLAN_CONFIRMED=true are configured. Keep credentials on the server. The dashboard receives status and usage only.