v1.3.0: 舆情驱动自动化(定期扫新闻→重要度评分→邮件通知) + 系统设置区(邮件SMTP/大模型接口/监控参数可配, 含测试邮件/测试LLM/立即扫描/通知日志)

This commit is contained in:
2026-08-19 21:29:42 +08:00
parent c05b1d54b3
commit e4f316efe7
10 changed files with 726 additions and 8 deletions
+20 -1
View File
@@ -122,6 +122,24 @@ CREATE TABLE IF NOT EXISTS strategy_backtests (
PRIMARY KEY (strategy, code)
);
CREATE TABLE IF NOT EXISTS settings (
key TEXT PRIMARY KEY,
value TEXT DEFAULT ''
);
CREATE TABLE IF NOT EXISTS notification_log (
id INTEGER PRIMARY KEY AUTOINCREMENT,
news_id INTEGER DEFAULT 0,
title TEXT DEFAULT '',
category TEXT DEFAULT '',
sentiment REAL DEFAULT 0,
importance REAL DEFAULT 0,
related TEXT DEFAULT '',
status TEXT DEFAULT 'sent', -- sent / failed
message TEXT DEFAULT '',
sent_at TEXT DEFAULT (datetime('now','localtime'))
);
CREATE TABLE IF NOT EXISTS market_index (
date TEXT PRIMARY KEY,
sh REAL DEFAULT 0, -- 上证指数(点)
@@ -188,8 +206,9 @@ def wipe_all():
"""清空业务表(保留结构)+ 重置自增序列,用于重灌数据"""
for t in ("stock_daily", "inst_ratings", "fund_holdings", "news",
"institutions", "stocks", "watchlist", "analysis_cache", "analysis_history",
"market_index", "strategy_backtests"):
"market_index", "strategy_backtests", "notification_log"):
with db() as conn:
conn.execute(f'DELETE FROM "{t}"')
with db() as conn:
conn.execute("DELETE FROM sqlite_sequence") # 重置 AUTOINCREMENT,保证重灌后 ID 从 1 开始
# settings 保留(用户配置不清空)