Severian commited on
Commit
c606b75
·
verified ·
1 Parent(s): 89dec5a

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +10 -0
main.py CHANGED
@@ -46,6 +46,12 @@ def create_gradio_interface():
46
 
47
  def chatbot_function(message, history, model, system_prompt, thinking_budget, current_stage):
48
  try:
 
 
 
 
 
 
49
  chat_history, form_data = innovative_chatbot.process_stage_input(current_stage, message, model, system_prompt, thinking_budget)
50
 
51
  history.append((message, chat_history[-1][1]))
@@ -221,6 +227,10 @@ def create_gradio_interface():
221
  outputs=[chatbot, msg] + [form_fields[stage["name"]] for stage in STAGES] + [stages]
222
  )
223
 
 
 
 
 
224
  return demo
225
 
226
  def main():
 
46
 
47
  def chatbot_function(message, history, model, system_prompt, thinking_budget, current_stage):
48
  try:
49
+ # If this is the first message, get the initial greeting
50
+ if not history:
51
+ initial_greeting = innovative_chatbot.get_initial_greeting()
52
+ history.append((None, initial_greeting))
53
+ return history, "", ""
54
+
55
  chat_history, form_data = innovative_chatbot.process_stage_input(current_stage, message, model, system_prompt, thinking_budget)
56
 
57
  history.append((message, chat_history[-1][1]))
 
227
  outputs=[chatbot, msg] + [form_fields[stage["name"]] for stage in STAGES] + [stages]
228
  )
229
 
230
+ # Add this new event handler to display the initial greeting when the interface loads
231
+ demo.load(lambda: ([[None, innovative_chatbot.get_initial_greeting()]], ""),
232
+ outputs=[chatbot, msg])
233
+
234
  return demo
235
 
236
  def main():