from typing import Annotated, Dict, List from fastapi import Form, UploadFile from pydantic import BaseModel, model_validator class AnalysisRequest(BaseModel): analysis_type: str filters: Dict class AnalysisResponse(BaseModel): result: str class AvailableSource(BaseModel): display_name: str name: str format: str class AvailableSourcesResponse(BaseModel): sources: List[AvailableSource] class ConversionRequest(BaseModel): source_name: Annotated[str, Form()] source_format: Annotated[str, Form()] file: UploadFile def __init__( self, source_name: Annotated[str, Form()], source_format: Annotated[str, Form()], file: UploadFile, ): super().__init__( source_name=source_name, source_format=source_format, file=file ) @model_validator(mode="after") def validate(self): if not self.source_format: self.source_format = "txt" return self class ConversionResponse(BaseModel): converted_data: dict status: str class ExportRequest(BaseModel): filters: Dict format: str class ExportResponse(BaseModel): export_url: str status: str class GenerateRequest(BaseModel): prompt: str class GenerateResponse(BaseModel): content_url: str status: str class ImportRequest(BaseModel): type: str data: str class ImportResponse(BaseModel): status: str