mirror of
https://github.com/agentscope-ai/ReMe.git
synced 2026-09-22 00:32:49 +00:00
- Remove abstract methods from base component start/close - Update BaseJob to remove name parameter and simplify initialization - Change file modification time field from mtime_ms to modified_time in seconds - Add type checking imports and improve typing annotations - Implement LocalFileStore with JSONL persistence for file chunks - Add MdFileParser with markdown and frontmatter support - Simplify HttpClient call method with proper kwargs handling - Remove unused ReMe class methods and create backup version - Update StreamJob to use step_components instead of steps attribute
20 lines
641 B
Python
20 lines
641 B
Python
"""Streaming job for real-time output delivery."""
|
|
|
|
from .base_job import BaseJob
|
|
from ..component_registry import R
|
|
from ..runtime_context import RuntimeContext
|
|
from ...enumeration import ChunkEnum
|
|
|
|
|
|
@R.register("stream")
|
|
class StreamJob(BaseJob):
|
|
"""Job that streams results to a queue in real-time."""
|
|
|
|
async def __call__(self, **kwargs):
|
|
context = RuntimeContext(stream=True, **kwargs)
|
|
try:
|
|
for step in self.step_components:
|
|
await step(context)
|
|
except Exception as e:
|
|
await context.add_stream_string(str(e), ChunkEnum.ERROR)
|
|
await context.add_stream_done()
|