配置修改
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

@@ -40,3 +40,34 @@ QDRANT_COLLECTION_NAME=mem0_user_memories
# 前端 API 地址(本地开发时需显式配置) # 前端 API 地址(本地开发时需显式配置)
# 注意:这里只需要域名和端口,不需要 /chat 路径 # 注意:这里只需要域名和端口,不需要 /chat 路径
API_URL=http://localhost:8083 API_URL=http://localhost:8083
```
```
# ============================================================================
# AI Agent 项目环境变量配置
# ⚠️ 重要:此文件包含敏感信息,请勿提交到版本控制系统!
# ============================================================================
# AI 模型 API Keys必须配置
ZHIPUAI_API_KEY=your_zhipu_api_key_here
DEEPSEEK_API_KEY=your_deepseek_api_key_here
LLAMACPP_API_KEY=your_llamacpp_api_key_here
# 日志配置(可选,有默认值)
LOG_LEVEL=WARNING
DEBUG=false
ENABLE_GRAPH_TRACE=false
# 数据库配置(可选,有默认值)
DB_URI=postgresql://postgres:mysecretpassword@db:5432/langgraph_db?sslmode=disable
# Qdrant 配置(可选,有默认值)
QDRANT_URL=http://qdrant:6333
QDRANT_COLLECTION_NAME=mem0_user_memories
# llama.cpp 服务配置(可选,有默认值)
VLLM_BASE_URL=http://llamacpp:8081/v1
VLLM_EMBEDDING_URL=http://llamacpp:8082/v1
# 前端 API 地址(可选,有默认值)
API_URL=http://localhost:8083

View File

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

176
.gitignore vendored
View File

@@ -1,13 +1,8 @@
# ---> Python # ---> Python
# Byte-compiled / optimized / DLL files
__pycache__/ __pycache__/
*.py[cod] *.py[cod]
*$py.class *$py.class
# C extensions
*.so *.so
# Distribution / packaging
.Python .Python
build/ build/
develop-eggs/ develop-eggs/
@@ -21,169 +16,40 @@ parts/
sdist/ sdist/
var/ var/
wheels/ wheels/
share/python-wheels/
*.egg-info/ *.egg-info/
.installed.cfg .installed.cfg
*.egg *.egg
MANIFEST
# PyInstaller # Virtual Environment
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# UV
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
#uv.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/ venv/
env/
ENV/ ENV/
env.bak/ .venv
venv.bak/
# IDE 配置 # IDE
.vscode/ .vscode/
.idea/ .idea/
*.swp
*.swo
*~
# 日志和数据 # Logs
logs/ logs/
*.log *.log
# Environment Variables重要防止密钥泄露
.env
.env.local
.env.*.local
# Docker
docker-compose.override.yml
# Data
data/*.db data/*.db
data/*.sqlite data/*.sqlite
# Docker 卷数据 # OS
pg_data/ .DS_Store
Thumbs.db
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
# Ruff stuff:
.ruff_cache/
# PyPI configuration file
.pypirc