Files

38 lines
1.1 KiB
Python
Raw Permalink Normal View History

2025-05-20 02:18:46 +01:00
#!/usr/bin/env python3
"""
Script to run the OpenWebUI AI bot.
This script runs the custom AI bot from the openwebui-bot repository.
2025-05-20 02:18:46 +01:00
"""
import sys
import os
import asyncio
# Add the openwebui-bot directory to the Python path
current_dir = os.path.dirname(os.path.abspath(__file__))
openwebui_bot_dir = os.path.join(current_dir, 'openwebui-bot')
sys.path.insert(0, openwebui_bot_dir)
print(f"Adding OpenWebUI bot directory to Python path: {openwebui_bot_dir}")
# Import the main function from the custom AI example
from examples.custom_ai import main, shutdown
2025-05-20 02:18:46 +01:00
if __name__ == "__main__":
print("Starting OpenWebUI bot...")
2025-05-20 02:18:46 +01:00
print("Press Ctrl+C to stop")
try:
# Run the main function
asyncio.run(main())
except KeyboardInterrupt:
print("\nBot stopped by user")
# Run the shutdown function
try:
asyncio.run(shutdown())
except Exception as e:
print(f"Error during shutdown: {str(e)}")
2025-05-20 02:18:46 +01:00
except Exception as e:
print(f"Error running bot: {str(e)}")
print("Check that the OpenWebUI server is running and accessible.")