UI: Add a collapsible thinking block to messages with <think> steps (#6902)

This commit is contained in:
oobabooga 2025-04-25 18:02:02 -03:00 committed by GitHub
parent 0dd71e78c9
commit d35818f4e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 238 additions and 27 deletions

View file

@ -417,16 +417,8 @@ def generate_chat_reply(text, state, regenerate=False, _continue=False, loading_
yield history
return
show_after = html.escape(state.get("show_after")) if state.get("show_after") else None
for history in chatbot_wrapper(text, state, regenerate=regenerate, _continue=_continue, loading_message=loading_message, for_ui=for_ui):
if show_after:
after = history["visible"][-1][1].partition(show_after)[2] or "*Is thinking...*"
yield {
'internal': history['internal'],
'visible': history['visible'][:-1] + [[history['visible'][-1][0], after]]
}
else:
yield history
yield history
def character_is_loaded(state, raise_exception=False):