Integrate OpenWebUI bot with AI service
This commit is contained in:
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Script to run the AI service locally for testing
|
||||
# This script activates the virtual environment and runs the service with uvicorn
|
||||
|
||||
# Check if the virtual environment exists
|
||||
if [ ! -d "venv" ]; then
|
||||
echo "Virtual environment not found. Creating one..."
|
||||
python -m venv venv
|
||||
source venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
else
|
||||
source venv/bin/activate
|
||||
fi
|
||||
|
||||
# Create a directory for logs
|
||||
mkdir -p logs
|
||||
|
||||
# Set environment variables for local testing
|
||||
export API_HOST=0.0.0.0
|
||||
export API_PORT=5252
|
||||
export PUBLIC_URL=http://localhost:5252 # For local testing
|
||||
export PYTHONPATH=$PYTHONPATH:$(pwd)
|
||||
|
||||
# Check if .env file exists
|
||||
if [ ! -f "ai_service/.env" ]; then
|
||||
echo "Warning: .env file not found in ai_service directory."
|
||||
echo "Creating a basic .env file from .env.example..."
|
||||
|
||||
if [ -f "ai_service/.env.example" ]; then
|
||||
cp ai_service/.env.example ai_service/.env
|
||||
echo "Created .env file from .env.example. Please edit it with your actual values."
|
||||
else
|
||||
echo "Error: .env.example file not found. Please create a .env file manually."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Run the service with uvicorn
|
||||
echo "Starting AI service on http://localhost:5252"
|
||||
echo "Press Ctrl+C to stop the service"
|
||||
uvicorn ai_service.api:app --host $API_HOST --port $API_PORT --reload
|
||||
Reference in New Issue
Block a user