Spaces:
Running
Running
Commit ·
debdad8
1
Parent(s): 9756402
Set up debugging
Browse files
app.py
CHANGED
|
@@ -104,8 +104,20 @@ def generate_flowchart(src_code: str):
|
|
| 104 |
|
| 105 |
content = response["choices"][0]["message"]["content"]
|
| 106 |
|
| 107 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
cleaned = re.sub(r'<thinking>.*?</thinking>', '', content, flags=re.DOTALL)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
return cleaned.strip() # and remove excess whitespace
|
| 110 |
|
| 111 |
# ----- Custom Frontend ----- #
|
|
|
|
| 104 |
|
| 105 |
content = response["choices"][0]["message"]["content"]
|
| 106 |
|
| 107 |
+
# ----- DEBUG ----- #
|
| 108 |
+
print("=" * 40)
|
| 109 |
+
print("FINISH REASON:", response["choices"][0].get("finish_reason"))
|
| 110 |
+
print("RAW CONTENT >>>")
|
| 111 |
+
print(repr(content)) # repr so we see whitespace / empty
|
| 112 |
+
print("<<< END RAW")
|
| 113 |
+
|
| 114 |
cleaned = re.sub(r'<thinking>.*?</thinking>', '', content, flags=re.DOTALL)
|
| 115 |
+
print("CLEANED >>>", repr(cleaned.strip()))
|
| 116 |
+
print("=" * 40)
|
| 117 |
+
# ----- END DEBUG ----- #
|
| 118 |
+
|
| 119 |
+
# remove the thinking tags from the response
|
| 120 |
+
# cleaned = re.sub(r'<thinking>.*?</thinking>', '', content, flags=re.DOTALL)
|
| 121 |
return cleaned.strip() # and remove excess whitespace
|
| 122 |
|
| 123 |
# ----- Custom Frontend ----- #
|