Skip to content

Commit f812620

Browse files
JOYclaude
andcommitted
docs: update architecture with Telegram document images, model alias mapping, Vision tier fix, LLM fallback
- Telegram bot now handles document images preserving EXIF/C2PA metadata - api.dos.ai Worker maps model aliases (FP8, GPTQ, qwen3.5-35b) to dos-ai - Google Vision reverse search prioritizes exact/partial over visually similar - LLM fallback chain via LLM_FALLBACK_PROVIDERS env var with cost logging Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 863141c commit f812620

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

DOSafe-Architecture.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ Written to by: DOS-Me Trust API (`/trust/flags/:id/attest`). Read by: DOSafe (`d
105105

106106
Both models are natively multimodal (text + image). Auth: `INTERNAL_API_KEY` via `api.dos.ai` gateway (bypasses billing). Fallback: Alibaba Cloud `qwen3.5-flash` when vLLM is unavailable.
107107

108+
**Model alias mapping:** The `api.dos.ai` Worker maps common model aliases to the served model name. `Qwen/Qwen3.5-35B-A3B-FP8`, `Qwen/Qwen3.5-35B-A3B-GPTQ-Int4`, and `qwen3.5-35b` all resolve to `dos-ai` (the vLLM `--served-model-name`). Clients don't need to know the exact deployed model variant.
109+
108110
---
109111

110112
## Cross-Product API Patterns
@@ -482,10 +484,13 @@ Input: { entityType, entityId }
482484
### 5. Telegram Bot (`supabase/functions/dosafe-telegram`)
483485

484486
Commands: `/detect`, `/scam`, `/phone`, `/quota`, `/help`, `/start`
485-
Auto-detection: URLs, phone numbers, plain text, photos
487+
Auto-detection: URLs, phone numbers, plain text, photos + document images
486488
Bilingual: Vietnamese + English (auto-detected)
487489
Quota: 20 checks/day per chat
488490
Calls: `dosafe.io/api/*` internally (via `DOSAFE_API_URL` secret)
491+
Welcome: "DOSafe — Vệ Sĩ AI Của Bạn" / "Your AI Bodyguard"
492+
493+
**Document image handling:** The bot accepts images sent as documents (original quality files), not just compressed photos. This preserves EXIF and C2PA metadata which Telegram's photo compression strips, enabling accurate image provenance detection.
489494

490495
### 6. Chrome Extension (`apps/extension`) — v0.5.4
491496

@@ -710,6 +715,8 @@ The V1 URL pipeline used simple keyword matching (`hasScamTerms()`) on web searc
710715

711716
**Performance:** Web search runs parallel with Phase 1 (DB/on-chain/DOS.Me). Only LLM analysis waits for Phase 1 results. Total added latency: ~3–5s for full path (skipped on extension fast path).
712717

718+
**LLM Fallback:** When self-hosted vLLM is unavailable, falls back to Alibaba Cloud `qwen3.5-flash` (or other providers). Multi-provider fallback chain configured via `LLM_FALLBACK_PROVIDERS` env var (JSON array of `{name, baseUrl, apiKey, model}` entries). Fallback usage is logged as structured JSON (`event: llm_fallback_used`) with token count and cost estimate for internal cost monitoring.
719+
713720
---
714721

715722
## Database Layout
@@ -823,7 +830,7 @@ DOS_ME_TRUST_API_KEY=...
823830
- **C2PA:** Cryptographic content credentials (~40% of AI images have C2PA in 2026)
824831
- **EXIF:** Camera metadata + AI tool detection in Software field
825832
- **DCT:** JPEG quantization table analysis (camera-specific vs AI generic)
826-
- **Reverse search:** Google Cloud Vision WEB_DETECTION → Serper Lens fallback
833+
- **Reverse search:** Google Cloud Vision WEB_DETECTION → Serper Lens fallback. Vision returns 3 tiers: `fullMatchingImages` (exact), `partialMatchingImages` (cropped/resized), `pagesWithMatchingImages` (visually similar). Prioritizes exact/partial matches; only falls back to visually similar if none found. Bot only displays exact/partial matches as "sources found" to avoid misleading citations.
827834
- **LLM visual:** Multimodal rubric analysis — Qwen3.5-35B (natively multimodal, no separate VL model needed)
828835

829836
---

0 commit comments

Comments
 (0)