228 lines
9.6 KiB
Markdown
228 lines
9.6 KiB
Markdown
# DiDi LOT 1 — Comenzi de testare per componentă
|
|
|
|
Host: **10.11.10.18**. Toate comenzile sunt `curl` copy-paste. Statusul din dreptul
|
|
fiecăreia e rezultatul verificat la ultima rulare.
|
|
|
|
> Convenție: `H=10.11.10.18`. Rulează întâi `export H=10.11.10.18`.
|
|
|
|
---
|
|
|
|
## 0. Pregătire fișiere de test (o singură dată)
|
|
|
|
```bash
|
|
export H=10.11.10.18
|
|
cd /home/topclossers/didi-lot1-ai/ai_platform/local_gpu_stack
|
|
mkdir -p test_assets
|
|
# video mic din artefacte
|
|
cp "$(find ../../artefacte_lot1/runs_deepfake -iname '*.mp4' -printf '%s\t%p\n' | sort -n | head -1 | cut -f2)" test_assets/sample.mp4
|
|
# extrage un cadru (jpg) + audio (wav) cu ffmpeg din containerul extractors
|
|
docker cp test_assets/sample.mp4 didiAI-extractors:/tmp/s.mp4
|
|
docker exec didiAI-extractors sh -c 'ffmpeg -y -i /tmp/s.mp4 -frames:v 1 /tmp/frame.jpg -vn -ar 16000 -ac 1 -t 8 /tmp/audio.wav'
|
|
docker cp didiAI-extractors:/tmp/frame.jpg test_assets/frame.jpg
|
|
docker cp didiAI-extractors:/tmp/audio.wav test_assets/audio.wav
|
|
cd test_assets # restul comenzilor presupun că ești aici pentru fișiere
|
|
```
|
|
|
|
---
|
|
|
|
## 1. LLM — Qwen3.5-35B-A3B (port 14011) ✅
|
|
|
|
```bash
|
|
# modele servite
|
|
curl -s http://$H:14011/v1/models | python3 -m json.tool
|
|
|
|
# chat completion
|
|
curl -s http://$H:14011/v1/chat/completions -H 'Content-Type: application/json' -d '{
|
|
"model":"qwen3.5",
|
|
"messages":[{"role":"user","content":"Ce este un deepfake? Raspunde scurt."}],
|
|
"max_tokens":200
|
|
}' | python3 -m json.tool
|
|
|
|
# health
|
|
curl -s http://$H:14011/health
|
|
```
|
|
> Notă: Qwen3.5 e model de **reasoning** — răspunsul conține un bloc „Thinking" înainte de
|
|
> răspunsul final. Normal.
|
|
|
|
## 2. Embeddings — bge-m3 (port 14100) ✅
|
|
|
|
```bash
|
|
curl -s http://$H:14100/v1/embeddings -H 'Content-Type: application/json' -d '{
|
|
"model":"bge-m3","input":"text de analizat"
|
|
}' | python3 -c "import sys,json;print('dim:',len(json.load(sys.stdin)['data'][0]['embedding']))"
|
|
```
|
|
> Așteptat: `dim: 1024`.
|
|
|
|
## 3. Rerank — bge-reranker-v2-m3 (port 14200) ✅
|
|
|
|
```bash
|
|
curl -s http://$H:14200/v1/rerank -H 'Content-Type: application/json' -d '{
|
|
"model":"bge-reranker-v2-m3",
|
|
"query":"detectie deepfake",
|
|
"documents":["o pisica neagra","sistem de detectie deepfake pentru video"]
|
|
}' | python3 -m json.tool
|
|
```
|
|
> Așteptat: documentul relevant primește scor mult mai mare (index 1).
|
|
|
|
## 4. Audio / Whisper — large-v3-turbo (port 54300) ✅
|
|
|
|
```bash
|
|
curl -s http://$H:54300/v1/audio/transcriptions \
|
|
-F "file=@audio.wav" -F "model=large-v3-turbo" | python3 -m json.tool
|
|
# modele / info
|
|
curl -s http://$H:54300/v1/models | python3 -m json.tool
|
|
```
|
|
> Acceptă și `.mp4` direct (ffmpeg în container). Returnează `text` + `language`.
|
|
|
|
## 5. Video / BusterX++ (deepfake) (port 54600) ✅
|
|
|
|
```bash
|
|
# verdict deepfake REAL/FAKE/UNCERTAIN
|
|
curl -s http://$H:54600/analyze/video -F "file=@sample.mp4" | python3 -m json.tool
|
|
|
|
# analiza semantica (descriere continut, foloseste si LLM-ul)
|
|
curl -s http://$H:54600/analyze/video/semantic -F "file=@sample.mp4" | python3 -m json.tool
|
|
|
|
curl -s http://$H:54600/v1/info | python3 -m json.tool
|
|
```
|
|
> Așteptat: `{"verdict":"REAL"|"FAKE"|"UNCERTAIN","frames_analyzed":16,"evidence":[...]}`.
|
|
|
|
## 6. Extractors (port 54400)
|
|
|
|
```bash
|
|
# 6a. metadata: EXIF/ELA/ffprobe/integritate/C2PA ✅
|
|
curl -s http://$H:54400/v1/metadata -F "file=@sample.mp4" | python3 -m json.tool
|
|
|
|
# 6b. NER (GLiNER, multilingv) ✅
|
|
curl -s http://$H:54400/v1/ner -H 'Content-Type: application/json' -d '{
|
|
"text":"Klaus Iohannis s-a intalnit cu Emmanuel Macron la Bucuresti."
|
|
}' | python3 -m json.tool
|
|
|
|
# 6c. detectie obiecte (YOLOv8) ✅
|
|
curl -s http://$H:54400/v1/detect -F "file=@frame.jpg" | python3 -m json.tool
|
|
|
|
# 6d. OCR (LLM vision) ✅
|
|
curl -s http://$H:54400/v1/ocr -F "file=@frame.jpg" | python3 -m json.tool
|
|
|
|
# 6e. sentiment (deleaga LLM) ✅
|
|
curl -s http://$H:54400/v1/sentiment -H 'Content-Type: application/json' -d '{
|
|
"text":"Produsul este excelent, sunt foarte multumit!"
|
|
}' | python3 -m json.tool
|
|
```
|
|
> Așteptat: `{"ok":true,"results":{"label":"pozitiv","score":0.9,"rationale":"..."}}`.
|
|
> (Gateway-ul LLM injectează `enable_thinking:false` pe vLLM → JSON curat din modelul de reasoning.)
|
|
|
|
## 7. Forensic — rPPG / lip-sync / forgery / lighting (port 8085) ✅
|
|
|
|
```bash
|
|
# module disponibile
|
|
curl -s http://$H:8085/api/forensic-modules | python3 -m json.tool
|
|
|
|
# analiza forensica (multipart; campul fisierului se numeste 'video')
|
|
curl -s http://$H:8085/api/forensic-evidence \
|
|
-F "video=@sample.mp4" -F "modules=m25,m26,m27,m28,m29" -F "every_n_frames=10" \
|
|
| python3 -m json.tool
|
|
```
|
|
> Rulează sincron implicit; returnează `modules_run`, `n_frames_extracted`, evidence per modul.
|
|
> Pentru async: adaugă `-F "async_mode=true"` → primești `job_id`, apoi
|
|
> `GET /api/status/{job_id}` și `GET /api/result/{job_id}`.
|
|
|
|
## 8. Web — căutare & fact-checking evidence (port 51100) ✅
|
|
|
|
```bash
|
|
# cautare (SearXNG + provideri); ATENTIE: campul e "queries" (lista)
|
|
curl -s http://$H:51100/v1/search -H 'Content-Type: application/json' -d '{
|
|
"queries":["deepfake detection 2024"],"max_results":5
|
|
}' | python3 -m json.tool
|
|
|
|
# fetch pagini (camp "urls" = LISTA)
|
|
curl -s http://$H:51100/v1/fetch -H 'Content-Type: application/json' -d '{
|
|
"urls":["https://en.wikipedia.org/wiki/Deepfake"]
|
|
}' | python3 -m json.tool
|
|
|
|
# gather (cautare + fetch + evidence pack); camp "claim", max_search_results >= 5
|
|
curl -s http://$H:51100/v1/gather -H 'Content-Type: application/json' -d '{
|
|
"claim":"Deepfakes can be detected by AI","max_search_results":5
|
|
}' | python3 -m json.tool
|
|
|
|
curl -s http://$H:51100/v1/info | python3 -m json.tool
|
|
```
|
|
|
|
## 9. Catalog — service discovery (port 11000, doar prin gateway/intern) ✅
|
|
|
|
`catalog-api` nu e publicat pe host; se accesează prin **gateway** (Bearer) sau din rețea.
|
|
|
|
```bash
|
|
TOK=didi-local-dev-token-123
|
|
curl -s http://$H:11000/catalog/v1/status -H "Authorization: Bearer $TOK" | python3 -m json.tool
|
|
curl -s http://$H:11000/catalog/v1/components -H "Authorization: Bearer $TOK" | python3 -m json.tool
|
|
curl -s http://$H:11000/catalog/v1/models -H "Authorization: Bearer $TOK" | python3 -m json.tool
|
|
```
|
|
|
|
## 10. Gateway — nginx reverse proxy + auth (port 11000) ✅
|
|
|
|
```bash
|
|
TOK=didi-local-dev-token-123
|
|
curl -s http://$H:11000/health # fara auth -> ok
|
|
curl -s http://$H:11000/web/v1/info -H "Authorization: Bearer $TOK" # rutare -> web
|
|
curl -s http://$H:11000/catalog/v1/status -H "Authorization: Bearer $TOK" # rutare -> catalog
|
|
curl -s http://$H:11000/web/v1/info # fara token -> 401
|
|
```
|
|
|
|
## 11. Brain — RAG + fact-checking + cache (port 8090) ✅
|
|
|
|
```bash
|
|
# cautare in baza de cunostinte (contract web; camp "queries")
|
|
curl -s http://$H:8090/v1/search -H 'Content-Type: application/json' -d '{
|
|
"queries":["deepfake"],"max_results":3
|
|
}' | python3 -m json.tool
|
|
|
|
# gather (RAG complet: search -> fetch -> evidence); camp "claim"
|
|
curl -s http://$H:8090/v1/gather -H 'Content-Type: application/json' -d '{
|
|
"claim":"Deepfakes can be detected by AI"
|
|
}' | python3 -m json.tool
|
|
|
|
# statistici atom store (folosit de dashboard "Brain — fact status")
|
|
curl -s http://$H:8090/v1/analysis_atom/stats/extended | python3 -m json.tool
|
|
|
|
curl -s http://$H:8090/health
|
|
```
|
|
> `results: []` la început e normal — baza de cunoștințe e goală până se indexează conținut.
|
|
|
|
---
|
|
|
|
## Smoke-test rapid (toate componentele, un singur script)
|
|
|
|
```bash
|
|
export H=10.11.10.18; TOK=didi-local-dev-token-123
|
|
ok(){ printf "%-26s %s\n" "$1" "$2"; }
|
|
ok "llm" "$(curl -s -m60 http://$H:14011/v1/chat/completions -H 'Content-Type: application/json' -d '{"model":"qwen3.5","messages":[{"role":"user","content":"hi"}],"max_tokens":5}' -o /dev/null -w %{http_code})"
|
|
ok "embeddings" "$(curl -s -m20 http://$H:14100/v1/embeddings -H 'Content-Type: application/json' -d '{"model":"bge-m3","input":"x"}' -o /dev/null -w %{http_code})"
|
|
ok "rerank" "$(curl -s -m20 http://$H:14200/v1/rerank -H 'Content-Type: application/json' -d '{"model":"bge-reranker-v2-m3","query":"a","documents":["a","b"]}' -o /dev/null -w %{http_code})"
|
|
ok "audio" "$(curl -s -m10 http://$H:54300/health -o /dev/null -w %{http_code})"
|
|
ok "video" "$(curl -s -m10 http://$H:54600/health -o /dev/null -w %{http_code})"
|
|
ok "extractors" "$(curl -s -m10 http://$H:54400/health -o /dev/null -w %{http_code})"
|
|
ok "forensic" "$(curl -s -m10 http://$H:8085/health -o /dev/null -w %{http_code})"
|
|
ok "web" "$(curl -s -m10 http://$H:51100/health -o /dev/null -w %{http_code})"
|
|
ok "gateway" "$(curl -s -m10 http://$H:11000/health -o /dev/null -w %{http_code})"
|
|
ok "catalog" "$(curl -s -m10 http://$H:11000/catalog/v1/status -H "Authorization: Bearer $TOK" -o /dev/null -w %{http_code})"
|
|
ok "brain" "$(curl -s -m10 http://$H:8090/health -o /dev/null -w %{http_code})"
|
|
# 200 peste tot = totul up
|
|
```
|
|
|
|
---
|
|
|
|
## Probleme rezolvate (istoric)
|
|
- **sentiment / output JSON** ✅ — gateway-ul LLM injectează acum `enable_thinking:false`
|
|
pe vLLM (`LLM_VLLM_DISABLE_THINKING`, default true), deci modelul de reasoning întoarce
|
|
JSON curat pentru sentiment/OCR/semantic/brain.
|
|
- **catalog `degraded`** ✅ — aliniat prin `CATALOG_LLM_URL/AUDIO_URL/VIDEO_URL/WEB_URL`
|
|
în compose → acum `healthy`.
|
|
- **brain taxonomy 401** ✅ — creat token atomic (`atomic-server token create`), setat
|
|
`ATOMIC_TOKEN`, seed-uită taxonomia (79 tag-uri în atomic), parolele postgres aliniate
|
|
(`infra/.env`). Scheduler-ul feed-uiește acum cu `errors=0`.
|
|
|
|
## Rămas minor (non-blocant)
|
|
- **atomic embeddings** — atomic-server logează „OpenRouter API key not configured, skipping
|
|
embedding". Atomic-server și-ar face vectori proprii prin OpenRouter; nu e nevoie — brain
|
|
folosește bge-m3 local pentru embeddings. Doar un warning în logul atomic.
|