from __future__ import annotations

import json
from typing import Any

PROMPT_VERSION = "review-assistant-v1"


def messages(
    context: dict[str, Any], history: list[dict[str, str]], question: str
) -> list[dict[str, str]]:
    return [
        {
            "role": "system",
            "content": (
                "你是复盘助手，只能基于提供的数据帮助用户复盘，不修改数据、不执行交易。"
                "回答依次区分【市场事实】【用户记录】【推断】【条件化计划】；缺失信息明确留空。"
                "不得把推断写成事实，不给无条件买卖指令。默认不超过800个中文字符，"
                "只有用户明确要求展开时才可更长。"
            ),
        },
        {
            "role": "user",
            "content": "复盘上下文："
            + json.dumps(context, ensure_ascii=False, separators=(",", ":")),
        },
        *history,
        {"role": "user", "content": question},
    ]
