mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 09:20:22 +08:00
refactor: 拆分大型模块为 mixin/子模块结构
- cli_handler_base.py 拆分为 7 个 mixin (event/monitor/prefetch/request/sse_helpers/stream/sync) - usage/service.py 拆分为 6 个子模块 (types/active_requests/cache_analysis/lifecycle/pricing/query/recording) - models/database 拆分为独立模型文件 (auth/misc/model/provider/stats/usage/user) - DUMMY_THOUGHT_SIGNATURE 常量提升到 core/api_format/conversion/constants 统一管理 - task/service.py 内联导入提升为顶层导入 - 流处理函数签名移除冗余的 http_client 参数
This commit is contained in:
@@ -80,7 +80,7 @@ def test_convert_sse_line_unwraps_before_convert_stream_chunk() -> None:
|
||||
return []
|
||||
|
||||
with patch(
|
||||
"src.api.handlers.base.cli_handler_base.get_format_converter_registry",
|
||||
"src.api.handlers.base.cli_event_mixin.get_format_converter_registry",
|
||||
return_value=_DummyRegistry(),
|
||||
):
|
||||
_lines, _events = handler._convert_sse_line(ctx, v1_line, [])
|
||||
@@ -189,7 +189,6 @@ async def test_antigravity_forces_conversion_path_in_stream_with_prefetch() -> N
|
||||
]
|
||||
byte_iter = _AsyncIter([]) # no more bytes after prefetch
|
||||
response_ctx = SimpleNamespace(__aexit__=AsyncMock(return_value=None))
|
||||
http_client = SimpleNamespace(aclose=AsyncMock(return_value=None))
|
||||
|
||||
with patch.object(
|
||||
handler,
|
||||
@@ -198,7 +197,7 @@ async def test_antigravity_forces_conversion_path_in_stream_with_prefetch() -> N
|
||||
) as mock_convert:
|
||||
out = []
|
||||
async for chunk in handler._create_response_stream_with_prefetch(
|
||||
ctx, byte_iter, response_ctx, http_client, prefetched # type: ignore[arg-type]
|
||||
ctx, byte_iter, response_ctx, prefetched # type: ignore[arg-type]
|
||||
):
|
||||
out.append(chunk)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user