feat: add document translation via DIFY AI API
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>
This commit is contained in:
@@ -371,7 +371,7 @@ async def root():
|
||||
|
||||
|
||||
# Include V2 API routers
|
||||
from app.routers import auth, tasks, admin
|
||||
from app.routers import auth, tasks, admin, translate
|
||||
from fastapi import UploadFile, File, Depends, HTTPException, status
|
||||
from sqlalchemy.orm import Session
|
||||
import hashlib
|
||||
@@ -385,6 +385,7 @@ from app.services.task_service import task_service
|
||||
app.include_router(auth.router)
|
||||
app.include_router(tasks.router)
|
||||
app.include_router(admin.router)
|
||||
app.include_router(translate.router)
|
||||
|
||||
|
||||
# File upload endpoint
|
||||
|
||||
Reference in New Issue
Block a user