fix: content quality, image format, task monitor, calendar data source, search UI & sort

This commit is contained in:
Yuzhiran Dev
2026-05-26 11:26:10 +08:00
parent b2d043b231
commit ac8644d752
36 changed files with 2294 additions and 873 deletions
+39 -1
View File
@@ -2,7 +2,44 @@ from sqlalchemy import Column, String, Integer, Float, Date, DateTime, Text, Boo
from sqlalchemy.sql import func
from sqlalchemy.orm import relationship
from .database import Base
from datetime import datetime
from datetime import datetime, timezone
class SearchProvider(Base):
__tablename__ = "search_providers"
id = Column(Integer, primary_key=True, index=True, autoincrement=True)
name = Column(String, nullable=False, comment="显示名称")
provider_type = Column(String, nullable=False, comment="baidu / qiniu / tinyfish")
api_key = Column(String, nullable=True, comment="API密钥")
api_url = Column(String, nullable=True, comment="API地址")
priority = Column(Integer, default=1, comment="优先级,越小越优先")
enabled = Column(Boolean, default=True)
daily_limit = Column(Integer, default=1500, comment="每日调用上限")
usage_today = Column(Integer, default=0, comment="当日已用次数")
console_url = Column(String, nullable=True, comment="官网控制台地址")
extra_config = Column(JSON, default=dict, comment="额外配置")
last_used_at = Column(DateTime(timezone=True), nullable=True)
created_at = Column(DateTime(timezone=True), server_default=func.now())
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
def to_dict(self):
return {
"id": self.id,
"name": self.name,
"provider_type": self.provider_type,
"api_key": self.api_key,
"api_url": self.api_url,
"console_url": self.console_url,
"priority": self.priority,
"enabled": self.enabled,
"daily_limit": self.daily_limit,
"usage_today": self.usage_today,
"extra_config": self.extra_config or {},
"last_used_at": self.last_used_at.isoformat() if self.last_used_at else None,
"created_at": self.created_at.isoformat() if self.created_at else None,
"updated_at": self.updated_at.isoformat() if self.updated_at else None,
}
class AuditLog(Base):
@@ -221,6 +258,7 @@ class Topic(Base):
created_at = Column(DateTime(timezone=True), server_default=func.now())
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
generated_at = Column(DateTime(timezone=True), nullable=True)
reviewed_at = Column(DateTime(timezone=True), nullable=True)
ready_at = Column(Date)
published_at = Column(Date)
compliance_score = Column(Integer)