2026-05-08 08:56:52 +08:00
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
from datetime import datetime
|
|
|
|
|
|
|
|
|
|
from sqlalchemy import Boolean, DateTime, Integer, String, func
|
|
|
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
|
|
|
|
|
|
from app.db.base_class import Base
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SystemSetting(Base):
|
|
|
|
|
__tablename__ = "system_settings"
|
|
|
|
|
|
|
|
|
|
id: Mapped[str] = mapped_column(String(32), primary_key=True, default="default")
|
|
|
|
|
|
|
|
|
|
company_name: Mapped[str] = mapped_column(String(120), default="X-Financial")
|
|
|
|
|
display_name: Mapped[str] = mapped_column(String(120), default="X-Financial")
|
|
|
|
|
company_code: Mapped[str] = mapped_column(String(64), default="XF-001")
|
|
|
|
|
record_number: Mapped[str] = mapped_column(String(120), default="")
|
|
|
|
|
copyright_text: Mapped[str] = mapped_column(String(255), default="")
|
2026-05-28 16:24:59 +08:00
|
|
|
theme_skin: Mapped[str] = mapped_column(String(64), default="sky")
|
2026-05-08 08:56:52 +08:00
|
|
|
|
2026-06-18 22:11:53 +08:00
|
|
|
admin_account: Mapped[str] = mapped_column(String(120), default="admin")
|
2026-05-08 08:56:52 +08:00
|
|
|
admin_email: Mapped[str] = mapped_column(String(255), default="")
|
|
|
|
|
session_timeout: Mapped[int] = mapped_column(Integer, default=30)
|
2026-05-12 06:34:36 +00:00
|
|
|
conversation_retention_days: Mapped[int] = mapped_column(Integer, default=3)
|
2026-05-08 08:56:52 +08:00
|
|
|
notice_email: Mapped[str] = mapped_column(String(255), default="")
|
|
|
|
|
mfa_enabled: Mapped[bool] = mapped_column(Boolean, default=True)
|
|
|
|
|
strong_password: Mapped[bool] = mapped_column(Boolean, default=True)
|
|
|
|
|
login_alert_enabled: Mapped[bool] = mapped_column(Boolean, default=True)
|
|
|
|
|
|
|
|
|
|
main_provider: Mapped[str] = mapped_column(String(64), default="Codex")
|
|
|
|
|
main_model: Mapped[str] = mapped_column(String(255), default="codex-mini-latest")
|
|
|
|
|
main_endpoint: Mapped[str] = mapped_column(String(512), default="https://api.openai.com/v1")
|
|
|
|
|
backup_provider: Mapped[str] = mapped_column(String(64), default="GLM")
|
|
|
|
|
backup_model: Mapped[str] = mapped_column(String(255), default="glm-5.1")
|
|
|
|
|
backup_endpoint: Mapped[str] = mapped_column(String(512), default="https://open.bigmodel.cn/api/paas/v4/")
|
|
|
|
|
vlm_provider: Mapped[str] = mapped_column(String(64), default="Gemini")
|
|
|
|
|
vlm_model: Mapped[str] = mapped_column(String(255), default="gemini-2.5-flash")
|
|
|
|
|
vlm_endpoint: Mapped[str] = mapped_column(String(512), default="https://generativelanguage.googleapis.com/v1beta/openai/")
|
|
|
|
|
embedding_provider: Mapped[str] = mapped_column(String(64), default="GLM")
|
|
|
|
|
embedding_model: Mapped[str] = mapped_column(String(255), default="Embedding-3")
|
|
|
|
|
embedding_endpoint: Mapped[str] = mapped_column(String(512), default="https://open.bigmodel.cn/api/paas/v4/")
|
2026-05-17 08:38:41 +00:00
|
|
|
reranker_provider: Mapped[str] = mapped_column(String(64), default="Ali")
|
|
|
|
|
reranker_model: Mapped[str] = mapped_column(String(255), default="gte-rerank-v2")
|
|
|
|
|
reranker_endpoint: Mapped[str] = mapped_column(
|
|
|
|
|
String(512), default="https://dashscope.aliyuncs.com/api/v1/services/rerank/text-rerank/text-rerank"
|
|
|
|
|
)
|
2026-05-09 08:02:01 +00:00
|
|
|
onlyoffice_enabled: Mapped[bool] = mapped_column(Boolean, default=False)
|
|
|
|
|
onlyoffice_public_url: Mapped[str] = mapped_column(String(512), default="")
|
2026-05-08 08:56:52 +08:00
|
|
|
|
|
|
|
|
log_level: Mapped[str] = mapped_column(String(16), default="INFO")
|
|
|
|
|
retention_days: Mapped[int] = mapped_column(Integer, default=180)
|
|
|
|
|
archive_cycle: Mapped[str] = mapped_column(String(32), default="weekly")
|
|
|
|
|
log_path: Mapped[str] = mapped_column(String(255), default="server/logs/app.log")
|
|
|
|
|
alert_email: Mapped[str] = mapped_column(String(255), default="")
|
|
|
|
|
operation_audit: Mapped[bool] = mapped_column(Boolean, default=True)
|
|
|
|
|
login_audit: Mapped[bool] = mapped_column(Boolean, default=True)
|
|
|
|
|
mask_sensitive: Mapped[bool] = mapped_column(Boolean, default=True)
|
|
|
|
|
|
|
|
|
|
smtp_host: Mapped[str] = mapped_column(String(255), default="smtp.exmail.qq.com")
|
|
|
|
|
smtp_port: Mapped[int] = mapped_column(Integer, default=465)
|
|
|
|
|
smtp_encryption: Mapped[str] = mapped_column(String(32), default="SSL/TLS")
|
|
|
|
|
sender_name: Mapped[str] = mapped_column(String(120), default="X-Financial")
|
|
|
|
|
sender_address: Mapped[str] = mapped_column(String(255), default="")
|
|
|
|
|
smtp_username: Mapped[str] = mapped_column(String(255), default="")
|
|
|
|
|
alert_enabled: Mapped[bool] = mapped_column(Boolean, default=True)
|
|
|
|
|
digest_enabled: Mapped[bool] = mapped_column(Boolean, default=False)
|
|
|
|
|
digest_time: Mapped[str] = mapped_column(String(16), default="09:00")
|
|
|
|
|
default_receiver: Mapped[str] = mapped_column(String(255), default="")
|
|
|
|
|
|
|
|
|
|
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
|
|
|
|
|
updated_at: Mapped[datetime] = mapped_column(
|
|
|
|
|
DateTime(timezone=True),
|
|
|
|
|
server_default=func.now(),
|
|
|
|
|
onupdate=func.now(),
|
|
|
|
|
)
|