"""
陪练分析报告提示词模板

功能：分析陪练对话，生成综合评分和改进建议
"""

# ==================== 元数据 ====================

PROMPT_META = {
    "name": "practice_analysis",
    "display_name": "陪练分析报告",
    "description": "分析陪练对话，生成综合评分、能力维度评估、对话标注和改进建议",
    "module": "kaopeilian",
    "variables": ["dialogue_history"],
    "version": "1.0.0",
    "author": "kaopeilian-team",
}


# ==================== 系统提示词 ====================

SYSTEM_PROMPT = """你是话术分析专家，用户是一家轻医美连锁品牌的员工，用户提交的是用户自己与顾客的对话记录，你做分析与评分。并严格按照以下格式输出。

输出标准：
{
  "analysis": {
    "total_score": 88,
    "score_breakdown": [
      {"name": "开场技巧", "score": 92, "description": "开场自然，快速建立信任"},
      {"name": "需求挖掘", "score": 90, "description": "能够有效识别客户需求"},
      {"name": "产品介绍", "score": 88, "description": "产品介绍清晰，重点突出"},
      {"name": "异议处理", "score": 85, "description": "处理客户异议还需加强"},
      {"name": "成交技巧", "score": 86, "description": "成交话术运用良好"}
    ],
    "ability_dimensions": [
      {"name": "沟通表达", "score": 90, "feedback": "语言流畅，表达清晰，语调富有亲和力"},
      {"name": "倾听理解", "score": 92, "feedback": "能够准确理解客户意图，给予恰当回应"},
      {"name": "情绪控制", "score": 88, "feedback": "整体情绪稳定，面对异议时保持专业"},
      {"name": "专业知识", "score": 93, "feedback": "对医美项目知识掌握扎实"},
      {"name": "销售技巧", "score": 87, "feedback": "销售流程把控良好"},
      {"name": "应变能力", "score": 85, "feedback": "面对突发问题能够快速反应"}
    ],
    "dialogue_annotations": [
      {"sequence": 1, "tags": ["亮点话术"], "comment": "开场专业，身份介绍清晰"},
      {"sequence": 3, "tags": ["金牌话术"], "comment": "巧妙引导，从客户角度出发"},
      {"sequence": 5, "tags": ["亮点话术"], "comment": "类比生动，让客户容易理解"},
      {"sequence": 7, "tags": ["金牌话术"], "comment": "专业解答，打消客户疑虑"}
    ],
    "suggestions": [
      {"title": "控制语速", "content": "您的语速偏快，建议适当放慢，给客户更多思考时间", "example": "说完产品优势后，停顿2-3秒，观察客户反应"},
      {"title": "多用开放式问题", "content": "增加开放式问题的使用，更深入了解客户需求", "example": "您对未来的保障有什么期望？而不是您需要保险吗？"},
      {"title": "强化成交信号识别", "content": "客户已经表现出兴趣时，要及时推进成交", "example": "当客户问费用多少时，这是购买信号，应该立即报价并促成"}
    ]
  }
}

## 输出要求（严格执行）
1. 直接输出纯净的 JSON，不要包含 Markdown 标记（如 ```json）
2. 不要包含任何解释性文字
3. score_breakdown 必须包含 5 项：开场技巧、需求挖掘、产品介绍、异议处理、成交技巧
4. ability_dimensions 必须包含 6 项：沟通表达、倾听理解、情绪控制、专业知识、销售技巧、应变能力
5. dialogue_annotations 标注有亮点或问题的对话轮次，tags 可选：亮点话术、金牌话术、待改进、问题话术
6. suggestions 提供 2-4 条具体可操作的改进建议，每条包含 title、content、example

## 评分标准
- 90-100：优秀
- 80-89：良好
- 70-79：一般
- 60-69：需改进
- <60：亟需提升"""


# ==================== 用户提示词模板 ====================

USER_PROMPT = """{dialogue_history}"""


# ==================== JSON Schema ====================

PRACTICE_ANALYSIS_SCHEMA = {
    "type": "object",
    "required": ["analysis"],
    "properties": {
        "analysis": {
            "type": "object",
            "required": ["total_score", "score_breakdown", "ability_dimensions", "dialogue_annotations", "suggestions"],
            "properties": {
                "total_score": {
                    "type": "number",
                    "description": "总体评分（0-100）",
                    "minimum": 0,
                    "maximum": 100
                },
                "score_breakdown": {
                    "type": "array",
                    "description": "分数细分（5项）",
                    "items": {
                        "type": "object",
                        "required": ["name", "score", "description"],
                        "properties": {
                            "name": {"type": "string", "description": "维度名称"},
                            "score": {"type": "number", "description": "得分（0-100）"},
                            "description": {"type": "string", "description": "评价描述"}
                        }
                    },
                    "minItems": 5
                },
                "ability_dimensions": {
                    "type": "array",
                    "description": "能力维度评分（6项）",
                    "items": {
                        "type": "object",
                        "required": ["name", "score", "feedback"],
                        "properties": {
                            "name": {"type": "string", "description": "能力维度名称"},
                            "score": {"type": "number", "description": "得分（0-100）"},
                            "feedback": {"type": "string", "description": "反馈评语"}
                        }
                    },
                    "minItems": 6
                },
                "dialogue_annotations": {
                    "type": "array",
                    "description": "对话标注",
                    "items": {
                        "type": "object",
                        "required": ["sequence", "tags", "comment"],
                        "properties": {
                            "sequence": {"type": "integer", "description": "对话轮次序号"},
                            "tags": {
                                "type": "array",
                                "description": "标签列表",
                                "items": {"type": "string"}
                            },
                            "comment": {"type": "string", "description": "点评内容"}
                        }
                    }
                },
                "suggestions": {
                    "type": "array",
                    "description": "改进建议",
                    "items": {
                        "type": "object",
                        "required": ["title", "content", "example"],
                        "properties": {
                            "title": {"type": "string", "description": "建议标题"},
                            "content": {"type": "string", "description": "建议内容"},
                            "example": {"type": "string", "description": "示例"}
                        }
                    },
                    "minItems": 2,
                    "maxItems": 5
                }
            }
        }
    }
}


# ==================== 常量定义 ====================

SCORE_BREAKDOWN_ITEMS = [
    "开场技巧",
    "需求挖掘",
    "产品介绍",
    "异议处理",
    "成交技巧",
]

ABILITY_DIMENSIONS = [
    "沟通表达",
    "倾听理解",
    "情绪控制",
    "专业知识",
    "销售技巧",
    "应变能力",
]

ANNOTATION_TAGS = [
    "亮点话术",
    "金牌话术",
    "待改进",
    "问题话术",
]














