Delete test_api_format.py
Browse files- test_api_format.py +0 -41
test_api_format.py
DELETED
|
@@ -1,41 +0,0 @@
|
|
| 1 |
-
"""
|
| 2 |
-
Test script to verify the API endpoint format matches frontend expectations
|
| 3 |
-
"""
|
| 4 |
-
|
| 5 |
-
import json
|
| 6 |
-
from typing import Dict, Any
|
| 7 |
-
|
| 8 |
-
def test_api_response_format():
|
| 9 |
-
"""Test that our API response format matches what the frontend expects"""
|
| 10 |
-
|
| 11 |
-
# This is what the frontend expects based on chatService.js
|
| 12 |
-
expected_response_format = {
|
| 13 |
-
"response": "Hello! I'm Giuseppe's AI assistant...", # or "text" as fallback
|
| 14 |
-
"sources": ["experience_1", "skills_technical"],
|
| 15 |
-
"usage": {
|
| 16 |
-
"latencyMs": 1234,
|
| 17 |
-
"model": "gpt-5-nano",
|
| 18 |
-
"cached": False
|
| 19 |
-
},
|
| 20 |
-
"confidence": 0.95
|
| 21 |
-
}
|
| 22 |
-
|
| 23 |
-
# This matches our FastAPI ChatResponse model
|
| 24 |
-
our_response_format = {
|
| 25 |
-
"status": "success",
|
| 26 |
-
"response": "Hello! I'm Giuseppe's AI assistant...",
|
| 27 |
-
"confidence": 0.95,
|
| 28 |
-
"sources": ["experience_1", "skills_technical"],
|
| 29 |
-
"response_type": "high_confidence",
|
| 30 |
-
"session_id": "session_123",
|
| 31 |
-
"timestamp": "2025-09-13T10:30:00Z"
|
| 32 |
-
}
|
| 33 |
-
|
| 34 |
-
print("✅ Response formats compatible!")
|
| 35 |
-
print(f"Frontend expects 'response' field: {expected_response_format.get('response', 'Not found')}")
|
| 36 |
-
print(f"Backend provides 'response' field: {our_response_format.get('response', 'Not found')}")
|
| 37 |
-
|
| 38 |
-
return True
|
| 39 |
-
|
| 40 |
-
if __name__ == "__main__":
|
| 41 |
-
test_api_response_format()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|