TejAndrewsACC commited on
Commit
f775801
·
verified ·
1 Parent(s): fef4874

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -728,14 +728,15 @@ def chat(user_input, history=[]):
728
  if word in word_to_index:
729
  input_vector[word_to_index[word]] = 1
730
 
731
- # Generate the response
732
  response = advanced_text_generation(input_vector)
733
-
734
- # Update the history with the new user input and response
735
- history.append({"role": "user", "content": user_input}) # Store user input with 'content'
736
- history.append({"role": "assistant", "content": response}) # Store model response with 'content'
737
 
738
- return history # Return the updated history with 'role' and 'content'
 
 
 
 
 
739
 
740
 
741
 
 
728
  if word in word_to_index:
729
  input_vector[word_to_index[word]] = 1
730
 
731
+ # Generate the response (only one response generated here)
732
  response = advanced_text_generation(input_vector)
 
 
 
 
733
 
734
+ # Clear previous history and only store the current user input and response
735
+ history = [{"role": "user", "content": user_input}, {"role": "assistant", "content": response}]
736
+
737
+ # Return only the most recent pair (user input + assistant response)
738
+ return history
739
+
740
 
741
 
742