async def save_conversation_summary_flow(client, customer_id: str, buyer_msg: str, agent_reply: str):
    """用 AI 生成一句话对话摘要并持久化。"""
    try:
        from db.customer_db import db
        from openai import AsyncOpenAI

        api_client = AsyncOpenAI(
            api_key=client.agent.api_key if client.agent else None,
            base_url=client.agent.base_url if client.agent else None,
        )
        resp = await api_client.chat.completions.create(
            model=client.agent.model_name if client.agent else "gpt-4o-mini",
            messages=[
                {"role": "system", "content": "用一句话（15字以内）总结这段对话的核心内容，只输出摘要文字。"},
                {"role": "user", "content": f"买家：{buyer_msg}\n客服：{agent_reply}"},
            ],
            max_tokens=30,
            temperature=0.3,
        )
        summary = resp.choices[0].message.content.strip()
        db.save_conversation_summary(customer_id, summary)
    except Exception:
        client.logger.debug("保存对话摘要失败(不影响主流程)", exc_info=True)
