neuralleap commited on
Commit
30ecdbd
1 Parent(s): 4ef3643

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -15,10 +15,6 @@ from langchain_groq import ChatGroq
15
  from langchain.prompts import PromptTemplate
16
 
17
 
18
- def on_message_change():
19
- st.session_state.history.append(st.session_state.message)
20
- st.session_state.message = ""
21
-
22
 
23
  def main():
24
  """
@@ -43,7 +39,8 @@ def main():
43
 
44
  memory = ConversationBufferWindowMemory(k=7, memory_key="chat_history", return_messages=True)
45
 
46
- user_question = st.text_input("Ask a question:", on_change=on_message_change)
 
47
 
48
 
49
  # session state variable
@@ -94,7 +91,7 @@ def main():
94
 
95
  # The chatbot's answer is generated by sending the full prompt to the Groq API.
96
  response = conversation.predict(human_input=user_question)
97
- placeholder = st.empty()
98
  message = {'human':user_question,'AI':response}
99
  st.session_state.chat_history.append(message)
100
  st.write("Chatbot:", response)
 
15
  from langchain.prompts import PromptTemplate
16
 
17
 
 
 
 
 
18
 
19
  def main():
20
  """
 
39
 
40
  memory = ConversationBufferWindowMemory(k=7, memory_key="chat_history", return_messages=True)
41
 
42
+ user_question = st.text_input("Ask a question:")
43
+ placeholder = st.empty()
44
 
45
 
46
  # session state variable
 
91
 
92
  # The chatbot's answer is generated by sending the full prompt to the Groq API.
93
  response = conversation.predict(human_input=user_question)
94
+
95
  message = {'human':user_question,'AI':response}
96
  st.session_state.chat_history.append(message)
97
  st.write("Chatbot:", response)