refac: think tag styling

This commit is contained in:
Timothy Jaeryang Baek
2025-01-22 00:23:47 -08:00
parent c9dc7299c5
commit 2777d3ec49
2 changed files with 21 additions and 3 deletions

View File

@@ -1137,6 +1137,15 @@ async def process_chat_response(
)
if reasoning_content:
reasoning_content = "\n".join(
(
f"> {line}"
if not line.startswith(">")
else line
)
for line in reasoning_content.splitlines()
)
# Format reasoning with <details> tag
content = f"<details>\n<summary>Thought for {reasoning_duration} seconds</summary>\n{reasoning_content}\n</details>\n"
else:
@@ -1144,8 +1153,17 @@ async def process_chat_response(
reasoning_start_time = None
else:
ongoing_content = "\n".join(
(
f"> {line}"
if not line.startswith(">")
else line
)
for line in reasoning_content.splitlines()
)
# Show ongoing thought process
content = f"<details>\n<summary>Thinking… <loading/></summary>\n{reasoning_content}\n</details>\n"
content = f"<details>\n<summary>Thinking… <loading/></summary>\n{ongoing_content}\n</details>\n"
if ENABLE_REALTIME_CHAT_SAVE:
# Save message in the database