Refactor Phase 2: Split stories.py into Schema/Service/Controller, add missing endpoints, fix async bug

This commit is contained in:
zhangtuo
2026-02-10 17:14:54 +08:00
parent c351d16d3e
commit 9cdff18336
13 changed files with 881 additions and 612 deletions

View File

@@ -121,7 +121,7 @@ def mock_text_provider():
cover_prompt_suggestion="A cute rabbit",
)
with patch("app.api.stories.generate_story_content", new_callable=AsyncMock) as mock:
with patch("app.services.story_service.generate_story_content", new_callable=AsyncMock) as mock:
mock.return_value = mock_result
yield mock
@@ -129,7 +129,7 @@ def mock_text_provider():
@pytest.fixture
def mock_image_provider():
"""Mock 图像生成。"""
with patch("app.api.stories.generate_image", new_callable=AsyncMock) as mock:
with patch("app.services.story_service.generate_image", new_callable=AsyncMock) as mock:
mock.return_value = "https://example.com/image.png"
yield mock
@@ -137,7 +137,7 @@ def mock_image_provider():
@pytest.fixture
def mock_tts_provider():
"""Mock TTS。"""
with patch("app.api.stories.text_to_speech", new_callable=AsyncMock) as mock:
with patch("app.services.provider_router.text_to_speech", new_callable=AsyncMock) as mock:
mock.return_value = b"fake-audio-bytes"
yield mock