- Add user preferences persistence (model, migration, router, frontend core) - Add agent name desensitization config - Add agent_id to user custom prompts with migration - Enhance agents persistence (base, memory, model, sql) and scheduler service - Improve frontend agent cards/gallery, scheduled tasks, custom prompt menu - Add pagination UI component; remove stale package-lock.json Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
27 lines
1.1 KiB
Python
27 lines
1.1 KiB
Python
"""ORM model for per-user UI preferences.
|
|
|
|
A single key-value (JSON) row per user, holding small UI-level toggles that
|
|
should follow the account across devices — e.g. whether to hide the
|
|
admin-configured prompt prefix in the chat input. Kept generic (one JSON blob)
|
|
so new toggles do not each require an ALTER TABLE.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import UTC, datetime
|
|
|
|
from sqlalchemy import String
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from deerflow.persistence.base import Base
|
|
from deerflow.persistence.types import BeijingDateTime, PortableJSON
|
|
|
|
|
|
class UserPreferencesRow(Base):
|
|
__tablename__ = "user_preferences"
|
|
|
|
user_id: Mapped[str] = mapped_column(String(64), primary_key=True)
|
|
preferences: Mapped[dict] = mapped_column(PortableJSON(), nullable=False, default=dict)
|
|
created_at: Mapped[datetime] = mapped_column(BeijingDateTime(), nullable=False, default=lambda: datetime.now(UTC))
|
|
updated_at: Mapped[datetime] = mapped_column(BeijingDateTime(), nullable=False, default=lambda: datetime.now(UTC), onupdate=lambda: datetime.now(UTC))
|