"""
LLM 模型配置
"""
from sqlalchemy import Column, String, Integer, Float, Boolean, Numeric

from app.base_model import BaseModel


class LLMModel(BaseModel):
    """
    LLM 模型配置
    
    每个提供商可以配置多个模型
    """
    __tablename__ = "ai_llm_model"
    
    provider_id = Column(String(21), nullable=False, index=True, comment="所属提供商ID（逻辑外键关联ai_llm_provider）")
    model_name = Column(String(100), nullable=False, comment="模型名称（API 调用时使用）")
    display_name = Column(String(100), nullable=False, comment="显示名称")
    model_type = Column(String(20), default="chat", comment="模型类型: chat/completion/embedding/rerank")
    max_tokens = Column(Integer, default=4096, comment="最大 Token 数")
    context_window = Column(Integer, default=4096, comment="上下文窗口大小")
    default_temperature = Column(Float, default=0.7, comment="默认温度参数")
    default_top_p = Column(Float, default=1.0, comment="默认 top_p 参数")
    input_price = Column(Numeric(10, 6), default=0, comment="输入价格（每 1K tokens）")
    output_price = Column(Numeric(10, 6), default=0, comment="输出价格（每 1K tokens）")
    is_active = Column(Boolean, default=True, comment="是否启用")
    supports_vision = Column(Boolean, default=False, comment="是否支持视觉（图片输入）")
    supports_function_call = Column(Boolean, default=False, comment="是否支持函数调用")
    supports_streaming = Column(Boolean, default=True, comment="是否支持流式输出")
