fix: journal detail contrast and unify AI review journal format across four exchanges
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -35,7 +35,11 @@ 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 ai_review_lib import (
|
||||
build_journal_ai_chart_path,
|
||||
collect_images_for_ai_review,
|
||||
journal_row_lines_for_ai,
|
||||
)
|
||||
from form_submit_lib import check_duplicate_submit, submit_scope_add_key, submit_scope_add_order
|
||||
from fib_key_monitor_lib import (
|
||||
FIB_KEY_MONITOR_TYPES,
|
||||
@@ -562,45 +566,6 @@ def _extract_json_object(text):
|
||||
return None
|
||||
|
||||
|
||||
def _journal_row_lines_for_ai(idx, row, *, include_hold_duration=True):
|
||||
"""把 journal 字段拼成给 AI 的文本;字段之外的事实不要指望模型自己猜。"""
|
||||
def nz(v, default="无"):
|
||||
if v is None:
|
||||
return default
|
||||
s = str(v).strip()
|
||||
return s if s else default
|
||||
|
||||
lines = [
|
||||
f"{idx}. {nz(row['coin'])} {nz(row['tf'])} | 盈亏:{nz(row['pnl'])}U | 实际RR:{nz(row['real_rr'])} | 预期RR:{nz(row['expect_rr'])}",
|
||||
f" 开仓逻辑:{nz(row['entry_reason'])}",
|
||||
f" 平仓/离场(交易员自述):{nz(row['exit_reason'])}",
|
||||
]
|
||||
if include_hold_duration:
|
||||
lines.append(f" 持仓时长:{nz(row['hold_duration'])}")
|
||||
ee_bits = [
|
||||
nz(row["early_exit"]),
|
||||
nz(row["early_exit_reason"]),
|
||||
nz(row["early_exit_trigger"]),
|
||||
nz(row["early_exit_note"]),
|
||||
]
|
||||
if any(x != "无" for x in ee_bits):
|
||||
lines.append(
|
||||
" 提前离场记录:"
|
||||
f"{ee_bits[0]} | 原因:{ee_bits[1]} | 触发:{ee_bits[2]} | 备注:{ee_bits[3]}"
|
||||
)
|
||||
mood_bits = f"心态标签:{nz(row['mood_issues'])}"
|
||||
if row["mood_score"] is not None:
|
||||
mood_bits += f" | 自评心态分:{row['mood_score']}"
|
||||
lines.append(f" {mood_bits}")
|
||||
if nz(row["post_breakeven_stare"]) != "无":
|
||||
lines.append(f" 保本后盯盘:{nz(row['post_breakeven_stare'])}")
|
||||
if nz(row["new_trade_while_occupied"]) != "无":
|
||||
lines.append(f" 占用时新开仓:{nz(row['new_trade_while_occupied'])}")
|
||||
if nz(row["note"]) != "无":
|
||||
lines.append(f" 备注:{nz(row['note'])}")
|
||||
return "\n".join(lines) + "\n"
|
||||
|
||||
|
||||
def _load_font(size):
|
||||
if not ImageFont:
|
||||
return None
|
||||
@@ -8109,7 +8074,7 @@ def ai_daily_review():
|
||||
|
||||
text = f"【每日交易记录】{date}\n总笔数:{len(rows)}\n\n"
|
||||
for idx, row in enumerate(rows, 1):
|
||||
text += _journal_row_lines_for_ai(idx, row)
|
||||
text += journal_row_lines_for_ai(idx, row)
|
||||
text += "\n"
|
||||
|
||||
image_paths = collect_images_for_ai_review(
|
||||
@@ -8145,7 +8110,7 @@ def ai_weekly_review():
|
||||
|
||||
text = f"【周交易记录】{start_date}~{end_date}\n总笔数:{len(rows)}\n\n"
|
||||
for idx, row in enumerate(rows, 1):
|
||||
text += _journal_row_lines_for_ai(idx, row)
|
||||
text += journal_row_lines_for_ai(idx, row)
|
||||
text += "\n"
|
||||
|
||||
image_paths = collect_images_for_ai_review(
|
||||
|
||||
@@ -231,7 +231,7 @@
|
||||
.stats-period-block h3{font-size:1rem;color:#dbe4ff;margin-bottom:4px}
|
||||
.stats-period-block .sub{font-size:.78rem;color:#8892b0;margin-bottom:10px;line-height:1.4}
|
||||
</style>
|
||||
<link rel="stylesheet" href="/static/instance_theme.css?v=4">
|
||||
<link rel="stylesheet" href="/static/instance_theme.css?v=5">
|
||||
|
||||
</head>
|
||||
<body data-page="{{ page }}">
|
||||
|
||||
Reference in New Issue
Block a user