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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -501,20 +501,24 @@ def handsome_chat_completions():
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"
505
  first_reasoning_chunk = False
506
 
507
  openai_chunk["choices"][0]["delta"]["content"] = delta["reasoning_content"]
 
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"
515
  first_reasoning_chunk = True
516
 
517
  openai_chunk["choices"][0]["delta"]["content"] = delta["content"]
 
518
  yield f"data: {json.dumps(openai_chunk)}\n\n"
519
  content_accumulated += delta["content"]
520
 
 
501
  if delta.get("reasoning_content") is not None:
502
  if first_reasoning_chunk:
503
  openai_chunk["choices"][0]["delta"]["content"] = "<think>\n"
504
+ openai_chunk["choices"][0]["delta"]["reasoning_content"] = "null"
505
  yield f"data: {json.dumps(openai_chunk)}\n\n"
506
  first_reasoning_chunk = False
507
 
508
  openai_chunk["choices"][0]["delta"]["content"] = delta["reasoning_content"]
509
+ openai_chunk["choices"][0]["delta"]["reasoning_content"] = "null"
510
  yield f"data: {json.dumps(openai_chunk)}\n\n"
511
  reasoning_content_accumulated += delta["reasoning_content"]
512
 
513
  if delta.get("content") is not None:
514
  if not first_reasoning_chunk:
515
  openai_chunk["choices"][0]["delta"]["content"] = "\n</think>\n"
516
+ openai_chunk["choices"][0]["delta"]["reasoning_content"] = "null"
517
  yield f"data: {json.dumps(openai_chunk)}\n\n"
518
  first_reasoning_chunk = True
519
 
520
  openai_chunk["choices"][0]["delta"]["content"] = delta["content"]
521
+ openai_chunk["choices"][0]["delta"]["reasoning_content"] = "null"
522
  yield f"data: {json.dumps(openai_chunk)}\n\n"
523
  content_accumulated += delta["content"]
524