mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
docs: restructure LLM model configs API documentation for nested config object
Update API documentation to reflect new nested `config` object structure in LLM model configurations endpoints. The response format now encapsulates provider-specific fields (provider, base_url, model, temperature, api_key, max_tokens) within a `config` object, while moving ownership metadata (user_id, group_id, is_default, version, created_at, updated_at) to the top level. This aligns the user-facing endpoints with the group configuration structure and improves API consistency.
This commit is contained in:
1 parent
176b39145b
commit
f4723cd083
3 files changed
+80
-46
No files matched your search
@@ -465,10 +465,15 @@ class LLMModelConfigsRepository(BaseRepository):
|
||||
"config_id": config.config_id,
|
||||
"name": config.name,
|
||||
"model_type": config.model_type,
|
||||
"source": "user",
|
||||
"group_name": None,
|
||||
"config": config_dict,
|
||||
"user_id": config.user_id,
|
||||
"group_id": config.group_id,
|
||||
"is_default": config.is_default,
|
||||
**config_dict
|
||||
"version": config.version,
|
||||
"created_at": config.created_at,
|
||||
"updated_at": config.updated_at,
|
||||
"source": "user",
|
||||
"group_name": None
|
||||
})
|
||||
|
||||
if config.is_default and default_config is None:
|
||||
@@ -487,10 +492,15 @@ class LLMModelConfigsRepository(BaseRepository):
|
||||
"config_id": config.config_id,
|
||||
"name": config.name,
|
||||
"model_type": config.model_type,
|
||||
"source": "group",
|
||||
"group_name": group_names_map[group_id],
|
||||
"config": config_dict,
|
||||
"user_id": config.user_id,
|
||||
"group_id": config.group_id,
|
||||
"is_default": config.is_default,
|
||||
**config_dict
|
||||
"version": config.version,
|
||||
"created_at": config.created_at,
|
||||
"updated_at": config.updated_at,
|
||||
"source": "group",
|
||||
"group_name": group_names_map[group_id]
|
||||
})
|
||||
|
||||
if config.is_default and default_config is None:
|
||||
|
||||
@@ -99,25 +99,21 @@ class LLMModelConfigResponse(DateTimeModelMixin):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
|
||||
class LLMModelConfigWithSource(BaseModel):
|
||||
class LLMModelConfigWithSource(DateTimeModelMixin):
|
||||
"""Model configuration with source information (for inheritance)."""
|
||||
|
||||
config_id: UUID
|
||||
name: str
|
||||
model_type: ModelType
|
||||
config: LLMModelConfigData
|
||||
user_id: Optional[UUID] = None
|
||||
group_id: Optional[UUID] = None
|
||||
is_default: bool
|
||||
version: int
|
||||
source: str = Field(..., description="Source: 'user' or 'group'")
|
||||
group_name: Optional[str] = Field(None, description="Group name if source is 'group'")
|
||||
is_default: bool
|
||||
# Config fields
|
||||
provider: str
|
||||
base_url: str
|
||||
model: str
|
||||
temperature: float
|
||||
api_key: Optional[str] = None
|
||||
max_tokens: Optional[int] = None
|
||||
|
||||
# Allow extra config fields
|
||||
model_config = ConfigDict(extra="allow")
|
||||
model_config = ConfigDict(from_attributes=True, extra="allow")
|
||||
|
||||
|
||||
class LLMModelConfigInheritedResponse(BaseModel):
|
||||
|
||||
Reference in new issue
Block a user