#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
测试关键点Agent的新维度定义
"""

from src.components.agents.key_points_agent import KeyPointsAgent

def test_key_points_new_dimensions():
    """测试新的维度定义（形式&关系、实质）"""

    # 创建关键点Agent
    agent = KeyPointsAgent()

    # 构造测试数据
    test_state = {
        "text": {
            "title": "冬日温暖穿搭分享",
            "body": "这套穿搭采用了经典的叠穿技巧，内搭白色高领毛衣，外搭米色大衣。配色上选择了温暖的大地色系，整体风格简约优雅。",
            "hashtags": ["#冬日穿搭", "#叠穿技巧"]
        },
        "images": []  # 暂不测试图片
    }

    # 运行关键点提取
    print("=" * 80)
    print("测试关键点Agent - 新维度定义（形式&关系、实质）")
    print("=" * 80)
    print("\n测试数据:")
    print(f"标题: {test_state['text']['title']}")
    print(f"正文: {test_state['text']['body']}")
    print(f"标签: {test_state['text']['hashtags']}")
    print("\n开始分析...\n")

    result = agent.process(test_state)

    print("\n" + "=" * 80)
    print("测试结果:")
    print("=" * 80)

    if "key_points" in result:
        key_points_data = result["key_points"]
        print(f"\n总计: {key_points_data.get('total_count', 0)} 个关键点")

        points = key_points_data.get("key_points", [])
        if points:
            print("\n关键点详情:")
            for idx, point in enumerate(points, 1):
                维度大类 = point.get("维度大类", "未知")
                维度细分 = point.get("维度细分", "未知")
                关键点 = point.get("关键点", "未知")
                描述 = point.get("描述", "未知")

                print(f"\n{idx}. [{维度大类}] {维度细分}")
                print(f"   关键点: {关键点}")
                print(f"   描述: {描述}")
        else:
            print("\n未识别到关键点")
    else:
        print("\n处理失败")

    print("\n" + "=" * 80)

if __name__ == "__main__":
    test_key_points_new_dimensions()
