Add OpenWebUI bot integration for channels feature
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
"""
|
||||
Script to run the OpenWebUI AI bot.
|
||||
|
||||
This script runs the AI bot example from the openwebui-bot repository.
|
||||
This script runs the custom AI bot from the openwebui-bot repository.
|
||||
"""
|
||||
|
||||
import sys
|
||||
@@ -10,17 +10,16 @@ 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 the AI example
|
||||
from examples.ai import main
|
||||
# Import the main function from the custom AI example
|
||||
from examples.custom_ai import main, shutdown
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("Starting OpenWebUI AI bot...")
|
||||
print("Starting OpenWebUI bot...")
|
||||
print("Press Ctrl+C to stop")
|
||||
|
||||
try:
|
||||
@@ -28,7 +27,11 @@ if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
except KeyboardInterrupt:
|
||||
print("\nBot stopped by user")
|
||||
# No need to call shutdown here as it's handled in the main function
|
||||
# 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.")
|
||||
|
||||
Reference in New Issue
Block a user