Initial commit: RSS platform phase 1 skeleton with code review fixes
Features: - FastAPI + SQLAlchemy 2.0 async + PostgreSQL/pgvector + Redis backend - Vue 3 + TypeScript + Element Plus frontend - JWT auth with access/refresh tokens and revocation - Admin/member RBAC - RSS feed CRUD and article listing - Settings management with Fernet encryption for sensitive values - Redis distributed lock service - Alembic initial migration - Docker Compose development environment Fixes from code review: - Fix DB session leak in dependency injection - Restrict registration to admin only - Add default admin password warning - Implement JWT refresh tokens and jti blacklist - Strengthen password policy - Use func.count for pagination totals - Replace NullPool with AsyncAdaptedQueuePool - Remove init_db from lifespan to enforce alembic migrations - Add request_id middleware and logging filter - Fix vite.config.ts env loading - Add frontend token refresh interceptor - Add Vue error handler Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
"""AI configuration models."""
|
||||
from sqlalchemy import Boolean, Float, ForeignKey, Integer, JSON, String, Text
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from app.models.base import Base, TimestampMixin, UUIDMixin
|
||||
|
||||
|
||||
class AIProviderConfig(Base, UUIDMixin, TimestampMixin):
|
||||
"""AI provider configuration (OpenAI, Anthropic, etc.)."""
|
||||
|
||||
__tablename__ = "ai_provider_configs"
|
||||
|
||||
name: Mapped[str] = mapped_column(String(128), nullable=False)
|
||||
provider: Mapped[str] = mapped_column(String(64), nullable=False, index=True)
|
||||
base_url: Mapped[str | None] = mapped_column(String(512), nullable=True)
|
||||
api_key_encrypted: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||
default_model: Mapped[str | None] = mapped_column(String(128), nullable=True)
|
||||
timeout: Mapped[int] = mapped_column(Integer, default=60, nullable=False)
|
||||
max_retries: Mapped[int] = mapped_column(Integer, default=3, nullable=False)
|
||||
rate_limit_rpm: Mapped[int] = mapped_column(Integer, default=60, nullable=False)
|
||||
is_active: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
|
||||
|
||||
|
||||
class AITaskConfig(Base, UUIDMixin, TimestampMixin):
|
||||
"""AI task configuration (which model/skill for which task)."""
|
||||
|
||||
__tablename__ = "ai_task_configs"
|
||||
|
||||
task_type: Mapped[str] = mapped_column(String(64), nullable=False, index=True)
|
||||
name: Mapped[str] = mapped_column(String(128), nullable=False)
|
||||
provider_config_id: Mapped[str | None] = mapped_column(
|
||||
ForeignKey("ai_provider_configs.id", ondelete="SET NULL"), nullable=True
|
||||
)
|
||||
model: Mapped[str] = mapped_column(String(128), nullable=False)
|
||||
skill_id: Mapped[str | None] = mapped_column(
|
||||
ForeignKey("skills.id", ondelete="SET NULL"), nullable=True
|
||||
)
|
||||
temperature: Mapped[float] = mapped_column(Float, default=0.3, nullable=False)
|
||||
max_tokens: Mapped[int | None] = mapped_column(Integer, nullable=True)
|
||||
top_p: Mapped[float] = mapped_column(Float, default=1.0, nullable=False)
|
||||
system_prompt_override: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||
fallback_config_id: Mapped[str | None] = mapped_column(
|
||||
ForeignKey("ai_task_configs.id", ondelete="SET NULL"), nullable=True
|
||||
)
|
||||
enabled: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
|
||||
Reference in New Issue
Block a user