mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-16 11:57:51 +01:00
refac: think tag
This commit is contained in:
@@ -1144,7 +1144,7 @@ async def process_chat_response(
|
|||||||
)
|
)
|
||||||
|
|
||||||
if reasoning_content:
|
if reasoning_content:
|
||||||
reasoning_content = "\n".join(
|
reasoning_display_content = "\n".join(
|
||||||
(
|
(
|
||||||
f"> {line}"
|
f"> {line}"
|
||||||
if not line.startswith(">")
|
if not line.startswith(">")
|
||||||
@@ -1154,14 +1154,14 @@ async def process_chat_response(
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Format reasoning with <details> tag
|
# Format reasoning with <details> tag
|
||||||
content = f"{ongoing_content}<details>\n<summary>Thought for {reasoning_duration} seconds</summary>\n{reasoning_content}\n</details>\n"
|
content = f"{ongoing_content}<details>\n<summary>Thought for {reasoning_duration} seconds</summary>\n{reasoning_display_content}\n</details>\n"
|
||||||
else:
|
else:
|
||||||
content = ""
|
content = ""
|
||||||
|
|
||||||
reasoning_start_time = None
|
reasoning_start_time = None
|
||||||
else:
|
else:
|
||||||
|
|
||||||
reasoning_content = "\n".join(
|
reasoning_display_content = "\n".join(
|
||||||
(
|
(
|
||||||
f"> {line}"
|
f"> {line}"
|
||||||
if not line.startswith(">")
|
if not line.startswith(">")
|
||||||
@@ -1171,7 +1171,7 @@ async def process_chat_response(
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Show ongoing thought process
|
# Show ongoing thought process
|
||||||
content = f"{ongoing_content}<details>\n<summary>Thinking… <loading/></summary>\n{reasoning_content}\n</details>\n"
|
content = f"{ongoing_content}<details>\n<summary>Thinking… <loading/></summary>\n{reasoning_display_content}\n</details>\n"
|
||||||
|
|
||||||
if ENABLE_REALTIME_CHAT_SAVE:
|
if ENABLE_REALTIME_CHAT_SAVE:
|
||||||
# Save message in the database
|
# Save message in the database
|
||||||
|
|||||||
Reference in New Issue
Block a user