Merge branch 'patch-1'
This commit is contained in:
@@ -200,6 +200,15 @@ async def openai_complete_if_cache(
|
|||||||
async def inner():
|
async def inner():
|
||||||
try:
|
try:
|
||||||
async for chunk in response:
|
async for chunk in response:
|
||||||
|
# Check if choices exists and is not empty
|
||||||
|
if not hasattr(chunk, 'choices') or not chunk.choices:
|
||||||
|
logger.warning(f"Received chunk without choices: {chunk}")
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Check if delta exists and has content
|
||||||
|
if not hasattr(chunk.choices[0], 'delta') or not hasattr(chunk.choices[0].delta, 'content'):
|
||||||
|
logger.warning(f"Received chunk without delta content: {chunk.choices[0]}")
|
||||||
|
continue
|
||||||
content = chunk.choices[0].delta.content
|
content = chunk.choices[0].delta.content
|
||||||
if content is None:
|
if content is None:
|
||||||
continue
|
continue
|
||||||
|
Reference in New Issue
Block a user