feat: JSON 配置、质量分与仪表盘,及设置与爬取流程

- 后端改为 config/app.json;pytest 使用 config/app.test.json 与 set_config_file,不再依赖环境变量;移除 pydantic-settings。

- 前端 API/WebSocket 由 config/webui.json 经 Vite define 注入。

- 代理分数按延迟与随机取用次数计算,新增 use_count 与 proxy_scoring;保存设置时同步调度器启停。

- 仪表盘双饼图(可用/待验证协议);设置页去掉调度器启停按钮并移动立即验证;爬取全部结束后自动提交全量验证。

- 删除 script/settings_maintain.py(此前已标记删除)。

Made-with: Cursor
This commit is contained in:
祀梦
2026-04-05 16:08:32 +08:00
parent 07248ff4ee
commit 7bc6d4e4de
31 changed files with 643 additions and 280 deletions

View File

@@ -1,44 +0,0 @@
"""维护 SQLite settings 表:删除废弃键并写入推荐验证参数。
请在项目根目录执行(与 start.bat 同级的上一级):
python script/settings_maintain.py
改库后需重启应用或在 WebUI 保存一次设置WorkerPool / Validator 才会重载并发与超时。
"""
import asyncio
import os
import sys
_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if _ROOT not in sys.path:
sys.path.insert(0, _ROOT)
_SETTINGS_MAINTENANCE_SQL = """
DELETE FROM settings WHERE key = 'crawl_timeout';
DELETE FROM settings WHERE key = 'max_retries';
INSERT INTO settings (key, value, updated_at) VALUES ('validation_timeout', '6', CURRENT_TIMESTAMP)
ON CONFLICT(key) DO UPDATE SET value = excluded.value, updated_at = CURRENT_TIMESTAMP;
INSERT INTO settings (key, value, updated_at) VALUES ('default_concurrency', '120', CURRENT_TIMESTAMP)
ON CONFLICT(key) DO UPDATE SET value = excluded.value, updated_at = CURRENT_TIMESTAMP;
"""
async def _run() -> None:
import aiosqlite
from app.core.db import DB_PATH, ensure_db_dir
ensure_db_dir()
if not os.path.isfile(DB_PATH):
print(f"数据库不存在,跳过: {DB_PATH}")
return
async with aiosqlite.connect(DB_PATH) as db:
await db.executescript(_SETTINGS_MAINTENANCE_SQL)
await db.commit()
print(f"已执行设置维护: {DB_PATH}")
print("请重启应用或在 WebUI 保存一次设置以使并发/超时生效。")
if __name__ == "__main__":
asyncio.run(_run())