refactor: 精简环境配置,移除废弃配置项

.env:
- 移除 HOST/PORT/DEBUG(代码未读取,由 uvicorn 命令行控制)
- 移除 WEWORK_BOT_SEARCH_LIMIT(已被 SEARCH_LIMIT 取代)
- 补充硅基流动配置注释

.env.example:
- 同步移除 HOST/PORT/DEBUG/WEWORK_BOT_SEARCH_LIMIT
- 补充 OpenAI 兼容硅基流动的说明
- 更新机器人注释(集成模式自动启动)

config.py:
- 移除 HOST/PORT/DEBUG 字段定义
- 移除 WEWORK_BOT_SEARCH_LIMIT 字段定义

wework_bot.py:
- 改为从 settings 统一读取配置(不再 os.getenv)
- _get_search_limit fallback 改为 settings.SEARCH_LIMIT
- 更新模块文档注释
This commit is contained in:
EduBrain Dev
2026-04-14 13:54:16 +08:00
parent eb18b5cffc
commit 36a6debcb3
3 changed files with 17 additions and 30 deletions

View File

@@ -153,11 +153,6 @@ class Settings(BaseSettings):
SEARCH_LIMIT: int = Field(default=3, description="图片搜索默认返回数量(1-10)")
JUDGE_BATCH_SIZE: int = Field(default=10, description="每次LLM判断的文章数量(1-50)")
# ──────────────────────────── 服务端口 ────────────────────────────
HOST: str = Field(default="0.0.0.0", description="服务监听地址")
PORT: int = Field(default=8000, description="服务监听端口")
DEBUG: bool = Field(default=False, description="调试模式")
# ──────────────────────────── CORS ────────────────────────────
CORS_ORIGINS: list[str] = Field(
default=["*"],
@@ -177,12 +172,6 @@ class Settings(BaseSettings):
default=None,
description="企业微信智能机器人 Secret",
)
WEWORK_BOT_SEARCH_LIMIT: int = Field(
default=3,
ge=1,
le=10,
description="企业微信机器人搜索返回图片数量上限",
)
EDUBRAIN_BASE_URL: str = Field(
default="http://localhost:8765",
description="EduBrain 后端服务地址,企业微信机器人通过此地址调用后端 API搜索/OCR识别等。当机器人与后端部署在同一台机器时使用默认值 http://localhost:8765若机器人独立部署到其他服务器需改为后端的实际访问地址如 http://192.168.1.100:8765",