gnilets commited on
Commit
7c0e6e9
·
verified ·
1 Parent(s): 68851b7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -127,7 +127,7 @@ async def proxy_openai_api(request: Request):
127
 
128
  async for chunk in stream_response.aiter_bytes():
129
  if chunk.strip():
130
- yield chunk.strip() + '\n'
131
 
132
  except RequestError as exc:
133
  raise HTTPException(status_code=500, detail=f'произошла ошибка при запросе: {exc}')
@@ -145,10 +145,10 @@ async def proxy_openai_api(request: Request):
145
 
146
  async def combined_generator():
147
  if first_chunk.strip():
148
- yield first_chunk.strip() + '\n'
149
  async for chunk in response_generator:
150
  if chunk.strip():
151
- yield chunk.strip() + '\n'
152
 
153
  return OverrideStreamResponse(combined_generator(), headers=headers_to_forward)
154
  except StopAsyncIteration:
 
127
 
128
  async for chunk in stream_response.aiter_bytes():
129
  if chunk.strip():
130
+ yield chunk.strip() + b'\n'
131
 
132
  except RequestError as exc:
133
  raise HTTPException(status_code=500, detail=f'произошла ошибка при запросе: {exc}')
 
145
 
146
  async def combined_generator():
147
  if first_chunk.strip():
148
+ yield first_chunk.strip() + b'\n'
149
  async for chunk in response_generator:
150
  if chunk.strip():
151
+ yield chunk.strip() + b'\n'
152
 
153
  return OverrideStreamResponse(combined_generator(), headers=headers_to_forward)
154
  except StopAsyncIteration: