from typing import Literal from pydantic import BaseModel, Field, model_validator class CubeReportFileInput(BaseModel): id: str = Field(min_length=1) name: str = Field(min_length=1, max_length=255) type: Literal["custom", "document", "image"] = "custom" class SendCubeReportMessageRequest(BaseModel): content: str = Field(default="", max_length=8000) conversationId: str | None = None tenantId: str | None = Field(default=None, max_length=64) tenantName: str | None = Field(default=None, max_length=200) files: list[CubeReportFileInput] = Field(default_factory=list, max_length=5) @model_validator(mode="after") def validate_content(self): if not self.content.strip() and not self.files: raise ValueError("消息内容和附件不能同时为空") return self class RenameCubeReportConversationRequest(BaseModel): name: str = Field(min_length=1, max_length=200)