Watch
1
0
Fork
You've already forked Seyyed_arc
0
forked from hesabix/arc
Seyyed_arc/hesabixAPI/adapters/db/models/ai_provider_credential.py

27 lines
1.3 KiB
Python

from __future__ import annotations
from datetime import datetime
from sqlalchemy import Boolean, DateTime, String, Text, UniqueConstraint
from sqlalchemy.orm import Mapped, mapped_column
from adapters.db.session import Base
class AIProviderCredential(Base):
"""اعتبارنامه جداگانه برای هر provider (OpenAI، Anthropic، Local و ...)."""
__tablename__ = "ai_provider_credentials"
__table_args__ = (UniqueConstraint("provider", name="uq_ai_provider_credentials_provider"),)
id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
provider: Mapped[str] = mapped_column(String(50), nullable=False, index=True)
display_name: Mapped[str] = mapped_column(String(120), nullable=False)
api_base_url: Mapped[str | None] = mapped_column(String(500), nullable=True)
api_key: Mapped[str | None] = mapped_column(Text, nullable=True)
is_active: Mapped[bool] = mapped_column(Boolean, nullable=False, default=True)
function_calling_enabled: Mapped[bool] = mapped_column(Boolean, nullable=False, default=True)
created_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow, nullable=False)
updated_at: Mapped[datetime] = mapped_column(
DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False
)