从 content 中解析 tool call
(content_text)
| 683 | |
| 684 | |
| 685 | def parse_tool_call(content_text): |
| 686 | """从 content 中解析 tool call""" |
| 687 | try: |
| 688 | if "<tool_call>" in content_text and "</tool_call>" in content_text: |
| 689 | json_str = content_text.split("<tool_call>")[-1].split("</tool_call>")[0] |
| 690 | tool_data = json5.loads(json_str) |
| 691 | return tool_data.get('name'), tool_data.get('arguments', {}) |
| 692 | except Exception: |
| 693 | pass |
| 694 | return None, {} |
| 695 | |
| 696 | |
| 697 | def get_file_type_icon(file_type): |