mirror of
https://github.com/onyx-dot-app/onyx.git
synced 2026-10-23 20:02:57 -05:00
* proper no assistant typing + no assistant modal * updated chat flow * k * updates * update * k * clean up * fix mystery reorg * cleanup * update scroll * default * update logs * push fade * scroll nit * finalize tags * updates * k * various updates * viewport height update * source types update * clean up unused components * minor cleanup * cleanup complete * finalize changes * badge up * update filters * small nit * k * k * address comments * quick unification of icons * minor date range clarity * minor nit * k * update sidebar line * update for all screen sizes * k * k * k * k * rm shs * fix memoization * fix memoization * slack chat * k * k * build org
52 lines
1.3 KiB
Python
52 lines
1.3 KiB
Python
from datetime import datetime
|
|
from enum import Enum
|
|
|
|
from pydantic import BaseModel
|
|
|
|
from danswer.configs.constants import NotificationType
|
|
from danswer.db.models import Notification as NotificationDBModel
|
|
|
|
|
|
class PageType(str, Enum):
|
|
CHAT = "chat"
|
|
SEARCH = "search"
|
|
|
|
|
|
class GatingType(str, Enum):
|
|
FULL = "full" # Complete restriction of access to the product or service
|
|
PARTIAL = "partial" # Full access but warning (no credit card on file)
|
|
NONE = "none" # No restrictions, full access to all features
|
|
|
|
|
|
class Notification(BaseModel):
|
|
id: int
|
|
notif_type: NotificationType
|
|
dismissed: bool
|
|
last_shown: datetime
|
|
first_shown: datetime
|
|
additional_data: dict | None = None
|
|
|
|
@classmethod
|
|
def from_model(cls, notif: NotificationDBModel) -> "Notification":
|
|
return cls(
|
|
id=notif.id,
|
|
notif_type=notif.notif_type,
|
|
dismissed=notif.dismissed,
|
|
last_shown=notif.last_shown,
|
|
first_shown=notif.first_shown,
|
|
additional_data=notif.additional_data,
|
|
)
|
|
|
|
|
|
class Settings(BaseModel):
|
|
"""General settings"""
|
|
|
|
maximum_chat_retention_days: int | None = None
|
|
gpu_enabled: bool | None = None
|
|
product_gating: GatingType = GatingType.NONE
|
|
|
|
|
|
class UserSettings(Settings):
|
|
notifications: list[Notification]
|
|
needs_reindexing: bool
|