refactor: 重构 AgentScope 运行时模块并优化前端附件展示

This commit is contained in:
qzl
2026-03-13 15:42:01 +08:00
parent a10a2db27a
commit 4c10929498
28 changed files with 1494 additions and 2163 deletions
@@ -4,7 +4,7 @@ from types import SimpleNamespace
import pytest
import v1.agent.attachment_storage as attachment_storage_module
from services.base.supabase import SupabaseService
class _FakeBucket:
@@ -34,9 +34,11 @@ class _FakeStorage:
async def test_attachment_storage_rejects_unexpected_bucket(
monkeypatch: pytest.MonkeyPatch,
) -> None:
storage = attachment_storage_module.AgentAttachmentStorage()
from core.config.settings import config as app_config
storage = SupabaseService()
monkeypatch.setattr(
attachment_storage_module.config.storage,
app_config.storage,
"bucket",
"allowed-bucket",
)
@@ -54,16 +56,18 @@ async def test_attachment_storage_rejects_unexpected_bucket(
async def test_attachment_storage_accepts_configured_bucket(
monkeypatch: pytest.MonkeyPatch,
) -> None:
storage = attachment_storage_module.AgentAttachmentStorage()
from core.config.settings import config as app_config
storage = SupabaseService()
fake_bucket = _FakeBucket()
fake_client = SimpleNamespace(storage=_FakeStorage(fake_bucket))
monkeypatch.setattr(
attachment_storage_module.config.storage,
app_config.storage,
"bucket",
"allowed-bucket",
)
monkeypatch.setattr(
attachment_storage_module.supabase_service,
storage,
"get_admin_client",
lambda: fake_client,
)