mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 09:20:22 +08:00
feat: 扩展 Rust gateway 全功能模块,新增 billing/crypto/wallet crate 及完整数据层
- 新增 aether-billing、aether-crypto、aether-wallet 独立 crate - aether-data 扩展 repository 层:announcements、auth_modules、billing、 candidate_selection、gemini_file_mappings、global_models、management_tokens、 oauth_providers、proxy_nodes、quota、users、wallet 等模块 - aether-gateway 新增 api/auth/billing/control/middleware/scheduler/usage/ video_tasks/hooks/maintenance/model_fetch/provider_transport 等功能模块 - 重构 executor decision 和 gateway state 为模块目录结构 - 新增 gateway router、frontdoor 路由层及对应测试 - Python 侧 API 路由重构,新增 compat/support 模块 - 前端 Logo 组件更新及 Provider 管理页面调整
This commit is contained in:
@@ -5,11 +5,12 @@ from types import SimpleNamespace
|
||||
from typing import Any
|
||||
|
||||
import pytest
|
||||
from fastapi.responses import Response, StreamingResponse
|
||||
from fastapi.responses import StreamingResponse
|
||||
|
||||
import src.api.handlers.openai.video_handler as video_mod
|
||||
from src.api.handlers.openai.video_handler import OpenAIVideoHandler
|
||||
from src.core.api_format.conversion.internal_video import VideoStatus
|
||||
from src.core.exceptions import ProviderNotAvailableException
|
||||
from src.services.request.rust_executor_client import (
|
||||
RustExecutorClientError,
|
||||
RustExecutorStreamResult,
|
||||
@@ -157,7 +158,7 @@ async def test_handle_download_content_uses_rust_executor_for_upstream_content_e
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_handle_download_content_falls_back_to_python_proxy_when_rust_unavailable(
|
||||
async def test_handle_download_content_raises_when_rust_executor_unavailable(
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
monkeypatch.setattr(video_mod.config, "executor_backend", "rust")
|
||||
@@ -178,21 +179,11 @@ async def test_handle_download_content_falls_back_to_python_proxy_when_rust_unav
|
||||
del self, plan
|
||||
raise RustExecutorClientError("executor down")
|
||||
|
||||
fallback_response = Response(content=b"python-fallback", media_type="video/mp4")
|
||||
|
||||
async def _fake_proxy_direct_url(url: str, task_id: str) -> Response:
|
||||
assert url == "https://cdn.example.com/video.mp4"
|
||||
assert task_id == "task-1"
|
||||
return fallback_response
|
||||
|
||||
monkeypatch.setattr(video_mod.RustExecutorClient, "execute_stream", _failing_execute_stream)
|
||||
monkeypatch.setattr(handler, "_proxy_direct_url", _fake_proxy_direct_url)
|
||||
|
||||
response = await handler.handle_download_content(
|
||||
task_id="task-1",
|
||||
http_request=SimpleNamespace(),
|
||||
original_headers={},
|
||||
query_params={"variant": "video"},
|
||||
)
|
||||
|
||||
assert response is fallback_response
|
||||
with pytest.raises(ProviderNotAvailableException):
|
||||
await handler.handle_download_content(
|
||||
task_id="task-1",
|
||||
http_request=SimpleNamespace(),
|
||||
original_headers={},
|
||||
query_params={"variant": "video"},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user