Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -63,10 +63,10 @@ async def respond_thinking(message, history, selected_model):
|
|
63 |
async def process_message(message, history, model_name):
|
64 |
if "thinking" in model_name:
|
65 |
async for response, thinking in respond_thinking(message, history, model_name):
|
66 |
-
yield response
|
67 |
else:
|
68 |
async for response in respond(message, history, model_name):
|
69 |
-
yield response
|
70 |
|
71 |
def clear_thinking():
|
72 |
return ""
|
@@ -96,7 +96,7 @@ with gr.Blocks() as demo:
|
|
96 |
return gr.ChatInterface.update()
|
97 |
|
98 |
async def update_thinking(history):
|
99 |
-
if history and history[-1][0] == "assistant" and len(history[-1]) > 1:
|
100 |
return history[-1][1]
|
101 |
return ""
|
102 |
|
@@ -106,7 +106,7 @@ with gr.Blocks() as demo:
|
|
106 |
outputs=[chatbot],
|
107 |
)
|
108 |
|
109 |
-
chatbot.
|
110 |
update_thinking,
|
111 |
inputs=[chatbot],
|
112 |
outputs=[thinking_output]
|
|
|
63 |
async def process_message(message, history, model_name):
|
64 |
if "thinking" in model_name:
|
65 |
async for response, thinking in respond_thinking(message, history, model_name):
|
66 |
+
yield (response, thinking)
|
67 |
else:
|
68 |
async for response in respond(message, history, model_name):
|
69 |
+
yield (response, "")
|
70 |
|
71 |
def clear_thinking():
|
72 |
return ""
|
|
|
96 |
return gr.ChatInterface.update()
|
97 |
|
98 |
async def update_thinking(history):
|
99 |
+
if history and history[-1][0]["role"] == "assistant" and len(history[-1]) > 1:
|
100 |
return history[-1][1]
|
101 |
return ""
|
102 |
|
|
|
106 |
outputs=[chatbot],
|
107 |
)
|
108 |
|
109 |
+
chatbot.change(
|
110 |
update_thinking,
|
111 |
inputs=[chatbot],
|
112 |
outputs=[thinking_output]
|