stock-ai-agent/backend/start.sh
2026-02-03 10:08:15 +08:00

65 lines
1.6 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# A股AI分析Agent系统 - 启动脚本(改进版)
echo "================================"
echo "A股AI分析Agent系统"
echo "================================"
echo ""
# 检查.env文件
if [ ! -f "../.env" ] && [ ! -f ".env" ]; then
echo "❌ 错误: 未找到.env配置文件"
echo ""
echo "请先配置环境变量:"
echo " cd .."
echo " cp .env.example .env"
echo " # 编辑.env文件填写API密钥"
exit 1
fi
# 检查虚拟环境
if [ ! -d "venv" ]; then
echo "❌ 错误: 虚拟环境不存在"
echo ""
echo "请先运行安装脚本:"
echo " cd .."
echo " ./install.sh"
exit 1
fi
# 激活虚拟环境
echo "激活虚拟环境..."
source venv/bin/activate
# 检查Python版本
python_version=$(python --version 2>&1 | awk '{print $2}')
echo "Python版本: $python_version"
# 显示配置信息
echo ""
echo "配置信息:"
python -c "
from app.config import get_settings
settings = get_settings()
print(f' Tushare Token: {'已配置' if settings.tushare_token else '未配置'}')
print(f' 智谱AI Key: {'已配置' if settings.zhipuai_api_key else '未配置'}')
print(f' 数据库: {settings.database_url}')
print(f' 监听地址: {settings.api_host}:{settings.api_port}')
"
echo ""
echo "================================"
echo "启动服务..."
echo "================================"
echo ""
echo "访问地址:"
echo " 前端界面: http://localhost:8000"
echo " API文档: http://localhost:8000/docs"
echo ""
echo "按 Ctrl+C 停止服务"
echo ""
# 启动应用
python -m app.main