rishabhpr commited on
Commit
3b110a5
·
verified ·
1 Parent(s): 1535def

add chat box

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py CHANGED
@@ -106,8 +106,25 @@ for message in st.session_state.messages[1:]: # Skip the system message
106
  with st.chat_message(message["role"]):
107
  st.markdown(message["content"])
108
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  st.sidebar.markdown("""
110
  ## About
111
  This is a Real-World Interview Question Generator powered by OpenAI's API.
112
  Enter a company name, topic, and level of difficulty, and it will transform a relevant question into a real-world interview scenario!
 
113
  """)
 
106
  with st.chat_message(message["role"]):
107
  st.markdown(message["content"])
108
 
109
+ # Chatbox for subsequent conversations with assistant
110
+ if user_input := st.chat_input("Continue your conversation or ask follow-up questions here:"):
111
+ # Display user message in chat message container and add to session history
112
+ with st.chat_message("user"):
113
+ st.markdown(user_input)
114
+
115
+ st.session_state.messages.append({"role": "user", "content": user_input})
116
+
117
+ # Generate assistant's response based on follow-up input
118
+ assistant_response = generate_response(user_input)
119
+
120
+ with st.chat_message("assistant"):
121
+ st.markdown(assistant_response)
122
+
123
+ st.session_state.messages.append({"role": "assistant", "content": assistant_response})
124
+
125
  st.sidebar.markdown("""
126
  ## About
127
  This is a Real-World Interview Question Generator powered by OpenAI's API.
128
  Enter a company name, topic, and level of difficulty, and it will transform a relevant question into a real-world interview scenario!
129
+ Continue chatting with the assistant in the chatbox below.
130
  """)