Initial commit: O2O 저작권 침해 여부 탐지 API
PDF v1.2 요구사항 반영 완료: - 10종 법령 메타 태그 + 39개 케이스 분류체계 - 3단 캐스케이딩: MinHash+LSH → 삼중 유사도 → 분류 - 자서전 특화: 공통 표현 사전 제거 + NER 마스킹 - KoSimCSE 한국어 임베딩 (자체 산출물 방어) - 보수적 임계값 0.85 - 검토 콘솔 UI (탐지 + 코퍼스 관리 탭) - Docker 배포 패키지 + 31개 테스트 통과
This commit is contained in:
commit
3b69bdf0f0
50 files changed
+4662
No files matched your search
@@ -0,0 +1,64 @@
|
||||
"""스모크 테스트. `pip install fastapi httpx pytest` 후 실행."""
|
||||
from __future__ import annotations
|
||||
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from app.main import app
|
||||
|
||||
API_KEY = "combooks-key-change-me"
|
||||
|
||||
|
||||
def test_health():
|
||||
with TestClient(app) as client:
|
||||
resp = client.get("/v1/health")
|
||||
assert resp.status_code == 200
|
||||
body = resp.json()
|
||||
assert body["status"] == "ok"
|
||||
assert body["corpus_size"] >= 0
|
||||
|
||||
|
||||
def test_detect_requires_api_key():
|
||||
with TestClient(app) as client:
|
||||
resp = client.post(
|
||||
"/v1/plagiarism/detect",
|
||||
json={"doc_id": "x", "text": "테스트 본문"},
|
||||
)
|
||||
assert resp.status_code == 401
|
||||
|
||||
|
||||
def test_detect_returns_schema():
|
||||
with TestClient(app) as client:
|
||||
resp = client.post(
|
||||
"/v1/plagiarism/detect",
|
||||
json={
|
||||
"doc_id": "t-1",
|
||||
"text": "어린왕자는 작은 별에서 온 소년이다. 그는 여우를 만나 길들임을 배운다.",
|
||||
},
|
||||
headers={"X-API-Key": API_KEY},
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
body = resp.json()
|
||||
assert body["doc_id"] == "t-1"
|
||||
assert "matches" in body
|
||||
assert "extracted_elements" in body
|
||||
assert "engine_version" in body
|
||||
|
||||
|
||||
def test_batch_flow():
|
||||
with TestClient(app) as client:
|
||||
resp = client.post(
|
||||
"/v1/plagiarism/batch",
|
||||
json={
|
||||
"items": [
|
||||
{"doc_id": "b-1", "text": "앤 셜리는 초록 지붕 집에 입양된 소녀다."},
|
||||
]
|
||||
},
|
||||
headers={"X-API-Key": API_KEY},
|
||||
)
|
||||
assert resp.status_code == 202
|
||||
job_id = resp.json()["job_id"]
|
||||
status = client.get(
|
||||
f"/v1/plagiarism/batch/{job_id}",
|
||||
headers={"X-API-Key": API_KEY},
|
||||
)
|
||||
assert status.status_code == 200
|
||||
Reference in new issue
Block a user