feat: render markdown tool results with MdWidget
This commit is contained in:
parent
3573684f09
commit
461fbc47b0
@ -98,7 +98,10 @@ if action == 'send_message':
|
||||
tool = data.get('tool', '')
|
||||
result = data.get('result', '')
|
||||
good = not result.startswith('ERROR') and not result.startswith('未知工具')
|
||||
d = json.dumps(_w_card(tool + " 结果", result[:600], "success" if good else "error"), ensure_ascii=False) + '\n'
|
||||
# markdown 内容用 MdWidget 渲染(表格、列表等)
|
||||
is_md = result.startswith('|') or result.startswith('#') or result.startswith('- ')
|
||||
body = _w_md(result[:2000]) if is_md else result[:600]
|
||||
d = json.dumps(_w_card(tool + " 结果", body, "success" if good else "error"), ensure_ascii=False) + '\n'
|
||||
elif t == 'reply':
|
||||
d = json.dumps(_w_md(data.get('message', '')), ensure_ascii=False) + '\n'
|
||||
elif t == 'error':
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user