Integrate OpenWebUI bot with AI service
This commit is contained in:
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Script to run the custom OpenWebUI AI bot.
|
||||
|
||||
This script runs our custom AI bot implementation.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import asyncio
|
||||
|
||||
# Add the openwebui-bot directory to the Python path
|
||||
# Use a path relative to the current file's directory to ensure it works in any environment
|
||||
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 our custom AI example
|
||||
from examples.custom_ai import main
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("Starting custom OpenWebUI AI bot...")
|
||||
print("Press Ctrl+C to stop")
|
||||
|
||||
try:
|
||||
# Run the main function
|
||||
asyncio.run(main())
|
||||
except KeyboardInterrupt:
|
||||
print("\nBot stopped by user")
|
||||
# No need to call shutdown here as it's handled in the main function
|
||||
except Exception as e:
|
||||
print(f"Error running bot: {str(e)}")
|
||||
print("Check that the OpenWebUI server is running and accessible.")
|
||||
Reference in New Issue
Block a user