(msg: List[Dict[str, Any]])
| 361 | return False # the port is not available |
| 362 | |
| 363 | def clean_msg(msg: List[Dict[str, Any]]): |
| 364 | new_msg = [] |
| 365 | for m in msg: |
| 366 | msg_content = m['content'] |
| 367 | if isinstance(msg_content, str): |
| 368 | m['content'] = msg_content |
| 369 | new_msg.append(m.copy()) |
| 370 | elif isinstance(msg_content, List): |
| 371 | new_content = [] |
| 372 | for c in msg_content: |
| 373 | if c['type'] == 'text': |
| 374 | new_content.append(c.copy()) |
| 375 | elif c['type'] == 'image_url': |
| 376 | new_content.append({'type': 'image_url', 'image_url': 'placeholder'}) |
| 377 | m['content'] = new_content |
| 378 | new_msg.append(m.copy()) |
| 379 | return new_msg |
no test coverage detected