freeCS-dot-org commited on
Commit
1004843
·
verified ·
1 Parent(s): a7e5208

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -16,8 +16,9 @@ CSS = """.duplicate-button { margin: auto !important; color: white !important; b
16
  def model_to_user_format(response):
17
  """Convert model format (with reasoning tags) to user format (with markdown)"""
18
  if "<|end_reasoning|>" in response:
19
- # Split at the end reasoning tag
20
- reasoning, content = response.split("<|end_reasoning|>")
 
21
  # Remove start reasoning tag if present
22
  reasoning = reasoning.replace("<|start_reasoning|>", "").strip()
23
  # Format in markdown
 
16
  def model_to_user_format(response):
17
  """Convert model format (with reasoning tags) to user format (with markdown)"""
18
  if "<|end_reasoning|>" in response:
19
+ parts = response.split("<|end_reasoning|>", 1) # Split at most once
20
+ reasoning = parts[0]
21
+ content = parts[1] if len(parts) > 1 else "" # Handle case if no split occurred
22
  # Remove start reasoning tag if present
23
  reasoning = reasoning.replace("<|start_reasoning|>", "").strip()
24
  # Format in markdown