Files
X-Agents/ai-core/start.ps1

36 lines
1.1 KiB
PowerShell
Raw Normal View History

# AI-Core gRPC Server Startup Script
Write-Host "Starting AI-Core Document Parser gRPC Server..." -ForegroundColor Green
# Check if Python is installed
if (-not (Get-Command python -ErrorAction SilentlyContinue)) {
Write-Host "Error: Python is not installed or not in PATH" -ForegroundColor Red
exit 1
}
# Check if requirements are installed
$requirementsInstalled = python -c "import grpcio" 2>$null
if (-not $?) {
Write-Host "Installing Python dependencies..." -ForegroundColor Yellow
pip install -r requirements.txt
if ($LASTEXITCODE -ne 0) {
Write-Host "Error: Failed to install dependencies" -ForegroundColor Red
exit 1
}
}
# Generate gRPC code if needed
$pb2File = "proto\document_parser_pb2.py"
if (-not (Test-Path $pb2File)) {
Write-Host "Generating gRPC code..." -ForegroundColor Yellow
python generate_grpc.py
if ($LASTEXITCODE -ne 0) {
Write-Host "Error: Failed to generate gRPC code" -ForegroundColor Red
exit 1
}
}
# Start the server
Write-Host "Starting server on port 50051..." -ForegroundColor Green
python main.py --port 50051 --max-workers 10 --log-level INFO