Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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
|
|
|
|
| 91 |
"""
|
| 92 |
import re
|
| 93 |
-
#
|
| 94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
if m:
|
| 96 |
-
|
| 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 |
):
|