OrganizingForChange commited on
Commit
cd3e95e
·
verified ·
1 Parent(s): f1a331b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -7
app.py CHANGED
@@ -87,20 +87,24 @@ def compose_system_prompt(targets, additional_sysinfo, feedback, user_message, r
87
 
88
  def split_main_and_feedback(llm_output):
89
  """
90
- Splits the LLM output at the first appearance of a '---' that is surely meant as a feedback divider.
 
91
  """
92
  import re
93
- # Split at first '—' line; this is how ChatGPT-5 renders ---
94
- m = re.search(r'(?:^|\n)—(?:\n|$)', llm_output)
 
 
 
 
95
  if m:
96
- idx = m.start()
97
- main_message = llm_output[:idx].strip()
98
  feedback_message = llm_output[m.end():].strip()
99
  else:
100
- main_message = llm_output.strip()
101
  feedback_message = ""
102
  return main_message, feedback_message
103
-
104
  def run_llm(
105
  api_key, targets, additional_sysinfo, user_message, region, model, reasoning_effort, verbosity
106
  ):
 
87
 
88
  def split_main_and_feedback(llm_output):
89
  """
90
+ Splits the LLM output at the first appearance of a divider line.
91
+ Supports both classic '---' (3+ hyphens) and Unicode dash lines (em/en/horizontal bar).
92
  """
93
  import re
94
+ # Match a line that consists only of dash-like characters (with optional surrounding whitespace)
95
+ # - {3,} ensures at least 3 ASCII hyphens (classic markdown rule)
96
+ # [—–―]+ matches one or more of em dash, en dash, or horizontal bar
97
+ pattern = re.compile(r'^(?:\s*)(?:-{3,}|[—–―]+)(?:\s*)$', flags=re.MULTILINE)
98
+
99
+ m = pattern.search(llm_output or "")
100
  if m:
101
+ main_message = llm_output[:m.start()].strip()
 
102
  feedback_message = llm_output[m.end():].strip()
103
  else:
104
+ main_message = (llm_output or "").strip()
105
  feedback_message = ""
106
  return main_message, feedback_message
107
+
108
  def run_llm(
109
  api_key, targets, additional_sysinfo, user_message, region, model, reasoning_effort, verbosity
110
  ):