test_chatbot_integration.pyโข2.1 kB
#!/usr/bin/env python3
"""
Test chatbot integration with fixed Notion MCP server
"""
import os
from src.utils.chatbot_agentic_v3 import Chatbot
def test_chatbot_integration():
print("๐ค Testing Chatbot Integration with New Structure")
print("=" * 60)
# Check environment variables
notion_token = os.getenv("NOTION_TOKEN")
server_url = os.getenv("NOTION_MCP_SERVER_URL", "https://notion-mcp-server-5s5v.onrender.com/")
print(f"๐ง Configuration:")
print(f" Server URL: {server_url}")
print(f" Token configured: {'โ
' if notion_token else 'โ'}")
print()
try:
chatbot = Chatbot()
if chatbot.notion_initialized:
print("โ
Notion MCP initialized successfully")
# Test page creation through chatbot
user_message = "Create a new page called 'New Structure Test' with content about how our restructured MCP server is working perfectly with environment-based configuration."
print(f"\n๐ฌ User message: {user_message}")
print("\n๐ Processing...")
response = chatbot.chat(user_message)
print("\n๐ค Chatbot Response:")
print(response)
if "successfully created" in response.lower() or "page" in response.lower():
print("\n๐ SUCCESS: Chatbot successfully created a page!")
return True
else:
print("\nโ ๏ธ Response unclear - check above")
return False
else:
print("โ Notion MCP not initialized in chatbot")
return False
except Exception as e:
print(f"โ Error: {str(e)}")
return False
if __name__ == "__main__":
success = test_chatbot_integration()
if success:
print("\nโ
Chatbot integration test PASSED!")
else:
print("\nโ Chatbot integration test FAILED!")
print("๐ก Make sure to set NOTION_TOKEN and NOTION_MCP_SERVER_URL environment variables")