解析 ChatGPT 返回内容, 并: 1)保持列表信息.
(response: WebElement)
| 259 | other_tags = set() |
| 260 | |
| 261 | def parse_chat_row(response: WebElement) -> Anwser: |
| 262 | """ |
| 263 | 解析 ChatGPT 返回内容, 并: 1)保持列表信息. |
| 264 | """ |
| 265 | children = response.find_elements(By.XPATH, './*') |
| 266 | anwser = list() |
| 267 | for tag in children: |
| 268 | if tag.tag_name == 'ol': |
| 269 | rows = tag.find_elements(By.XPATH, './*') |
| 270 | for i, r in enumerate(rows, 1): |
| 271 | anwser.append(f'{i}. {r.text}') |
| 272 | else: |
| 273 | if tag.tag_name not in other_tags: |
| 274 | other_tags.add(tag.tag_name) |
| 275 | printf('new tag:', tag.tag_name) |
| 276 | anwser.append(tag.text) |
| 277 | return anwser |
| 278 | |
| 279 | |
| 280 | def get_response() -> Anwser: |
no test coverage detected