Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """Debug AI Analysis - See raw output""" | |
| from ai_analysis import get_ai_analyzer | |
| import json | |
| analyzer = get_ai_analyzer() | |
| prompt = """You are an expert RTS (Red Alert style) commentator & coach. Return ONLY one <json>...</json> block. | |
| JSON keys: summary (string concise tactical overview), tips (array of 1-4 short imperative build/composition suggestions), coach (1 motivational/adaptive sentence). | |
| No additional keys. No text outside tags. Language: English. | |
| Battle state: Player 2 units vs Enemy 3 units. Player 2 buildings vs Enemy 1 buildings. Credits: 500. | |
| Example JSON: | |
| {"summary": "Allies hold a modest resource advantage and a forward infantry presence near the center.", "tips": ["Build more tanks", "Defend north base", "Scout enemy position"], "coach": "You are doing well; keep pressure on the enemy."} | |
| Generate tactical analysis in English:""" | |
| print("๐ Prompt:") | |
| print(prompt) | |
| print("\n" + "="*80) | |
| print("๐ค Generating response...") | |
| result = analyzer.generate_response( | |
| prompt=prompt, | |
| max_tokens=300, | |
| temperature=0.7, | |
| timeout=25.0 | |
| ) | |
| print(f"\nโ Status: {result.get('status')}") | |
| print(f"๐ฆ Data: {json.dumps(result.get('data'), indent=2, ensure_ascii=False)}") | |