Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -449,9 +449,9 @@ def parse_followup_and_tools(input_text):
|
|
| 449 |
parsed_tools = []
|
| 450 |
|
| 451 |
# Parse interacts and tools
|
| 452 |
-
blocks = re.finditer(r'<(interact|tools)>(.*?)</\1>', cleaned_text, re.DOTALL)
|
| 453 |
for block in blocks:
|
| 454 |
-
block_type, content = block.groups()
|
| 455 |
content = content.strip()
|
| 456 |
|
| 457 |
if block_type == 'interact':
|
|
@@ -463,7 +463,7 @@ def parse_followup_and_tools(input_text):
|
|
| 463 |
options = [' '.join(opt.split()) for opt in re.split(r'\s*-\s*', parts[1]) if opt.strip()]
|
| 464 |
parsed_interacts.append({'question': question, 'options': options})
|
| 465 |
|
| 466 |
-
elif block_type
|
| 467 |
tool_match = re.search(r'text:\s*(.*?)\s*options:\s*-\s*(.*)', content, re.DOTALL)
|
| 468 |
if tool_match:
|
| 469 |
tool_name = ' '.join(tool_match.group(1).split()) # Normalize spaces
|
|
|
|
| 449 |
parsed_tools = []
|
| 450 |
|
| 451 |
# Parse interacts and tools
|
| 452 |
+
blocks = re.finditer(r'<(interact|tools?)(.*?)>(.*?)</\1>', cleaned_text, re.DOTALL)
|
| 453 |
for block in blocks:
|
| 454 |
+
block_type, _, content = block.groups()
|
| 455 |
content = content.strip()
|
| 456 |
|
| 457 |
if block_type == 'interact':
|
|
|
|
| 463 |
options = [' '.join(opt.split()) for opt in re.split(r'\s*-\s*', parts[1]) if opt.strip()]
|
| 464 |
parsed_interacts.append({'question': question, 'options': options})
|
| 465 |
|
| 466 |
+
elif block_type.startswith('tool'): # This will match both 'tool' and 'tools'
|
| 467 |
tool_match = re.search(r'text:\s*(.*?)\s*options:\s*-\s*(.*)', content, re.DOTALL)
|
| 468 |
if tool_match:
|
| 469 |
tool_name = ' '.join(tool_match.group(1).split()) # Normalize spaces
|