Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -433,6 +433,8 @@ def parse_followup_response(input_text):
|
|
| 433 |
|
| 434 |
import re
|
| 435 |
|
|
|
|
|
|
|
| 436 |
def parse_followup_and_tools(input_text):
|
| 437 |
# Remove extra brackets, excess quotes, and excessive whitespace
|
| 438 |
cleaned_text = re.sub(r'\[|\]|"+|\s+', ' ', input_text).strip()
|
|
@@ -441,6 +443,10 @@ def parse_followup_and_tools(input_text):
|
|
| 441 |
response_pattern = re.compile(r'<response>(.*?)</response>', re.DOTALL)
|
| 442 |
response_parts = response_pattern.findall(cleaned_text)
|
| 443 |
combined_response = ' '.join(response_parts).strip()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 444 |
parsed_interacts = []
|
| 445 |
parsed_tools = []
|
| 446 |
|
|
|
|
| 433 |
|
| 434 |
import re
|
| 435 |
|
| 436 |
+
import re
|
| 437 |
+
|
| 438 |
def parse_followup_and_tools(input_text):
|
| 439 |
# Remove extra brackets, excess quotes, and excessive whitespace
|
| 440 |
cleaned_text = re.sub(r'\[|\]|"+|\s+', ' ', input_text).strip()
|
|
|
|
| 443 |
response_pattern = re.compile(r'<response>(.*?)</response>', re.DOTALL)
|
| 444 |
response_parts = response_pattern.findall(cleaned_text)
|
| 445 |
combined_response = ' '.join(response_parts).strip()
|
| 446 |
+
|
| 447 |
+
# Remove tool and interact content from combined_response
|
| 448 |
+
combined_response = re.sub(r'<(tool|interact)>.*?</\1>', '', combined_response, flags=re.DOTALL).strip()
|
| 449 |
+
|
| 450 |
parsed_interacts = []
|
| 451 |
parsed_tools = []
|
| 452 |
|