配置修改
All checks were successful
构建并部署 AI Agent 服务 / deploy (push) Successful in 27s

This commit is contained in:
2026-04-16 04:36:50 +08:00
parent b5cc53c9de
commit 602d551fd1
4 changed files with 75 additions and 166 deletions

View File

@@ -27,29 +27,41 @@ jobs:
echo "⚠️ ZHIPUAI_API_KEY 未注入(将使用空值,智谱模型不可用)"
fi
if [ -n "$VLLM_LOCAL_KEY" ]; then
echo "✅ VLLM_LOCAL_KEY 已注入(长度:${#VLLM_LOCAL_KEY}"
if [ -n "$DEEPSEEK_API_KEY" ]; then
echo "✅ DEEPSEEK_API_KEY 已注入(长度:${#DEEPSEEK_API_KEY}"
else
echo "⚠️ VLLM_LOCAL_KEY 未注入(将使用空值,本地模型不可用)"
echo "⚠️ DEEPSEEK_API_KEY 未注入(将使用空值,DeepSeek模型不可用)"
fi
if [ -n "$LLAMACPP_API_KEY" ]; then
echo "✅ LLAMACPP_API_KEY 已注入(长度:${#LLAMACPP_API_KEY}"
else
echo "⚠️ LLAMACPP_API_KEY 未注入将使用空值本地LLM不可用"
fi
echo ""
echo "💡 提示:如果看到警告,请在 Gitea 仓库 Settings → Actions → Secrets 中添加对应密钥"
env:
ZHIPUAI_API_KEY: ${{ secrets.ZHIPUAI_API_KEY }}
VLLM_LOCAL_KEY: ${{ secrets.VLLM_LOCAL_KEY }}
DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }}
LLAMACPP_API_KEY: ${{ secrets.LLAMACPP_API_KEY }}
- name: 确保基础镜像已拉取
run: |
docker pull python:3.11-slim || true
docker pull postgres:16 || true
docker pull python:3.11-slim || true
docker pull postgres:16 || true
- name: 构建并启动前后端服务(环境变量注入)
env:
ZHIPUAI_API_KEY: ${{ secrets.ZHIPUAI_API_KEY }}
VLLM_LOCAL_KEY: ${{ secrets.VLLM_LOCAL_KEY }}
DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }}
LLAMACPP_API_KEY: ${{ secrets.LLAMACPP_API_KEY }}
run: |
# 方式一:直接在命令前设置环境变量(推荐,避免导出遗漏)
export DOCKER_BUILDKIT=1
ZHIPUAI_API_KEY="$ZHIPUAI_API_KEY" \
DEEPSEEK_API_KEY="$DEEPSEEK_API_KEY" \
LLAMACPP_API_KEY="$LLAMACPP_API_KEY" \
docker compose -f docker/docker-compose.yml up -d --build backend frontend
- name: 健康检查
@@ -57,8 +69,8 @@ jobs:
echo "等待后端服务启动..."
sleep 15
for i in {1..10}; do
# 使用 Docker 默认网桥网关 IP (172.17.0.1) 访问宿主机的端口映射
if curl -f http://172.17.0.1:8001/health > /dev/null 2>&1; then
# 修正端口为 8083与 compose 暴露端口一致)
if curl -f http://172.17.0.1:8083/health > /dev/null 2>&1; then
echo "✅ 后端服务正常"
exit 0
fi