refactor: complete V1 to V2 migration and remove legacy architecture
Remove all V1 architecture components and promote V2 to primary: - Delete all paddle_ocr_* table models (export, ocr, translation, user) - Delete legacy routers (auth, export, ocr, translation) - Delete legacy schemas and services - Promote user_v2.py to user.py as primary user model - Update all imports and dependencies to use V2 models only - Update main.py version to 2.0.0 Database changes: - Fix SQLAlchemy reserved word: rename audit_log.metadata to extra_data - Add migration to drop all paddle_ocr_* tables - Update alembic env to only import V2 models Frontend fixes: - Fix Select component exports in TaskHistoryPage.tsx - Update to use simplified Select API with options prop - Fix AxiosInstance TypeScript import syntax 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,124 +0,0 @@
|
||||
"""
|
||||
Tool_OCR - Translation Schemas (RESERVED)
|
||||
Request/response models for translation endpoints
|
||||
"""
|
||||
|
||||
from typing import Optional, Dict, List, Any
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class TranslationRequest(BaseModel):
|
||||
"""
|
||||
Translation request schema (RESERVED)
|
||||
|
||||
Expected format for document translation requests
|
||||
"""
|
||||
file_id: int = Field(..., description="File ID to translate")
|
||||
source_lang: str = Field(..., description="Source language code (zh, en, ja, ko)")
|
||||
target_lang: str = Field(..., description="Target language code (zh, en, ja, ko)")
|
||||
engine_type: Optional[str] = Field("offline", description="Translation engine (offline, ernie, google, deepl)")
|
||||
preserve_structure: bool = Field(True, description="Preserve markdown structure")
|
||||
engine_config: Optional[Dict[str, Any]] = Field(None, description="Engine-specific configuration")
|
||||
|
||||
class Config:
|
||||
json_schema_extra = {
|
||||
"example": {
|
||||
"file_id": 1,
|
||||
"source_lang": "zh",
|
||||
"target_lang": "en",
|
||||
"engine_type": "offline",
|
||||
"preserve_structure": True,
|
||||
"engine_config": {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class TranslationResponse(BaseModel):
|
||||
"""
|
||||
Translation response schema (RESERVED)
|
||||
|
||||
Expected format for translation results
|
||||
"""
|
||||
task_id: int = Field(..., description="Translation task ID")
|
||||
file_id: int
|
||||
source_lang: str
|
||||
target_lang: str
|
||||
engine_type: str
|
||||
status: str = Field(..., description="Translation status (pending, processing, completed, failed)")
|
||||
translated_file_path: Optional[str] = Field(None, description="Path to translated markdown file")
|
||||
progress: float = Field(0.0, description="Translation progress (0.0-1.0)")
|
||||
error_message: Optional[str] = None
|
||||
|
||||
class Config:
|
||||
json_schema_extra = {
|
||||
"example": {
|
||||
"task_id": 1,
|
||||
"file_id": 1,
|
||||
"source_lang": "zh",
|
||||
"target_lang": "en",
|
||||
"engine_type": "offline",
|
||||
"status": "processing",
|
||||
"translated_file_path": None,
|
||||
"progress": 0.5,
|
||||
"error_message": None
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class TranslationStatusResponse(BaseModel):
|
||||
"""Translation task status response (RESERVED)"""
|
||||
task_id: int
|
||||
status: str
|
||||
progress: float
|
||||
created_at: str
|
||||
completed_at: Optional[str] = None
|
||||
error_message: Optional[str] = None
|
||||
|
||||
|
||||
class TranslationConfigRequest(BaseModel):
|
||||
"""Translation configuration request (RESERVED)"""
|
||||
source_lang: str = Field(..., max_length=20)
|
||||
target_lang: str = Field(..., max_length=20)
|
||||
engine_type: str = Field(..., max_length=50)
|
||||
engine_config: Optional[Dict[str, Any]] = None
|
||||
|
||||
class Config:
|
||||
json_schema_extra = {
|
||||
"example": {
|
||||
"source_lang": "zh",
|
||||
"target_lang": "en",
|
||||
"engine_type": "offline",
|
||||
"engine_config": {
|
||||
"model_path": "/path/to/model"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class TranslationConfigResponse(BaseModel):
|
||||
"""Translation configuration response (RESERVED)"""
|
||||
id: int
|
||||
user_id: int
|
||||
source_lang: str
|
||||
target_lang: str
|
||||
engine_type: str
|
||||
engine_config: Optional[Dict[str, Any]] = None
|
||||
created_at: str
|
||||
updated_at: str
|
||||
|
||||
|
||||
class TranslationFeatureStatus(BaseModel):
|
||||
"""Translation feature status response"""
|
||||
available: bool = Field(..., description="Whether translation is available")
|
||||
status: str = Field(..., description="Feature status (reserved, planned, implemented)")
|
||||
message: str = Field(..., description="Status message")
|
||||
supported_engines: List[str] = Field(default_factory=list, description="Currently supported engines")
|
||||
planned_engines: List[Dict[str, str]] = Field(default_factory=list, description="Planned engines")
|
||||
roadmap: Dict[str, Any] = Field(default_factory=dict, description="Implementation roadmap")
|
||||
|
||||
|
||||
class LanguageInfo(BaseModel):
|
||||
"""Language information"""
|
||||
code: str = Field(..., description="Language code (ISO 639-1)")
|
||||
name: str = Field(..., description="Language name")
|
||||
status: str = Field(..., description="Support status (planned, supported)")
|
||||
Reference in New Issue
Block a user