Mark abstract image/vision generators as real async generators

`ImageGenService.run_image_gen` and `VisionService.run_vision` were
declared `async def ... -> AsyncGenerator[Frame, None]` with `pass`
bodies. Without a `yield` anywhere in the body, Python treats the
function as a coroutine returning an `AsyncGenerator`, not as an async
generator itself, so callers got a coroutine where they expected an
iterator.

Add `raise NotImplementedError; yield` so the body contains a yield
(making this a real async generator) while still raising cleanly if a
subclass ever calls `super().run_*` by mistake.
This commit is contained in:
Mark Backman
2026-04-22 11:19:23 -04:00
parent 14cd476b20
commit 457eb7aa92
3 changed files with 4 additions and 4 deletions

View File

@@ -57,7 +57,8 @@ class ImageGenService(AIService):
Frame: Frames containing the generated image (typically ImageRawFrame
or URLImageRawFrame).
"""
pass
raise NotImplementedError
yield # pragma: no cover
async def process_frame(self, frame: Frame, direction: FrameDirection):
"""Process frames for image generation.

View File

@@ -59,7 +59,8 @@ class VisionService(AIService):
Frame: Frames containing the vision analysis results, typically TextFrame
objects with descriptions or answers.
"""
pass
raise NotImplementedError
yield # pragma: no cover
async def process_frame(self, frame: Frame, direction: FrameDirection):
"""Process frames, handling vision image frames for analysis.