stock-ai-agent/backend/run.sh
2026-04-25 13:20:28 +08:00

48 lines
1.3 KiB
Bash

#!/bin/bash
set -e
echo "================================"
echo "Crypto Agent - 运行前检查"
echo "================================"
echo ""
cd /Users/aaron/source_code/Stock_Agent/backend
if [ ! -d "venv" ]; then
echo "❌ 虚拟环境不存在"
exit 1
fi
source venv/bin/activate
echo "1. 测试核心模块导入..."
python3 << 'EOF'
from app.config import get_settings
from app.models.database import Base, Message
from app.services.cache_service import cache_service
from app.services.llm_service import llm_service
from app.crypto_agent.crypto_agent import get_crypto_agent
print(" ✓ 配置模块")
print(" ✓ 数据库模型")
print(" ✓ 缓存服务")
print(" ✓ LLM 服务")
print(" ✓ Crypto Agent")
EOF
echo ""
echo "2. 检查配置..."
python3 << 'EOF'
from app.config import get_settings
settings = get_settings()
print(f" DeepSeek Key: {'✓ 已配置' if settings.deepseek_api_key else '❌ 未配置'}")
print(f" 智谱AI Key: {'✓ 已配置' if settings.zhipuai_api_key else '❌ 未配置'}")
print(f" 数据库: {settings.database_url}")
print(f" 监听: {settings.api_host}:{settings.api_port}")
print(f" Bitget 实盘: {'开启' if settings.bitget_trading_enabled else '关闭'}")
EOF
echo ""
echo "启动应用..."
python3 -m app.main