mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-11 19:59:50 +08:00
refactor: 全局适配 ApiFamily/EndpointKind 结构化标识体系
将新的 (ApiFamily, EndpointKind) / `family:kind` 签名体系应用到整个代码库: - API Handlers: 所有 adapter/handler 使用新的签名格式 - Services: provider, model, usage, cache, auth 等服务层适配 - Database: ProviderEndpoint 新增 api_family/endpoint_kind 字段 - Frontend: Provider 管理、Usage 表格等组件适配 - Tests: 更新所有相关测试用例
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
import ipaddress
|
||||
from datetime import datetime, timezone
|
||||
from typing import Any
|
||||
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
from sqlalchemy.orm import Session
|
||||
@@ -159,9 +159,7 @@ class ManagementTokenService:
|
||||
ValueError: 如果名称已存在或超过数量限制
|
||||
"""
|
||||
# 检查用户 Token 数量限制
|
||||
token_count = (
|
||||
db.query(ManagementToken).filter(ManagementToken.user_id == user_id).count()
|
||||
)
|
||||
token_count = db.query(ManagementToken).filter(ManagementToken.user_id == user_id).count()
|
||||
max_tokens = config.management_token_max_per_user
|
||||
if token_count >= max_tokens:
|
||||
raise ValueError(f"已达到 Token 数量上限({max_tokens})")
|
||||
@@ -335,9 +333,7 @@ class ManagementTokenService:
|
||||
return token
|
||||
|
||||
@staticmethod
|
||||
def delete_token(
|
||||
db: Session, token_id: str, user_id: str | None = None
|
||||
) -> bool:
|
||||
def delete_token(db: Session, token_id: str, user_id: str | None = None) -> bool:
|
||||
"""删除 Token
|
||||
|
||||
Args:
|
||||
|
||||
Reference in New Issue
Block a user