Files
brunoandQwen-Coder 439ad8a854 feat: Upgrade to real-world dynamic stock recommendation system with Claude + Qwen3 AI collaboration
- Implement dynamic stock universe with 3-stage filtering (liquidity, fundamentals, technicals)
- Create Claude + Qwen3 AI collaboration service for intelligent stock analysis
- Update recommendation routes to use live market data instead of hard-coded lists
- Add new documentation and deployment scripts
- Update Docker configuration for AI model integration

BREAKING CHANGE: Replaces hard-coded stock recommendations with dynamic market-based filtering

Co-authored-by: Qwen-Coder <[email protected]>
2025-11-16 12:43:03 +08:00

158 lines
4.1 KiB
Bash
Executable File

#!/bin/bash
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
# Configuration
BACKEND_PORT=8000
FRONTEND_PORT=5173
print_msg() {
echo -e "${GREEN}[INFO]${NC} $1"
}
print_warn() {
echo -e "${YELLOW}[WARN]${NC} $1"
}
print_step() {
echo -e "\n${BLUE}==>${NC} $1"
}
# Detect OS
if [[ "$OSTYPE" == "darwin"* ]]; then
OS="macos"
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
OS="linux"
else
OS="unknown"
fi
# Stop frontend
stop_frontend() {
print_step "Stopping frontend..."
if [ -f ".frontend.pid" ]; then
local frontend_pid=$(cat .frontend.pid)
if ps -p $frontend_pid > /dev/null 2>&1; then
print_msg "Stopping frontend (PID: $frontend_pid)..."
kill $frontend_pid 2>/dev/null || kill -9 $frontend_pid 2>/dev/null
rm -f .frontend.pid
print_msg "Frontend stopped"
else
print_msg "Frontend is not running"
rm -f .frontend.pid
fi
else
# Try to kill by port
if lsof -Pi :$FRONTEND_PORT -sTCP:LISTEN -t >/dev/null 2>&1; then
print_msg "Killing process on port $FRONTEND_PORT..."
lsof -ti:$FRONTEND_PORT | xargs kill -9 2>/dev/null || true
else
print_msg "Frontend is not running"
fi
fi
}
# Stop backend
stop_backend() {
print_step "Stopping backend..."
if lsof -Pi :$BACKEND_PORT -sTCP:LISTEN -t >/dev/null 2>&1; then
print_msg "Killing backend on port $BACKEND_PORT..."
lsof -ti:$BACKEND_PORT | xargs kill -9 2>/dev/null || true
print_msg "Backend stopped"
else
print_msg "Backend is not running"
fi
}
# Stop PostgreSQL
stop_postgres() {
print_step "Stopping PostgreSQL..."
if [ "$OS" = "macos" ]; then
if command -v brew >/dev/null 2>&1; then
brew services stop postgresql@16 2>/dev/null || brew services stop postgresql 2>/dev/null || \
print_warn "PostgreSQL not managed by Homebrew"
print_msg "PostgreSQL stopped"
fi
elif [ "$OS" = "linux" ]; then
sudo systemctl stop postgresql 2>/dev/null || \
print_warn "PostgreSQL not managed by systemd"
print_msg "PostgreSQL stopped"
fi
}
# Stop Redis
stop_redis() {
print_step "Stopping Redis..."
if [ "$OS" = "macos" ]; then
if command -v brew >/dev/null 2>&1; then
brew services stop redis 2>/dev/null || \
print_warn "Redis not managed by Homebrew"
print_msg "Redis stopped"
fi
elif [ "$OS" = "linux" ]; then
sudo systemctl stop redis 2>/dev/null || sudo systemctl stop redis-server 2>/dev/null || \
print_warn "Redis not managed by systemd"
print_msg "Redis stopped"
fi
}
# Main
main() {
echo -e "${BLUE}Stopping Claude Stock Development Environment${NC}\n"
# Parse arguments
STOP_DB=false
while [[ $# -gt 0 ]]; do
case $1 in
--all)
STOP_DB=true
shift
;;
--help)
echo "Usage: $0 [OPTIONS]"
echo ""
echo "Stop Claude Stock development services"
echo ""
echo "Options:"
echo " --all Stop databases (PostgreSQL and Redis) as well"
echo " --help Show this help message"
echo ""
echo "By default, only frontend and backend are stopped."
echo "Use --all to also stop PostgreSQL and Redis."
exit 0
;;
*)
echo -e "${RED}Unknown option: $1${NC}"
echo "Use --help for usage information"
exit 1
;;
esac
done
# Stop services
stop_frontend
stop_backend
if [ "$STOP_DB" = true ]; then
stop_postgres
stop_redis
else
print_msg "\nPostgreSQL and Redis are still running"
print_msg "To stop them, run: $0 --all"
fi
echo ""
print_msg "All services stopped"
}
main "$@"