feat: initial microservices project structure
Services: - api: FastAPI gateway with JWT auth, async endpoints, WebSocket - worker-gpu: CUDA sentence-transformers, FAISS IVFFlat, Ollama LLM - worker-indexer: Winnowing+MinHash plagiarism detection, PDF/DOCX extraction - worker-notifier: SMTP email notifications - worker-gost: GOST 7.1-2003 and GOST R 7.0.5-2008 formatting Infrastructure: - docker-compose.yml (production) + docker-compose.dev.yml (hot reload) - Nginx reverse proxy + WebSocket support - PostgreSQL 16 with Alembic migrations - Elasticsearch 8 with Russian/English analyzers - MinIO, RabbitMQ, Redis, Ollama Frontend: - React 18 + Vite + TypeScript + TailwindCSS + Zustand + React Query v5 - 9 pages: Home, Search, Cabinet, Task, Check, Bibliography, Pricing, Login, Register Scripts: - Parser stubs: OpenAlex, КиберЛенинка, arXiv (Phase 0 - to be filled) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
46
services/api/app/schemas/reports.py
Normal file
46
services/api/app/schemas/reports.py
Normal file
@@ -0,0 +1,46 @@
|
||||
"""Схемы для отчётов о плагиате и результатов поиска."""
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class PlagiarismMatch(BaseModel):
|
||||
"""Совпадение фрагмента с источником."""
|
||||
|
||||
fragment: str
|
||||
position_start: int
|
||||
position_end: int
|
||||
similarity: float = Field(ge=0.0, le=100.0, description="Схожесть в процентах")
|
||||
method: str = Field(description="Метод обнаружения: exact, fuzzy, semantic+llm")
|
||||
confidence: float | None = Field(default=None, ge=0.0, le=1.0)
|
||||
reason: str | None = None
|
||||
source_title: str
|
||||
source_url: str | None = None
|
||||
source_db: str = Field(description="База данных: openalex, cyberleninka, arxiv, и т.д.")
|
||||
|
||||
|
||||
class PlagiarismReport(BaseModel):
|
||||
"""Полный отчёт о плагиате."""
|
||||
|
||||
task_id: str
|
||||
overall_similarity: float = Field(ge=0.0, le=100.0)
|
||||
matches: list[PlagiarismMatch] = Field(default_factory=list)
|
||||
total_fragments: int
|
||||
flagged_fragments: int
|
||||
checked_at: datetime
|
||||
|
||||
|
||||
class SearchResult(BaseModel):
|
||||
"""Источник в результатах поиска."""
|
||||
|
||||
id: int
|
||||
title: str
|
||||
authors: list[dict] = Field(default_factory=list)
|
||||
year: int | None = None
|
||||
journal: str | None = None
|
||||
abstract: str | None = None
|
||||
url: str | None = None
|
||||
relevance_score: float = Field(ge=0.0, le=1.0)
|
||||
gost_citation: str = Field(description="Отформатированная ГОСТ-цитата")
|
||||
source_db: str
|
||||
Reference in New Issue
Block a user