mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
- 删除全部 Python 源码 (src/) 及 Alembic 迁移脚本,归档至 _deprecated_py_src/ - 重构 Rust gateway ai_pipeline: 拆分 planner/finalize 模块,新增 contracts/adaptation 层 - 重组 handlers 模块为 admin/public/proxy/internal/shared 子模块结构 - 新增 executor 模块,引入 Rust 原生数据库迁移 (aether-data/migrations) - 简化 CI/Docker 构建流程,移除 base image 二级构建,统一为单一 app image - 移除 Python 相关基础设施文件 (entrypoint.sh, gunicorn_conf.py, Dockerfile.base)
65 lines
1.8 KiB
Python
65 lines
1.8 KiB
Python
"""
|
||
Provider API Key相关的API模型
|
||
"""
|
||
|
||
from datetime import datetime
|
||
|
||
from pydantic import BaseModel, ConfigDict, Field
|
||
|
||
|
||
class ProviderAPIKeyBase(BaseModel):
|
||
"""Provider API Key基础模型"""
|
||
|
||
name: str | None = Field(None, description="密钥名称/备注")
|
||
api_key: str = Field(..., description="API密钥")
|
||
rpm_limit: int | None = Field(None, description="RPM限制(每分钟请求数),NULL=自适应模式")
|
||
priority: int = Field(0, description="优先级(越高越优先使用)")
|
||
is_active: bool = Field(True, description="是否启用")
|
||
expires_at: datetime | None = Field(None, description="过期时间")
|
||
|
||
|
||
class ProviderAPIKeyCreate(ProviderAPIKeyBase):
|
||
"""创建Provider API Key请求"""
|
||
|
||
pass
|
||
|
||
|
||
class ProviderAPIKeyUpdate(BaseModel):
|
||
"""更新Provider API Key请求"""
|
||
|
||
name: str | None = None
|
||
api_key: str | None = None
|
||
rpm_limit: int | None = None
|
||
priority: int | None = None
|
||
is_active: bool | None = None
|
||
expires_at: datetime | None = None
|
||
|
||
|
||
class ProviderAPIKeyResponse(ProviderAPIKeyBase):
|
||
"""Provider API Key响应"""
|
||
|
||
id: str
|
||
provider_id: str
|
||
request_count: int | None = Field(0, description="请求次数")
|
||
error_count: int | None = Field(0, description="错误次数")
|
||
last_used_at: datetime | None = Field(None, description="最后使用时间")
|
||
last_error_at: datetime | None = Field(None, description="最后错误时间")
|
||
last_error_msg: str | None = Field(None, description="最后错误信息")
|
||
created_at: datetime
|
||
updated_at: datetime
|
||
|
||
model_config = ConfigDict(from_attributes=True)
|
||
|
||
|
||
class ProviderAPIKeyStats(BaseModel):
|
||
"""Provider API Key统计信息"""
|
||
|
||
id: str
|
||
name: str | None
|
||
request_count: int
|
||
error_count: int
|
||
success_rate: float
|
||
last_used_at: datetime | None
|
||
is_active: bool
|
||
is_expired: bool
|