mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 17:30:23 +08:00
refactor: 移除 Python 后端源码,全面迁移至 Rust gateway 架构
- 删除全部 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)
This commit is contained in:
45
_deprecated_py_src/services/provider/format.py
Normal file
45
_deprecated_py_src/services/provider/format.py
Normal file
@@ -0,0 +1,45 @@
|
||||
"""
|
||||
Endpoint signature 辅助函数。
|
||||
|
||||
调度/编排链路使用 endpoint signature key:`family:kind`(如 "claude:chat", "openai:cli")。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from src.core.api_format.enums import ApiFamily, EndpointKind
|
||||
from src.core.api_format.signature import (
|
||||
EndpointSignature,
|
||||
make_signature_key,
|
||||
normalize_signature_key,
|
||||
)
|
||||
|
||||
DEFAULT_ENDPOINT_SIGNATURE: str = make_signature_key(ApiFamily.CLAUDE, EndpointKind.CHAT)
|
||||
|
||||
|
||||
def normalize_endpoint_signature(
|
||||
value: str | EndpointSignature | tuple[ApiFamily, EndpointKind] | None,
|
||||
*,
|
||||
default: str = DEFAULT_ENDPOINT_SIGNATURE,
|
||||
) -> str:
|
||||
"""
|
||||
将任意输入归一化为 canonical signature key(`family:kind`,小写)。
|
||||
|
||||
不支持旧格式(如 "CLAUDE_CLI"),仅接受 `family:kind` 格式。
|
||||
解析失败时返回默认值。
|
||||
"""
|
||||
if value is None:
|
||||
return default
|
||||
if isinstance(value, EndpointSignature):
|
||||
return value.key
|
||||
if isinstance(value, tuple) and len(value) == 2:
|
||||
fam, kind = value
|
||||
if isinstance(fam, ApiFamily) and isinstance(kind, EndpointKind):
|
||||
return make_signature_key(fam, kind)
|
||||
return default
|
||||
if isinstance(value, str):
|
||||
try:
|
||||
return normalize_signature_key(value)
|
||||
except ValueError:
|
||||
# 如果解析失败,返回默认值
|
||||
return default
|
||||
return default
|
||||
Reference in New Issue
Block a user