feat: 记录并展示每次生成消耗的LLM调用次数(llm_calls)

This commit is contained in:
Sakurasan
2026-09-02 14:10:49 +08:00
parent 734a449037
commit fefb1b4736
6 changed files with 17 additions and 7 deletions
+2
View File
@@ -83,6 +83,7 @@ CREATE TABLE IF NOT EXISTS ai_reports (
model TEXT NOT NULL,
tokens_used INTEGER,
generation_count INTEGER NOT NULL DEFAULT 1,
llm_calls INTEGER,
created_at TEXT NOT NULL DEFAULT (datetime('now','localtime')),
updated_at TEXT,
UNIQUE(trade_date, report_type)
@@ -121,6 +122,7 @@ def init_db():
for alter_sql in (
"ALTER TABLE ai_reports ADD COLUMN generation_count INTEGER NOT NULL DEFAULT 1",
"ALTER TABLE ai_reports ADD COLUMN updated_at TEXT",
"ALTER TABLE ai_reports ADD COLUMN llm_calls INTEGER",
):
try:
conn.execute(alter_sql)