Bug Description
The temperature field in the LLM Model Pool API is silently ignored — it is never persisted to the database on both create and update operations, despite being fully defined in schema, model, and migration.
Environment
- File:
backend/app/api/enterprise.py
Root Cause
Bug 1: POST /api/enterprise/llm-models (create)
In add_llm_model(), the LLMModel constructor receives all fields from LLMModelCreate except temperature:
model = LLMModel(
provider=data.provider,
model=data.model,
api_key_encrypted=data.api_key,
base_url=data.base_url,
label=data.label,
# temperature=data.temperature, # <-- MISSING
max_tokens_per_day=data.max_tokens_per_day,
enabled=data.enabled,
supports_vision=data.supports_vision,
tenant_id=uuid.UUID(tid) if tid else None,
)
###Bug 2 - PUT /api/enterprise/llm-models/{model_id} (update):
update_llm_model() 里漏了:
# if data.temperature is not None:
# model.temperature = data.temperature
Fix:
--- a/backend/app/api/enterprise.py
+++ b/backend/app/api/enterprise.py
@@ -122,6 +122,7 @@ async def add_llm_model(
api_key_encrypted=data.api_key,
base_url=data.base_url,
label=data.label,
+ temperature=data.temperature,
max_tokens_per_day=data.max_tokens_per_day,
enabled=data.enabled,
supports_vision=data.supports_vision,
@@ -199,6 +200,8 @@ async def update_llm_model(
if data.api_key and data.api_key.strip() and not data.api_key.startswith('****'):
model.api_key_encrypted = data.api_key.strip()
+ if data.temperature is not None:
+ model.temperature = data.temperature
if data.max_tokens_per_day is not None:
model.max_tokens_per_day = data.max_tokens_per_day
Bug Description
The
temperaturefield in the LLM Model Pool API is silently ignored — it is never persisted to the database on both create and update operations, despite being fully defined in schema, model, and migration.Environment
backend/app/api/enterprise.pyRoot Cause
Bug 1:
POST /api/enterprise/llm-models(create)In
add_llm_model(), theLLMModelconstructor receives all fields fromLLMModelCreateexcepttemperature: