From 3deaa7dcaa6b6cf2a962ce25eccddb7086b803a6 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 9 Feb 2026 12:52:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=20AI=20=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E9=85=8D=E7=BD=AE=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 明确使用 OneAPI/OneInAll 等中转服务商,不直连 AI 厂商 - 创建 CONVENTIONS.md 记录项目约定,避免误解 Co-Authored-By: Claude Opus 4.5 --- CONVENTIONS.md | 29 +++++++++++++++++++++++++++++ backend/app/config.py | 9 +++++---- 2 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 CONVENTIONS.md diff --git a/CONVENTIONS.md b/CONVENTIONS.md new file mode 100644 index 0000000..4397c6d --- /dev/null +++ b/CONVENTIONS.md @@ -0,0 +1,29 @@ +# 项目约定与设计决策 + +本文档记录容易被误解的设计决策,确保开发一致性。 + +--- + +## AI 服务配置 + +**重要:系统使用 AI 中转服务商,不直连 AI 厂商!** + +- 使用 OneAPI / OneInAll / OpenRouter 等中转服务商 +- 中转服务商统一了不同 AI 厂商(豆包、通义、DeepSeek 等)的接口 +- 只需配置中转服务商的 API Key 和 Base URL +- 具体使用哪个底层模型,由中转服务商的模型名称决定 + +```python +# 正确 ✓ +AI_PROVIDER = "oneapi" +AI_API_BASE_URL = "https://api.oneinall.ai/v1" + +# 错误 ✗ - 不直接配置 AI 厂商 +AI_PROVIDER = "doubao" +``` + +--- + +## 其他约定 + +(后续添加) diff --git a/backend/app/config.py b/backend/app/config.py index a6653df..6641122 100644 --- a/backend/app/config.py +++ b/backend/app/config.py @@ -21,10 +21,11 @@ class Settings(BaseSettings): ALGORITHM: str = "HS256" ACCESS_TOKEN_EXPIRE_MINUTES: int = 30 - # AI 服务 - AI_PROVIDER: str = "doubao" # doubao | qwen | deepseek - AI_API_KEY: str = "" - AI_API_BASE_URL: str = "" + # AI 服务(使用 OneAPI/OneInAll 等中转服务商,不直连厂商) + # 中转服务商统一了不同 AI 厂商的接口,只需配置中转商的 API + AI_PROVIDER: str = "oneapi" # oneapi | oneinall | openrouter 等中转服务商 + AI_API_KEY: str = "" # 中转服务商的 API Key + AI_API_BASE_URL: str = "" # 中转服务商的 Base URL,如 https://api.oneinall.ai/v1 class Config: env_file = ".env"