#!/usr/bin/env python3
"""测试前端代理配置"""

import requests

def test_frontend_proxy():
    """测试前端代理"""
    try:
        # 测试前端代理
        response = requests.get('http://localhost:3000/api/algorithms')
        
        print(f"状态码: {response.status_code}")
        
        if response.status_code == 200:
            data = response.json()
            print(f"成功获取 {len(data.get('algorithms', []))} 个算法")
            
            # 检查第一个算法的字段
            if data.get('algorithms'):
                first_algo = data['algorithms'][0]
                print(f"\n第一个算法:")
                print(f"  名称: {first_algo.get('name')}")
                print(f"  技术分类: {first_algo.get('tech_category')}")
                print(f"  输出类型: {first_algo.get('output_type')}")
        else:
            print(f"请求失败: {response.text}")
            
    except Exception as e:
        print(f"测试失败: {e}")

if __name__ == "__main__":
    test_frontend_proxy()