chore: 简化社区版本地部署的环境变量配置 - #24
Conversation
There was a problem hiding this comment.
Code Review
This pull request simplifies configuration management by streamlining .env.example to only include the most common settings, while relying on code-defined defaults for advanced parameters. The docker-compose.yml has been updated to load environment variables directly from .env instead of mapping them individually, and documentation and tests have been updated accordingly. Feedback on these changes suggests keeping LLM_API_KEY empty in .env.example to avoid false-positive key detection in the UI, making the .env file optional in docker-compose.yml to prevent startup failures when the file is missing, and updating the deployment tests to accommodate this optional configuration.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| LLM_API_TYPE=openai_chat | ||
| LLM_MODEL=deepseek-v4-flash | ||
| LLM_BASE_URL=https://api.deepseek.com | ||
| LLM_API_KEY=your-llm-api-key |
| ports: | ||
| - "${PAPERSEEK_PORT:-8765}:${PAPERSEEK_CONTAINER_PORT:-7860}" | ||
| restart: unless-stopped | ||
| env_file: .env |
| self.assertIn("PORT: ${PAPERSEEK_CONTAINER_PORT:-7860}", compose) | ||
| self.assertIn("LLM_PROVIDER", compose) | ||
| self.assertIn("OPENALEX_API_KEY", compose) | ||
| self.assertIn("env_file: .env", compose) |
a9af808 to
b9fdaa3
Compare
|
@gemini-code-assist 感谢 review,已按建议调整:
本地测试已通过,请再次 review。 |
There was a problem hiding this comment.
Code Review
This pull request simplifies configuration by removing advanced and optional environment variables from .env.example and docker-compose.yml, relying instead on reasonable defaults defined in the code. The documentation and deployment tests have been updated accordingly. The reviewer noted that completely removing environment variables from docker-compose.yml prevents host shell environment variables from being passed to the container, and suggested declaring them without default values to allow pass-through.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| environment: | ||
| PORT: ${PAPERSEEK_CONTAINER_PORT:-7860} |
There was a problem hiding this comment.
在 docker-compose.yml 中,完全移除这些环境变量声明会导致宿主机的 Shell 环境变量(例如通过 export LLM_API_KEY=... 设置的变量)无法传递给容器。\n\n根据 README 中的说明:'已经存在的系统环境变量优先于 .env'。为了保持这一行为,并在不引入默认值冗余的前提下允许 Shell 变量透传,建议在 environment 中以无默认值的方式声明这些关键变量。这样 Docker Compose 会自动从宿主机环境透传同名变量,且其优先级高于 env_file。
environment:\n PORT: ${PAPERSEEK_CONTAINER_PORT:-7860}\n LLM_PROVIDER:\n LLM_API_TYPE:\n LLM_MODEL:\n LLM_BASE_URL:\n LLM_API_KEY:\n OPENALEX_API_KEY:\n OPENALEX_EMAIL:\n CROSSREF_EMAIL:\n WOS_API_KEY:\n SEARCH_FIELD:\n DISCIPLINE_FIELDS:b9fdaa3 to
1bb282c
Compare
|
@gemini-code-assist 已按 review 调整: 在
同时保留可选的 测试已更新并全部通过。 |
|
感谢你的详细说明和测试更新。目前的配置方案在 |
修复 #23。
变更内容
社区版本地部署时需要填写的环境变量过多,本 PR 将不常改动的参数从
.env.example中移除,改为依赖代码中的默认值,从而简化部署流程。主要改动
.env.example:精简为仅保留最常用的配置项:LLM_PROVIDER、LLM_API_TYPE、LLM_MODEL、LLM_BASE_URL、LLM_API_KEY)OPENALEX_API_KEY、OPENALEX_EMAIL、CROSSREF_EMAIL、WOS_API_KEY)SEARCH_FIELD、DISCIPLINE_FIELDS)DATA_SOURCE、TARGET_MIN/TARGET_MAX、MAX_ITERATIONS、EXPAND_CITATIONS、RANKING_BATCH_SIZE、LLM_TIMEOUT_SECONDS、PAPERSEEK_HISTORY_ENABLED等)均已在代码中提供合理默认值,需要时再覆盖即可。docker-compose.yml:改用env_file: .env加载环境变量,仅显式保留容器端口相关配置,避免重复维护大量默认值。README.md:更新「环境变量」章节,区分常用变量与高级变量,并说明默认值位置。docs/deployment.md:同步 Docker 环境变量说明。tests/test_deployment.py:更新 compose 测试断言,验证env_file: .env的使用。验证
本地运行测试套件:
结果:82 个测试通过(1 个跳过,因未安装
mcp包)。