mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-03 01:40:21 +08:00
refactor: 移除独立 hub/proxy/executor/gateway crate,统一为 gateway tunnel 架构
- 删除 aether-hub、aether-proxy 独立项目及其 Dockerfile/配置 - 删除 crates/aether-executor 和 crates/aether-gateway 全部模块 - 新增 apps/ 目录作为应用入口 - 将 hub 概念重构为 gateway tunnel transport - 将 executor 重构为 execution runtime - 新增 tunnel.rs 合约定义和 testkit tunnel/execution_runtime 模块 - 更新 Python 服务层和测试适配新架构命名
This commit is contained in:
@@ -6,9 +6,9 @@ from unittest.mock import AsyncMock
|
||||
import pytest
|
||||
|
||||
from src.api.handlers.base.endpoint_checker import EndpointCheckRequest, HttpRequestExecutor
|
||||
from src.services.request.rust_executor_client import (
|
||||
RustExecutorStreamResult,
|
||||
RustExecutorSyncResult,
|
||||
from src.services.request.execution_runtime_client import (
|
||||
ExecutionRuntimeStreamResult,
|
||||
ExecutionRuntimeSyncResult,
|
||||
)
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ async def test_endpoint_checker_sync_prefers_rust_executor(
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
from src.api.handlers.base import endpoint_checker as mod
|
||||
from src.services.request import rust_executor_client as rust_mod
|
||||
from src.services.request import execution_runtime_client as rust_mod
|
||||
|
||||
monkeypatch.setattr(mod.config, "executor_backend", "rust")
|
||||
|
||||
@@ -42,15 +42,15 @@ async def test_endpoint_checker_sync_prefers_rust_executor(
|
||||
async def _fake_execute_sync_json(
|
||||
self: object,
|
||||
plan: Any,
|
||||
) -> RustExecutorSyncResult:
|
||||
) -> ExecutionRuntimeSyncResult:
|
||||
captured["plan"] = plan
|
||||
return RustExecutorSyncResult(
|
||||
return ExecutionRuntimeSyncResult(
|
||||
status_code=200,
|
||||
response_json={"id": "resp_1", "usage": {"prompt_tokens": 1, "completion_tokens": 2}},
|
||||
headers={"content-type": "application/json"},
|
||||
)
|
||||
|
||||
monkeypatch.setattr(rust_mod.RustExecutorClient, "execute_sync_json", _fake_execute_sync_json)
|
||||
monkeypatch.setattr(rust_mod.ExecutionRuntimeClient, "execute_sync_json", _fake_execute_sync_json)
|
||||
|
||||
result = await executor.execute(
|
||||
EndpointCheckRequest(
|
||||
@@ -80,7 +80,7 @@ async def test_endpoint_checker_stream_prefers_rust_executor(
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
from src.api.handlers.base import endpoint_checker as mod
|
||||
from src.services.request import rust_executor_client as rust_mod
|
||||
from src.services.request import execution_runtime_client as rust_mod
|
||||
|
||||
monkeypatch.setattr(mod.config, "executor_backend", "rust")
|
||||
|
||||
@@ -98,15 +98,15 @@ async def test_endpoint_checker_stream_prefers_rust_executor(
|
||||
|
||||
stream_ctx = _DummyStreamContext()
|
||||
|
||||
async def _fake_execute_stream(self: object, plan: Any) -> RustExecutorStreamResult:
|
||||
return RustExecutorStreamResult(
|
||||
async def _fake_execute_stream(self: object, plan: Any) -> ExecutionRuntimeStreamResult:
|
||||
return ExecutionRuntimeStreamResult(
|
||||
status_code=200,
|
||||
headers={"content-type": "text/event-stream"},
|
||||
byte_iterator=_byte_iter(),
|
||||
response_ctx=stream_ctx,
|
||||
)
|
||||
|
||||
monkeypatch.setattr(rust_mod.RustExecutorClient, "execute_stream", _fake_execute_stream)
|
||||
monkeypatch.setattr(rust_mod.ExecutionRuntimeClient, "execute_stream", _fake_execute_stream)
|
||||
|
||||
result = await executor.execute(
|
||||
EndpointCheckRequest(
|
||||
|
||||
Reference in New Issue
Block a user