12 lines
446 B
Python
12 lines
446 B
Python
"""聊天策略模块。"""
|
|
|
|
from app.core.config import settings
|
|
from app.core.errors import AppError
|
|
|
|
|
|
def validate_text_message(*, modality: str, content: str) -> None:
|
|
if modality != "text":
|
|
raise AppError("unsupported_media_type", "当前阶段仅支持文本消息。")
|
|
if len(content.encode("utf-8")) > settings.max_text_message_bytes:
|
|
raise AppError("payload_too_large", "单条文本消息超过大小限制。")
|