update:1.后端新增API配置预设管理接口,支持API配置预设并保存到数据库 2.前端Settings页面重构为Tab布局,新增配置预设管理功能页面 3.优化角色/组织更新逻辑,修复组织字段同步问题 4.更新组织管理-组织成员UI显示,支持翻页显示和跳转
This commit is contained in:
@@ -61,6 +61,12 @@ class CharacterUpdate(BaseModel):
|
||||
organization_purpose: Optional[str] = None
|
||||
organization_members: Optional[str] = None
|
||||
traits: Optional[str] = None
|
||||
|
||||
# 组织额外字段(会同步到Organization表)
|
||||
power_level: Optional[int] = Field(None, description="组织势力等级(0-100)")
|
||||
location: Optional[str] = Field(None, description="组织所在地")
|
||||
motto: Optional[str] = Field(None, description="组织格言/口号")
|
||||
color: Optional[str] = Field(None, description="组织代表颜色")
|
||||
|
||||
|
||||
class CharacterResponse(CharacterBase):
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""设置相关的Pydantic模型"""
|
||||
from pydantic import BaseModel, Field, ConfigDict
|
||||
from typing import Optional
|
||||
from typing import Optional, List
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
@@ -34,4 +34,62 @@ class SettingsResponse(SettingsBase):
|
||||
id: str
|
||||
user_id: str
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
|
||||
# ========== API配置预设相关模型 ==========
|
||||
|
||||
class APIKeyPresetConfig(BaseModel):
|
||||
"""预设配置内容"""
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
api_provider: str = Field(..., description="API提供商")
|
||||
api_key: str = Field(..., description="API密钥")
|
||||
api_base_url: Optional[str] = Field(None, description="自定义API地址")
|
||||
llm_model: str = Field(..., description="模型名称")
|
||||
temperature: float = Field(default=0.7, ge=0.0, le=2.0, description="温度参数")
|
||||
max_tokens: int = Field(default=2000, ge=1, description="最大token数")
|
||||
|
||||
|
||||
class APIKeyPreset(BaseModel):
|
||||
"""API配置预设"""
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
id: str = Field(..., description="预设ID")
|
||||
name: str = Field(..., min_length=1, max_length=50, description="预设名称")
|
||||
description: Optional[str] = Field(None, max_length=200, description="预设描述")
|
||||
is_active: bool = Field(default=False, description="是否激活")
|
||||
created_at: datetime = Field(..., description="创建时间")
|
||||
config: APIKeyPresetConfig = Field(..., description="配置内容")
|
||||
|
||||
|
||||
class PresetCreateRequest(BaseModel):
|
||||
"""创建预设请求"""
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
name: str = Field(..., min_length=1, max_length=50, description="预设名称")
|
||||
description: Optional[str] = Field(None, max_length=200, description="预设描述")
|
||||
config: APIKeyPresetConfig = Field(..., description="配置内容")
|
||||
|
||||
|
||||
class PresetUpdateRequest(BaseModel):
|
||||
"""更新预设请求"""
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
name: Optional[str] = Field(None, min_length=1, max_length=50, description="预设名称")
|
||||
description: Optional[str] = Field(None, max_length=200, description="预设描述")
|
||||
config: Optional[APIKeyPresetConfig] = Field(None, description="配置内容")
|
||||
|
||||
|
||||
class PresetResponse(APIKeyPreset):
|
||||
"""预设响应"""
|
||||
pass
|
||||
|
||||
|
||||
class PresetListResponse(BaseModel):
|
||||
"""预设列表响应"""
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
presets: List[PresetResponse] = Field(..., description="预设列表")
|
||||
total: int = Field(..., description="总数")
|
||||
active_preset_id: Optional[str] = Field(None, description="当前激活的预设ID")
|
||||
Reference in New Issue
Block a user