mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
feat(api): add optimistic locking to LLM model config updates
- Include `version` field in all LLM model config response schemas - Add `expected_version` parameter to update endpoints for optimistic locking - Handle concurrent modification errors with HTTP 409 Conflict status - Update both user and group config endpoints consistently
This commit is contained in:
1 parent
9315f06e1f
commit
161b7feb01
5 files changed
+92
-8
No files matched your search
@@ -58,6 +58,7 @@ class LLMModelConfigUpdate(BaseModel):
|
||||
api_key: Optional[str] = None
|
||||
max_tokens: Optional[int] = Field(None, gt=0)
|
||||
is_default: Optional[bool] = None
|
||||
expected_version: Optional[int] = Field(None, description="Expected version for optimistic locking")
|
||||
|
||||
# Allow extra fields for extensibility
|
||||
model_config = ConfigDict(extra="allow")
|
||||
@@ -72,6 +73,7 @@ class LLMModelConfigResponse(DateTimeModelMixin):
|
||||
user_id: Optional[UUID] = None
|
||||
group_id: Optional[UUID] = None
|
||||
is_default: bool
|
||||
version: int = Field(..., description="Optimistic locking version")
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
|
||||
Reference in new issue
Block a user