yangtb24 commited on
Commit
8abcb8a
·
verified ·
1 Parent(s): 38581b1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -498,7 +498,7 @@ def handsome_chat_completions():
498
  }]
499
  }
500
 
501
- if "reasoning_content" in delta:
502
  if first_reasoning_chunk:
503
  openai_chunk["choices"][0]["delta"]["content"] = "<think>\n"
504
  yield f"data: {json.dumps(openai_chunk)}\n\n"
@@ -508,7 +508,7 @@ def handsome_chat_completions():
508
  yield f"data: {json.dumps(openai_chunk)}\n\n"
509
  reasoning_content_accumulated += delta["reasoning_content"]
510
 
511
- if "content" in delta:
512
  if not first_reasoning_chunk:
513
  openai_chunk["choices"][0]["delta"]["content"] = "\n</think>\n"
514
  yield f"data: {json.dumps(openai_chunk)}\n\n"
 
498
  }]
499
  }
500
 
501
+ if delta.get("reasoning_content") is not None:
502
  if first_reasoning_chunk:
503
  openai_chunk["choices"][0]["delta"]["content"] = "<think>\n"
504
  yield f"data: {json.dumps(openai_chunk)}\n\n"
 
508
  yield f"data: {json.dumps(openai_chunk)}\n\n"
509
  reasoning_content_accumulated += delta["reasoning_content"]
510
 
511
+ if delta.get("content") is not None:
512
  if not first_reasoning_chunk:
513
  openai_chunk["choices"][0]["delta"]["content"] = "\n</think>\n"
514
  yield f"data: {json.dumps(openai_chunk)}\n\n"