hadadrjt commited on
Commit
77e3d5f
·
1 Parent(s): 08ed4d4

ai: Append reasoning tag.

Browse files
Files changed (1) hide show
  1. src/main/gradio.py +2 -2
src/main/gradio.py CHANGED
@@ -55,7 +55,7 @@ async def respond_async(multi, history, model_display, sess, custom_prompt, deep
55
  if ignore_reasoning:
56
  continue
57
  reasoning += chunk
58
- await queue.put(("reasoning", reasoning))
59
  elif typ == "content":
60
  if not content_started:
61
  content_started = True
@@ -153,7 +153,7 @@ def launch_ui():
153
  selected_model = gr.State(MODEL_CHOICES[0] if MODEL_CHOICES else "")
154
  J_A_R_V_I_S = gr.State("")
155
  # Chatbot UI
156
- with gr.Column(): chatbot = gr.Chatbot(label=AI_TYPES["AI_TYPE_1"], show_copy_button=True, scale=1, elem_id=AI_TYPES["AI_TYPE_2"], examples=JARVIS_INIT)
157
  # Deep search
158
  deep_search = gr.Checkbox(label=AI_TYPES["AI_TYPE_8"], value=False, info=AI_TYPES["AI_TYPE_9"], visible=True)
159
  deep_search.change(fn=toggle_deep_search, inputs=[deep_search, user_history, user_session, J_A_R_V_I_S, selected_model], outputs=[chatbot, user_session, J_A_R_V_I_S, selected_model, deep_search])
 
55
  if ignore_reasoning:
56
  continue
57
  reasoning += chunk
58
+ await queue.put(("reasoning", f"<think>\n{reasoning}\n\n</think>\n\n"))
59
  elif typ == "content":
60
  if not content_started:
61
  content_started = True
 
153
  selected_model = gr.State(MODEL_CHOICES[0] if MODEL_CHOICES else "")
154
  J_A_R_V_I_S = gr.State("")
155
  # Chatbot UI
156
+ with gr.Column(): chatbot = gr.Chatbot(label=AI_TYPES["AI_TYPE_1"], show_copy_button=True, scale=1, elem_id=AI_TYPES["AI_TYPE_2"], examples=JARVIS_INIT, allow_tags=["think"])
157
  # Deep search
158
  deep_search = gr.Checkbox(label=AI_TYPES["AI_TYPE_8"], value=False, info=AI_TYPES["AI_TYPE_9"], visible=True)
159
  deep_search.change(fn=toggle_deep_search, inputs=[deep_search, user_history, user_session, J_A_R_V_I_S, selected_model], outputs=[chatbot, user_session, J_A_R_V_I_S, selected_model, deep_search])