Implement document translation feature using DIFY AI API with batch processing: Backend: - Add DIFY client with batch translation support (5000 chars, 20 items per batch) - Add translation service with element extraction and result building - Add translation router with start/status/result/list/delete endpoints - Add translation schemas (TranslationRequest, TranslationStatus, etc.) Frontend: - Enable translation UI in TaskDetailPage - Add translation API methods to apiV2.ts - Add translation types Features: - Batch translation with numbered markers [1], [2], [3]... - Support for text, title, header, footer, paragraph, footnote, table cells - Translation result JSON with statistics (tokens, latency, batch_count) - Background task processing with progress tracking 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
50 lines
1.1 KiB
Python
50 lines
1.1 KiB
Python
"""
|
|
Tool_OCR - API Schemas (V2)
|
|
Pydantic models for request/response validation
|
|
"""
|
|
|
|
from app.schemas.auth import LoginRequest, Token, UserResponse
|
|
from app.schemas.task import (
|
|
TaskCreate,
|
|
TaskUpdate,
|
|
TaskResponse,
|
|
TaskDetailResponse,
|
|
TaskListResponse,
|
|
TaskStatsResponse,
|
|
TaskStatusEnum,
|
|
)
|
|
from app.schemas.translation import (
|
|
TranslationStatusEnum,
|
|
TranslationRequest,
|
|
TranslationProgress,
|
|
TranslationStatusResponse,
|
|
TranslationStartResponse,
|
|
TranslationStatistics,
|
|
TranslationResultResponse,
|
|
TranslationListResponse,
|
|
)
|
|
|
|
__all__ = [
|
|
# Auth
|
|
"LoginRequest",
|
|
"Token",
|
|
"UserResponse",
|
|
# Task
|
|
"TaskCreate",
|
|
"TaskUpdate",
|
|
"TaskResponse",
|
|
"TaskDetailResponse",
|
|
"TaskListResponse",
|
|
"TaskStatsResponse",
|
|
"TaskStatusEnum",
|
|
# Translation
|
|
"TranslationStatusEnum",
|
|
"TranslationRequest",
|
|
"TranslationProgress",
|
|
"TranslationStatusResponse",
|
|
"TranslationStartResponse",
|
|
"TranslationStatistics",
|
|
"TranslationResultResponse",
|
|
"TranslationListResponse",
|
|
]
|