#!/usr/bin/env python3 """Test detect-intent API - correct path without /api prefix.""" import json import httpx # Backend routes are at root level (no /api prefix, nginx adds it) url = "http://localhost:8000/approval/detect-intent" test_messages = [ "我要申请VPN", "我的电脑坏了", "我要申请办公用品", "你好,今天天气怎么样?", ] for msg in test_messages: print(f"\n=== Testing: {msg} ===") try: resp = httpx.post( url, json={"text": msg}, timeout=30.0, ) print(f" HTTP: {resp.status_code}") print(f" Response: {resp.text[:500]}") if resp.status_code == 200: data = resp.json() result = data.get("data", data) print(f" is_approval: {result.get('is_approval_request')}") print(f" confidence: {result.get('confidence')}") print(f" type: {result.get('approval_type')}") print(f" source: {result.get('source')}") except Exception as e: print(f" ERROR: {type(e).__name__}: {e}")