fix(api): 移除硬编码 OpenAI 密钥;统一配置 schema 为 hertz.port#1
Open
Conversation
- openai: read OPENAI_API_KEY from env; offline fallback if missing
- config: switch dev.yaml to {service.name,hertz.port,logger.level}
- docs: README config section clarifies schema and load order
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更内容
OPENAI_API_KEY读取;当缺少密钥或externalDashboardURL时走离线降级(不会报错,返回结构化占位数据)。services/api/configs/dev.yaml统一为以下 schema,和程序读取保持一致:service.name: apihertz.port: "8080"logger.level: "info"services/api/README.md增加“Config”章节,说明加载顺序、env 覆盖、YAML 示例。背景动机
server.port,与代码期望的hertz.port不一致;统一 schema 以减少困扰。影响范围
/api/v1/pendle/points/analyze:OPENAI_API_KEY时将始终使用离线降级(行为更稳定且安全)。OPENAI_API_KEY后恢复在线分析。services/api/configs/dev.yaml(已更新为新 schema)。RUNTIME_CONF_ROOT/config.yaml(make prepare-conf生成的结构与新 schema 一致)。兼容性/迁移指引
config.yaml且使用server.port:hertz.port: "<port>"。make prepare-conf的场景,无需变更。风险与缓解
server.port会导致端口未按预期生效验证步骤
make dev-backend NAME=api PORT=8080GET /healthz、GET /api/v1/ping正常OPENAI_API_KEY:GET /api/v1/pendle/points/analyze?...返回离线占位数据(含 summary/evidence)OPENAI_API_KEY:返回在线分析结构services/api/configs/dev.yaml或output/conf/config.yaml(hertz.port字段)启动,端口生效相关文件
清单