Skip to content

Commit

Permalink
Force body["stream"] in /pipe endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
TanGentleman committed Nov 20, 2024
1 parent c8ba0f5 commit b3e947d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ async def filter_inlet(body: dict) -> dict:
async def pipe_stream(body: dict) -> StreamingResponse:
"""Handle streaming pipe requests."""
try:
body["stream"] = True
response = app_pipe.pipe(body)
if not response:
raise ValueError("Empty response from pipe")
Expand Down Expand Up @@ -151,6 +152,7 @@ async def generate() -> AsyncGenerator[str, None]:
async def pipe_completion(body: dict) -> Dict[str, str]:
"""Handle non-streaming pipe completion requests."""
try:
body["stream"] = False
response = app_pipe.pipe(body)
if not isinstance(response, str):
raise ValueError("Pipe must return a string")
Expand Down

0 comments on commit b3e947d

Please sign in to comment.