mirror of
https://github.com/cnlimiter/codex-register.git
synced 2026-06-26 09:42:03 +08:00
feat(webui): 添加WebSocket支持实现实时任务状态更新
- 在注册任务和批量任务中集成WebSocket连接 - 添加TaskManager管理任务状态和日志推送 - 前端app.js重构支持WebSocket与轮询降级机制 - 配置模块重构为完全基于数据库存储
This commit is contained in:
@@ -27,35 +27,22 @@ from ..config.constants import (
|
||||
OTP_CODE_SEMANTIC_PATTERN,
|
||||
OPENAI_EMAIL_SENDERS,
|
||||
OPENAI_VERIFICATION_KEYWORDS,
|
||||
OTP_WAIT_TIMEOUT,
|
||||
OTP_POLL_INTERVAL,
|
||||
)
|
||||
from ..database import crud
|
||||
from ..database.session import get_db
|
||||
from ..config.settings import get_settings
|
||||
|
||||
|
||||
def get_email_code_settings() -> dict:
|
||||
"""
|
||||
从数据库获取验证码等待配置
|
||||
获取验证码等待配置
|
||||
|
||||
Returns:
|
||||
dict: 包含 timeout 和 poll_interval 的字典
|
||||
"""
|
||||
try:
|
||||
with get_db() as db:
|
||||
timeout_setting = crud.get_setting(db, "email_code.timeout")
|
||||
poll_interval_setting = crud.get_setting(db, "email_code.poll_interval")
|
||||
|
||||
return {
|
||||
"timeout": int(timeout_setting.value) if timeout_setting else OTP_WAIT_TIMEOUT,
|
||||
"poll_interval": int(poll_interval_setting.value) if poll_interval_setting else OTP_POLL_INTERVAL,
|
||||
}
|
||||
except Exception as e:
|
||||
logger.warning(f"获取验证码配置失败,使用默认值: {e}")
|
||||
return {
|
||||
"timeout": OTP_WAIT_TIMEOUT,
|
||||
"poll_interval": OTP_POLL_INTERVAL,
|
||||
}
|
||||
settings = get_settings()
|
||||
return {
|
||||
"timeout": settings.email_code_timeout,
|
||||
"poll_interval": settings.email_code_poll_interval,
|
||||
}
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
Reference in New Issue
Block a user