| 61 | raise "no suitable function to write data" |
| 62 | |
| 63 | def _parse(outputs: str, tag="task"): |
| 64 | soup = BeautifulSoup(outputs, 'lxml') |
| 65 | agents = soup.find_all(re.compile(rf'{tag}\d*', re.IGNORECASE)) |
| 66 | extracted_texts = [agent.get_text(strip=True).strip() for agent in agents] |
| 67 | if extracted_texts == []: |
| 68 | tmp = outputs.split('\n') |
| 69 | for line in tmp: |
| 70 | for i in range(0, 10): |
| 71 | line = line.replace(f'agent {i}', '').replace(f'agent{i}','').strip() |
| 72 | return tmp |
| 73 | return extracted_texts |
| 74 | |
| 75 | def extract_json(content): |
| 76 | try: |