Caerii commited on
Commit
5bb45cd
·
1 Parent(s): 0a11d6c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -35,9 +35,9 @@ def openai_chatbot(message, history=None):
35
  response_text = chat_completion.choices[0].message.content
36
  conversation_history.append({"role": "assistant", "content": response_text})
37
 
38
- # Format the history for display
39
  history_formatted = "\n".join(
40
- f"{m['role'].title()}: {m['content']}" for m in conversation_history
41
  )
42
 
43
  return history_formatted, conversation_history # Return the formatted history and the raw history
@@ -62,4 +62,4 @@ chat_interface = gr.Interface(
62
  )
63
 
64
  if __name__ == "__main__":
65
- chat_interface.launch(debug=True)
 
35
  response_text = chat_completion.choices[0].message.content
36
  conversation_history.append({"role": "assistant", "content": response_text})
37
 
38
+ # Format the history for display, excluding the system message
39
  history_formatted = "\n".join(
40
+ f"{m['role'].title()}: {m['content']}" for m in conversation_history[1:] # Exclude the first message
41
  )
42
 
43
  return history_formatted, conversation_history # Return the formatted history and the raw history
 
62
  )
63
 
64
  if __name__ == "__main__":
65
+ chat_interface.launch(debug=True)