mirror of
https://github.com/fawney19/Aether.git
synced 2026-01-03 16:22:27 +08:00
refactor(global-model): migrate model metadata to flexible config structure
将模型配置从多个固定字段(description, official_url, icon_url, default_supports_* 等) 统一为灵活的 config JSON 字段,提高扩展性。同时优化前端模型创建表单,支持从 models-dev 列表直接选择模型快速填充。 主要变更: - 后端:模型表迁移,支持 config JSON 存储模型能力和元信息 - 前端:GlobalModelFormDialog 支持两种创建方式(列表选择/手动填写) - API 类型更新,对齐新的数据结构
This commit is contained in:
@@ -62,7 +62,6 @@ class GlobalModelService:
|
||||
query = query.filter(
|
||||
(GlobalModel.name.ilike(search_pattern))
|
||||
| (GlobalModel.display_name.ilike(search_pattern))
|
||||
| (GlobalModel.description.ilike(search_pattern))
|
||||
)
|
||||
|
||||
# 按名称排序
|
||||
@@ -75,21 +74,15 @@ class GlobalModelService:
|
||||
db: Session,
|
||||
name: str,
|
||||
display_name: str,
|
||||
description: Optional[str] = None,
|
||||
official_url: Optional[str] = None,
|
||||
icon_url: Optional[str] = None,
|
||||
is_active: Optional[bool] = True,
|
||||
# 按次计费配置
|
||||
default_price_per_request: Optional[float] = None,
|
||||
# 阶梯计费配置(必填)
|
||||
default_tiered_pricing: dict = None,
|
||||
# 默认能力配置
|
||||
default_supports_vision: Optional[bool] = None,
|
||||
default_supports_function_calling: Optional[bool] = None,
|
||||
default_supports_streaming: Optional[bool] = None,
|
||||
default_supports_extended_thinking: Optional[bool] = None,
|
||||
# Key 能力配置
|
||||
supported_capabilities: Optional[List[str]] = None,
|
||||
# 模型配置(JSON)
|
||||
config: Optional[dict] = None,
|
||||
) -> GlobalModel:
|
||||
"""创建 GlobalModel"""
|
||||
# 检查名称是否已存在
|
||||
@@ -100,21 +93,15 @@ class GlobalModelService:
|
||||
global_model = GlobalModel(
|
||||
name=name,
|
||||
display_name=display_name,
|
||||
description=description,
|
||||
official_url=official_url,
|
||||
icon_url=icon_url,
|
||||
is_active=is_active,
|
||||
# 按次计费配置
|
||||
default_price_per_request=default_price_per_request,
|
||||
# 阶梯计费配置
|
||||
default_tiered_pricing=default_tiered_pricing,
|
||||
# 默认能力配置
|
||||
default_supports_vision=default_supports_vision,
|
||||
default_supports_function_calling=default_supports_function_calling,
|
||||
default_supports_streaming=default_supports_streaming,
|
||||
default_supports_extended_thinking=default_supports_extended_thinking,
|
||||
# Key 能力配置
|
||||
supported_capabilities=supported_capabilities,
|
||||
# 模型配置(JSON)
|
||||
config=config,
|
||||
)
|
||||
|
||||
db.add(global_model)
|
||||
|
||||
Reference in New Issue
Block a user