Made changes to suit Openwebui
This commit is contained in:
+8
-15
@@ -2,44 +2,37 @@
|
||||
|
||||
# Stop any existing service
|
||||
pkill -f "uvicorn ai_service.api:app" || true
|
||||
pkill -f "run_ai_service.py" || true
|
||||
|
||||
# Create data directory if it doesn't exist
|
||||
mkdir -p ai_service/data
|
||||
|
||||
# Set environment variables for testing
|
||||
# In production, replace these with your actual API keys
|
||||
export PINECONE_API_KEY="test-pinecone-api-key"
|
||||
export PINECONE_ENVIRONMENT="test-pinecone-environment"
|
||||
export OPENAI_API_KEY="test-openai-api-key"
|
||||
|
||||
# Create empty files for local storage if they don't exist
|
||||
touch ai_service/data/chatbot.db
|
||||
touch ai_service/data/document_metadata.json
|
||||
touch ai_service/data/chats.json
|
||||
|
||||
# For testing purposes, we'll use a simplified API
|
||||
echo "Starting Simple API Service on port 5251..."
|
||||
# Start the AI service
|
||||
echo "Starting AI Service on port 5251..."
|
||||
VENV_PATH="./venv"
|
||||
PYTHON_PATH="$VENV_PATH/bin/python"
|
||||
|
||||
# Check if the virtual environment exists
|
||||
if [ -f "$PYTHON_PATH" ]; then
|
||||
echo "Using Python from virtual environment: $PYTHON_PATH"
|
||||
# Use the simplified API for testing
|
||||
nohup $PYTHON_PATH simple_api.py > ai_service.log 2>&1 &
|
||||
nohup $PYTHON_PATH run_ai_service.py > ai_service.log 2>&1 &
|
||||
else
|
||||
echo "Virtual environment not found at $VENV_PATH, using system Python"
|
||||
nohup python simple_api.py > ai_service.log 2>&1 &
|
||||
nohup python run_ai_service.py > ai_service.log 2>&1 &
|
||||
fi
|
||||
|
||||
# Wait a moment for the service to start
|
||||
sleep 2
|
||||
|
||||
# Check if the service is running
|
||||
if pgrep -f "simple_api.py" > /dev/null; then
|
||||
if pgrep -f "run_ai_service.py" > /dev/null; then
|
||||
echo "AI Service started successfully on port 5251"
|
||||
echo "Check ai_service.log for output"
|
||||
echo "To stop the service, run: pkill -f \"simple_api.py\""
|
||||
echo "To stop the service, run: pkill -f \"run_ai_service.py\""
|
||||
|
||||
# Test the health endpoint
|
||||
echo -e "\nTesting health endpoint..."
|
||||
@@ -60,7 +53,7 @@ response = requests.post(
|
||||
json={
|
||||
"user_id": "test_user",
|
||||
"title": "Test Chat",
|
||||
"model_id": "gpt-3.5-turbo"
|
||||
"model_id": "llama3.1"
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user