Files
wp-agentic-writer/downloads/agentic-writer-local-backend/start-proxy.sh
Dwindi Ramadhana d2c10756ab Add AI writing assistant plugin with local backend, brave search, and image generation support
- Implement local backend AI provider with Ollama integration
- Add Brave Search API integration for real-time search suggestions
- Add image generation manager with multiple AI providers
- Create hybrid provider system with local/cloud fallback
- Add comprehensive settings UI with provider management
- Implement Gutenberg sidebar with writing assistance controls
- Add SEO schema generation for AI-generated content
- Multiple provider support: OpenRouter, local backend, Codex
2026-05-17 10:48:05 +07:00

78 lines
2.3 KiB
Bash

#!/bin/bash
echo "🚀 Starting Agentic Writer Local Backend..."
echo ""
# Check dependencies
if ! command -v node &> /dev/null; then
echo "❌ Node.js not found. Install from https://nodejs.org/"
exit 1
fi
if ! command -v claude &> /dev/null; then
echo "❌ Claude CLI not found. Install and configure first."
echo " Check: https://claude.ai/code or https://z.ai"
exit 1
fi
# Auto-install express if needed
if [ ! -d "node_modules" ]; then
echo "📦 Installing dependencies..."
npm install
fi
# Detect local IP
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
LOCAL_IP=$(ipconfig getifaddr en0 2>/dev/null || ipconfig getifaddr en1 2>/dev/null || echo "127.0.0.1")
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
# Linux
LOCAL_IP=$(ip route get 1 | awk '{print $7;exit}' 2>/dev/null || echo "127.0.0.1")
else
# Windows/other
LOCAL_IP="127.0.0.1"
fi
echo "✅ Dependencies OK"
echo "✅ Claude CLI found: $(which claude)"
echo ""
echo "Starting proxy server..."
echo ""
# Start server in background
nohup node claude-proxy.js > proxy.log 2>&1 &
PID=$!
echo $PID > proxy.pid
# Wait for server to boot
sleep 2
# Test if running
if kill -0 $PID 2>/dev/null; then
echo "═══════════════════════════════════════════════════"
echo "✅ Local Backend Running!"
echo "═══════════════════════════════════════════════════"
echo ""
echo "Your Configuration:"
echo " Base URL: http://$LOCAL_IP:8080"
echo " API Key: dummy"
echo " Model: claude-local"
echo ""
echo "Next Steps:"
echo " 1. Open your WordPress Admin"
echo " 2. Go to Agentic Writer → Settings → Local Backend"
echo " 3. Paste the Base URL above"
echo " 4. Click 'Test Connection'"
echo ""
echo "Commands:"
echo " Logs: tail -f proxy.log"
echo " Stop: ./stop-proxy.sh"
echo " Test: ./test-connection.sh"
echo "═══════════════════════════════════════════════════"
else
echo "❌ Failed to start. Check proxy.log for errors."
cat proxy.log
rm -f proxy.pid
exit 1
fi