Fix llm vendor update bug

This commit is contained in:
Xin Wang
2026-02-09 00:03:11 +08:00
parent be68e335f1
commit 0fc56e2685
3 changed files with 8 additions and 0 deletions

View File

@@ -79,6 +79,8 @@ def update_llm_model(id: str, data: LLMModelUpdate, db: Session = Depends(get_db
raise HTTPException(status_code=404, detail="LLM Model not found")
update_data = data.model_dump(exclude_unset=True)
if "type" in update_data and update_data["type"] is not None and hasattr(update_data["type"], "value"):
update_data["type"] = update_data["type"].value
for field, value in update_data.items():
setattr(model, field, value)

View File

@@ -129,6 +129,8 @@ class LLMModelCreate(LLMModelBase):
class LLMModelUpdate(BaseModel):
name: Optional[str] = None
vendor: Optional[str] = None
type: Optional[LLMModelType] = None
base_url: Optional[str] = None
api_key: Optional[str] = None
model_name: Optional[str] = None