This commit is contained in:
dekun
2026-05-27 16:13:23 +08:00
parent 5aa9a9eb8a
commit b9af1f69fe
6 changed files with 236 additions and 78 deletions
+23 -16
View File
@@ -35,6 +35,7 @@ import sys
if _REPO_ROOT not in sys.path:
sys.path.insert(0, _REPO_ROOT)
from ai_client import ai_generate, ai_review, ai_short_advice
from ai_review_lib import build_journal_ai_chart_path, collect_images_for_ai_review
from fib_key_monitor_lib import (
FIB_KEY_MONITOR_TYPES,
calc_fib_plan,
@@ -7743,6 +7744,18 @@ def manual_transfer():
return redirect("/")
def _journal_ai_chart_builder(row):
return build_journal_ai_chart_path(
row,
app.config["UPLOAD_FOLDER"],
order_chart_enabled=ORDER_CHART_ENABLED,
normalize_exchange_symbol_fn=lambda c: normalize_exchange_symbol(normalize_symbol_input(c)),
generate_chart_fn=generate_multi_timeframe_chart_png,
local_datetime_to_ms_fn=_local_input_datetime_to_ms,
now_ts_ms_fn=lambda: int(app_now().timestamp() * 1000),
)
@app.route("/ai_daily_review", methods=["POST"])
@login_required
def ai_daily_review():
@@ -7761,14 +7774,11 @@ def ai_daily_review():
text += _journal_row_lines_for_ai(idx, row)
text += "\n"
image_paths = []
for row in rows:
img = row["image"]
if not img:
continue
img_path = os.path.join(app.config["UPLOAD_FOLDER"], img)
if os.path.exists(img_path):
image_paths.append(img_path)
image_paths = collect_images_for_ai_review(
rows,
app.config["UPLOAD_FOLDER"],
build_chart_if_missing=_journal_ai_chart_builder,
)
ai_result = ai_review(text, "每日", image_paths=image_paths)
full = f"【AI日复盘 {date}\n{ai_result}\n\n原始记录:\n{text}"
conn = get_db()
@@ -7800,14 +7810,11 @@ def ai_weekly_review():
text += _journal_row_lines_for_ai(idx, row)
text += "\n"
image_paths = []
for row in rows:
img = row["image"]
if not img:
continue
img_path = os.path.join(app.config["UPLOAD_FOLDER"], img)
if os.path.exists(img_path):
image_paths.append(img_path)
image_paths = collect_images_for_ai_review(
rows,
app.config["UPLOAD_FOLDER"],
build_chart_if_missing=_journal_ai_chart_builder,
)
ai_result = ai_review(text, "周度", image_paths=image_paths)
full = f"【AI周复盘 {start_date}~{end_date}\n{ai_result}\n\n原始记录:\n{text}"
conn = get_db()