This commit is contained in:
Timothy Jaeryang Baek 2025-02-03 16:18:07 -08:00
parent 943a57474f
commit 31c176a485

View File

@ -1107,7 +1107,13 @@ async def process_chat_response(
reasoning_duration = block.get("duration", None)
if reasoning_duration:
if raw:
content = f'{content}<{block["tag"]}>{block["content"]}</{block["tag"]}>\n'
else:
content = f'{content}<details type="reasoning" done="true" duration="{reasoning_duration}">\n<summary>Thought for {reasoning_duration} seconds</summary>\n{reasoning_display_content}\n</details>\n'
else:
if raw:
content = f'{content}<{block["tag"]}>{block["content"]}</{block["tag"]}>\n'
else:
content = f'{content}<details type="reasoning" done="false">\n<summary>Thinking…</summary>\n{reasoning_display_content}\n</details>\n'
@ -1123,6 +1129,9 @@ async def process_chat_response(
content = f'{content}<code_interpreter type="code" lang="{lang}">\n{block["content"]}\n</code_interpreter>\n```output\n{output}\n```\n'
else:
content = f'{content}<details type="code_interpreter" done="true" output="{output}">\n<summary>Analyzed</summary>\n```{lang}\n{block["content"]}\n```\n</details>\n'
else:
if raw:
content = f'{content}<code_interpreter type="code" lang="{lang}">\n{block["content"]}\n</code_interpreter>\n'
else:
content = f'{content}<details type="code_interpreter" done="false">\n<summary>Analyzing...</summary>\n```{lang}\n{block["content"]}\n```\n</details>\n'