Skip to content

Commit 20ca527

Browse files
committed
fix:修正chunk.choices 空值/空列表检查方式
1 parent 2566fb8 commit 20ca527

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

astrbot/core/provider/sources/openai_source.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,8 @@ async def _query_stream(
326326
exc_info=True,
327327
)
328328
logger.warning(f"Saving chunk state error: {e}")
329-
if len(chunk.choices) == 0:
329+
330+
if not chunk.choices or len(chunk.choices) == 0:
330331
continue
331332
delta = chunk.choices[0].delta
332333
# logger.debug(f"chunk delta: {delta}")

0 commit comments

Comments
 (0)