mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 17:30:23 +08:00
feat: 动态 block 索引分配、OAuth 自动启停联动与 Antigravity 签名注入增强
- Gemini/OpenAI normalizer 改为按实际出现顺序延迟分配 thinking/text block 索引 - OAuth 失效标记时自动停用 Key,清除/刷新成功时自动启用 - Antigravity thought signature 注入支持 tool-specific 签名优先,再回退 session 级签名 - Claude normalizer 对非字符串 thinking block 降级为 UnknownBlock - Gemini normalizer 反序列化时为 Antigravity 目标补充 signature - signature_cache _prune 增加超限驱逐 - model/provider 包 __init__ 改为惰性导入避免循环依赖 - build_antigravity_url 复制 query_params 防止修改调用方原始字典 - upstream_fetcher build_all_format_configs 兼容非 EndpointFetchConfig 对象 - Antigravity HTTP 状态判定扩展与 Gemini endpoint check 支持 v1internal - 新增 thought signature 注入与 signature cache 驱逐测试 Closes #165 Co-authored-by: AAEE86 <ppk0227@hotmail.com>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from src.services.provider.adapters.antigravity.constants import DUMMY_THOUGHT_SIGNATURE
|
||||
from src.services.provider.adapters.antigravity.signature_cache import ThinkingSignatureCache
|
||||
|
||||
@@ -51,6 +53,22 @@ def test_tool_signature_short_ignored() -> None:
|
||||
assert cache.get_tool_signature("toolu_123") is None
|
||||
|
||||
|
||||
def test_tool_signature_cache_enforces_limit(monkeypatch: Any) -> None:
|
||||
import src.services.provider.adapters.antigravity.signature_cache as sc_mod
|
||||
|
||||
# Use a small limit to make eviction deterministic in tests.
|
||||
monkeypatch.setattr(sc_mod, "_TOOL_CACHE_LIMIT", 3)
|
||||
cache = sc_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)
|
||||
cache.cache_tool_signature("toolu_4", _SIG_D)
|
||||
|
||||
# Oldest entry should be evicted once the limit is exceeded.
|
||||
assert cache.get_tool_signature("toolu_1") is None
|
||||
assert cache.get_tool_signature("toolu_4") == _SIG_D
|
||||
|
||||
|
||||
# ===== Layer 2: Thinking Families =====
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user