42 lines
1.6 KiB
Python
Executable File
42 lines
1.6 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Quick test of the full notification pipeline."""
|
|
|
|
import asyncio
|
|
from config import Config
|
|
from template_manager import TemplateManager
|
|
from grok_client import GrokClient
|
|
from notification_client import NotificationClient
|
|
|
|
async def test_full_pipeline():
|
|
"""Test the complete pipeline from template to notification."""
|
|
config = Config()
|
|
|
|
print("🚀 Testing full notification pipeline...")
|
|
|
|
# Test template system
|
|
template_manager = TemplateManager()
|
|
template_data = template_manager.get_random_prompt()
|
|
prompt = template_data["prompt"]
|
|
title = template_data["title"]
|
|
print(f"📋 Selected template: {prompt}")
|
|
print(f"📋 Notification title: {title}")
|
|
|
|
# Test Grok response
|
|
async with GrokClient(config) as grok_client:
|
|
strip_think_tags = getattr(config, 'strip_think_tags', True)
|
|
response = await grok_client.generate_response(prompt, strip_think_tags=strip_think_tags)
|
|
if response:
|
|
print(f"🤖 Grok response: {response[:200]}...")
|
|
|
|
# Test notification (will skip if no device key/topic)
|
|
async with NotificationClient(config) as notification_client:
|
|
success = await notification_client.send_notification(response, title=title)
|
|
if success:
|
|
print("✅ Notification pipeline working!")
|
|
else:
|
|
print("⚠️ Notification sent to available services")
|
|
else:
|
|
print("❌ Failed to get Grok response")
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(test_full_pipeline()) |