fix solve.py
This commit is contained in:
@ -156,12 +156,20 @@ async def call_api_streaming(
|
||||
try:
|
||||
chunk = json.loads(data)
|
||||
logger.debug(f"[{question_name}] Chunk: {chunk}")
|
||||
delta = chunk.get("choices", [{}])[0].get("delta", {})
|
||||
choices = chunk.get("choices")
|
||||
if not choices:
|
||||
continue
|
||||
delta = choices[0].get("delta", {})
|
||||
content = delta.get("content")
|
||||
if content:
|
||||
full_content.append(content)
|
||||
reasoning = delta.get("reasoning_content")
|
||||
if reasoning:
|
||||
full_content.append(reasoning)
|
||||
except json.JSONDecodeError:
|
||||
continue
|
||||
except IndexError:
|
||||
continue
|
||||
|
||||
content = "".join(full_content)
|
||||
if not content:
|
||||
|
||||
Reference in New Issue
Block a user