From 85235fb045e9929828b95851bd22e00427ff44d4 Mon Sep 17 00:00:00 2001 From: xiamuceer-j Date: Wed, 25 Feb 2026 09:21:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DAPI=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2-=E9=85=8D=E7=BD=AE=E9=A2=84=E8=AE=BE?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E4=BF=9D=E5=AD=98=E7=B3=BB=E7=BB=9F=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E8=AF=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/api/settings.py | 4 +++- backend/app/schemas/settings.py | 1 + frontend/src/pages/Settings.tsx | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/app/api/settings.py b/backend/app/api/settings.py index 5e06f20..5043a0a 100644 --- a/backend/app/api/settings.py +++ b/backend/app/api/settings.py @@ -1012,6 +1012,7 @@ async def activate_preset( settings.llm_model = config['llm_model'] settings.temperature = config['temperature'] settings.max_tokens = config['max_tokens'] + settings.system_prompt = config.get('system_prompt') # 更新所有预设的is_active状态 for preset in presets: @@ -1093,7 +1094,8 @@ async def create_preset_from_current( api_base_url=settings.api_base_url, llm_model=settings.llm_model, temperature=settings.temperature, - max_tokens=settings.max_tokens + max_tokens=settings.max_tokens, + system_prompt=settings.system_prompt ) # 创建预设 diff --git a/backend/app/schemas/settings.py b/backend/app/schemas/settings.py index b53d7f5..500ab6c 100644 --- a/backend/app/schemas/settings.py +++ b/backend/app/schemas/settings.py @@ -50,6 +50,7 @@ class APIKeyPresetConfig(BaseModel): llm_model: str = Field(..., description="模型名称") temperature: float = Field(default=0.7, ge=0.0, le=2.0, description="温度参数") max_tokens: int = Field(default=2000, ge=1, description="最大token数") + system_prompt: Optional[str] = Field(default=None, description="系统级别提示词") class APIKeyPreset(BaseModel): diff --git a/frontend/src/pages/Settings.tsx b/frontend/src/pages/Settings.tsx index d4fa90f..e2ed945 100644 --- a/frontend/src/pages/Settings.tsx +++ b/frontend/src/pages/Settings.tsx @@ -502,6 +502,7 @@ export default function SettingsPage() { llm_model: values.llm_model, temperature: values.temperature, max_tokens: values.max_tokens, + system_prompt: values.system_prompt, }; if (editingPreset) {