MCPcopy Create free account
hub / github.com/Tencent/digitalhuman / _parse

Function _parse

SWF/src/utils.py:63–73  ·  view source on GitHub ↗
(outputs: str, tag="task")

Source from the content-addressed store, hash-verified

61 raise "no suitable function to write data"
62
63def _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
75def extract_json(content):
76 try:

Callers 2

stepMethod · 0.90
eval_mathMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected