38 lines
1.1 KiB
Python
Executable File
38 lines
1.1 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""
|
|
Script to run the OpenWebUI AI bot.
|
|
|
|
This script runs the custom AI bot from the openwebui-bot repository.
|
|
"""
|
|
|
|
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
|
|
|
|
if __name__ == "__main__":
|
|
print("Starting OpenWebUI bot...")
|
|
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)}")
|
|
except Exception as e:
|
|
print(f"Error running bot: {str(e)}")
|
|
print("Check that the OpenWebUI server is running and accessible.")
|