from pydantic import BaseModel from typing import Dict, Any, List, Optional class TextRequest(BaseModel): """ Model yêu cầu sửa lỗi chính tả """ text: str options: Optional[Dict[str, Any]] = None class Correction(BaseModel): """ Model chi tiết sửa lỗi """ word: str suggestions: List[str] = [] start_position: int end_position: int class RepeatWarning(BaseModel): """ Model cảnh báo từ lặp """ word: str start_position: int end_position: int class CorrectionResponse(BaseModel): """ Model phản hồi sửa lỗi chính tả """ status: str = "success" # Trạng thái xử lý: success hoặc error has_errors: bool # True nếu phát hiện lỗi, False nếu không corrections: List[Correction] = [] warning: Optional[List[RepeatWarning]] = None