Build lightweight AI agent admin
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
"""
|
||||
LLM 提供商 Schema
|
||||
"""
|
||||
from typing import Optional
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, Field, ConfigDict
|
||||
|
||||
from app.base_schema import CSTDatetime
|
||||
|
||||
|
||||
class ProviderCreate(BaseModel):
|
||||
"""创建提供商"""
|
||||
name: str = Field(..., max_length=100, description="提供商名称")
|
||||
provider_type: str = Field(..., description="提供商类型")
|
||||
api_key: str = Field(default="", description="API Key")
|
||||
api_base: str = Field(default="", description="API 地址")
|
||||
api_version: str = Field(default="", description="API 版本")
|
||||
ollama_host: str = Field(default="http://localhost:11434", description="Ollama 地址")
|
||||
description: str = Field(default="", description="描述")
|
||||
is_active: bool = Field(default=True, description="是否启用")
|
||||
|
||||
|
||||
class ProviderUpdate(BaseModel):
|
||||
"""更新提供商"""
|
||||
name: Optional[str] = Field(None, max_length=100)
|
||||
api_key: Optional[str] = None
|
||||
api_base: Optional[str] = None
|
||||
api_version: Optional[str] = None
|
||||
ollama_host: Optional[str] = None
|
||||
description: Optional[str] = None
|
||||
is_active: Optional[bool] = None
|
||||
|
||||
|
||||
class ProviderResponse(BaseModel):
|
||||
"""提供商输出"""
|
||||
id: str
|
||||
name: str
|
||||
provider_type: str
|
||||
api_key_masked: str = ""
|
||||
api_base: str = ""
|
||||
api_version: str = ""
|
||||
ollama_host: str = ""
|
||||
description: str = ""
|
||||
is_active: bool = True
|
||||
quota_limit: int = 0
|
||||
quota_used: int = 0
|
||||
sort: int = 0
|
||||
sys_create_datetime: Optional[CSTDatetime] = None
|
||||
sys_update_datetime: Optional[CSTDatetime] = None
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
|
||||
class ProviderListResponse(BaseModel):
|
||||
"""提供商列表输出"""
|
||||
id: str
|
||||
name: str
|
||||
provider_type: str
|
||||
is_active: bool = True
|
||||
description: str = ""
|
||||
sys_create_datetime: Optional[CSTDatetime] = None
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
|
||||
class ProviderTypeResponse(BaseModel):
|
||||
"""提供商类型"""
|
||||
type: str
|
||||
name: str
|
||||
Reference in New Issue
Block a user