mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 09:20:22 +08:00
refactor: 调度器迁移至独立模块,消除 services->api 反向依赖
- 将调度器相关模块从 src/services/cache/ 迁移到 src/services/scheduling/ - 下沉类型定义到 core 层: AccessRestrictions, ProviderAuthInfo, ParsedChunk/StreamStats, 视频工具函数 - 提取 thinking_cache 签名缓存到 core/api_format/conversion/ - 提取 provider 认证逻辑到 services/provider/auth - 提取遥测记录到 services/usage/telemetry - 提取 models 列表缓存到 services/cache/model_list_cache - 更新所有引用方的 import 路径及相关测试
This commit is contained in:
@@ -2,8 +2,8 @@ from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from src.core.api_format.conversion.thinking_cache import ThinkingSignatureCache
|
||||
from src.services.provider.adapters.antigravity.constants import DUMMY_THOUGHT_SIGNATURE
|
||||
from src.services.provider.adapters.antigravity.signature_cache import ThinkingSignatureCache
|
||||
|
||||
# 测试用签名(需 >= MIN_SIGNATURE_LENGTH=50)
|
||||
_SIG_A = "a" * 60
|
||||
@@ -54,11 +54,11 @@ def test_tool_signature_short_ignored() -> None:
|
||||
|
||||
|
||||
def test_tool_signature_cache_enforces_limit(monkeypatch: Any) -> None:
|
||||
import src.services.provider.adapters.antigravity.signature_cache as sc_mod
|
||||
import src.core.api_format.conversion.thinking_cache as tc_mod
|
||||
|
||||
# Use a small limit to make eviction deterministic in tests.
|
||||
monkeypatch.setattr(sc_mod, "_TOOL_CACHE_LIMIT", 3)
|
||||
cache = sc_mod.ThinkingSignatureCache()
|
||||
monkeypatch.setattr(tc_mod, "_TOOL_CACHE_LIMIT", 3)
|
||||
cache = tc_mod.ThinkingSignatureCache()
|
||||
cache.cache_tool_signature("toolu_1", _SIG_A)
|
||||
cache.cache_tool_signature("toolu_2", _SIG_B)
|
||||
cache.cache_tool_signature("toolu_3", _SIG_C)
|
||||
|
||||
Reference in New Issue
Block a user