feat: 复盘四周期手动上传,移除 AI 识别预填

固定 5m/15m/1h/4h 四槽截图上传与详情四宫格展示;自动 K 线默认关闭且与手动上传互斥。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-05 21:57:41 +08:00
parent eec57610dc
commit 88fe4bbe56
18 changed files with 644 additions and 621 deletions
+16 -16
View File
@@ -12,6 +12,7 @@ from lib.instance.journal_chart_lib import (
JOURNAL_CHART_DEFAULT_TF2,
normalize_chart_timeframe,
)
from lib.instance.journal_images_lib import journal_image_paths
def _journal_nz(v: Any, default: str = "") -> str:
@@ -92,32 +93,31 @@ def collect_images_for_ai_review(
) -> List[str]:
"""
收集传给视觉模型的本地图片路径。
- 优先 journal_entries.image 已存附图
- 优先 journal_entries.images_json / image 已存附图(含多周期手动上传)
- 若无附图且提供 build_chart_if_missing,则临时生成 K 线图。
"""
paths: List[str] = []
seen = set()
upload_folder = os.path.abspath(upload_folder or "")
for row in rows or []:
candidate = None
try:
keys = row.keys() if hasattr(row, "keys") else []
except Exception:
keys = []
img = row["image"] if "image" in keys else None
if img:
candidate = os.path.join(upload_folder, str(img).strip())
elif build_chart_if_missing:
row_paths = journal_image_paths(row, upload_folder)
if row_paths:
for candidate in row_paths:
if candidate not in seen:
seen.add(candidate)
paths.append(candidate)
continue
if build_chart_if_missing:
try:
candidate = build_chart_if_missing(row)
except Exception:
candidate = None
if not candidate:
continue
candidate = os.path.abspath(candidate)
if os.path.isfile(candidate) and candidate not in seen:
seen.add(candidate)
paths.append(candidate)
if not candidate:
continue
candidate = os.path.abspath(candidate)
if os.path.isfile(candidate) and candidate not in seen:
seen.add(candidate)
paths.append(candidate)
return paths