mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-03 01:40:21 +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:
50
_deprecated_py_src/services/model/pricing_strategy.py
Normal file
50
_deprecated_py_src/services/model/pricing_strategy.py
Normal file
@@ -0,0 +1,50 @@
|
||||
"""
|
||||
计费相关数据类
|
||||
|
||||
定义计费计算所需的数据结构。
|
||||
实际的计费能力已收敛到 core.api_format 注册表,避免依赖 API Adapter。
|
||||
|
||||
数据类:
|
||||
- UsageTokens: 请求的 token 使用量
|
||||
- PricingConfig: 价格配置
|
||||
- CostResult: 计费结果
|
||||
"""
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
|
||||
@dataclass
|
||||
class UsageTokens:
|
||||
"""请求的 token 使用量"""
|
||||
|
||||
input_tokens: int = 0
|
||||
output_tokens: int = 0
|
||||
cache_creation_input_tokens: int = 0
|
||||
cache_read_input_tokens: int = 0
|
||||
|
||||
|
||||
@dataclass
|
||||
class PricingConfig:
|
||||
"""价格配置"""
|
||||
|
||||
input_price_per_1m: float = 0.0
|
||||
output_price_per_1m: float = 0.0
|
||||
cache_creation_price_per_1m: float | None = None
|
||||
cache_read_price_per_1m: float | None = None
|
||||
price_per_request: float | None = None
|
||||
tiered_pricing: dict | None = None
|
||||
cache_ttl_minutes: int | None = None
|
||||
|
||||
|
||||
@dataclass
|
||||
class CostResult:
|
||||
"""计费结果"""
|
||||
|
||||
input_cost: float = 0.0
|
||||
output_cost: float = 0.0
|
||||
cache_creation_cost: float = 0.0
|
||||
cache_read_cost: float = 0.0
|
||||
cache_cost: float = 0.0
|
||||
request_cost: float = 0.0
|
||||
total_cost: float = 0.0
|
||||
tier_index: int | None = None # 命中的阶梯索引
|
||||
Reference in New Issue
Block a user