peterpull commited on
Commit
bae8564
·
1 Parent(s): 142e39e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -103,15 +103,18 @@ def print_header_json_file(filepath):
103
  index = get_index(INDEX_FILE)
104
 
105
  # passes the prompt to the chatbot
106
- def chatbot(input_text, history=[]):
 
107
  hyde= HyDEQueryTransform(include_original=True)
108
  prompt = f"In character as John Haynes, please respond to: {input_text}. Only reply with contextual information or say you cannot find an answer. End with a reflective question."
109
  response = index.query(prompt, response_mode="default", verbose=True, query_transform=hyde)
110
  store_message(input_text,response)
111
-
112
- # return the response
113
- return response.response,history
114
 
 
 
 
 
 
115
 
116
  with open('about.txt', 'r') as file:
117
  about = file.read()
 
103
  index = get_index(INDEX_FILE)
104
 
105
  # passes the prompt to the chatbot
106
+ def chatbot(input_text, state):
107
+ global conversation_history
108
  hyde= HyDEQueryTransform(include_original=True)
109
  prompt = f"In character as John Haynes, please respond to: {input_text}. Only reply with contextual information or say you cannot find an answer. End with a reflective question."
110
  response = index.query(prompt, response_mode="default", verbose=True, query_transform=hyde)
111
  store_message(input_text,response)
 
 
 
112
 
113
+ # append the current input and response to the conversation history
114
+ conversation_history.append((input_text, response.response))
115
+
116
+ # return the response and updated conversation history
117
+ return response.response, conversation_history
118
 
119
  with open('about.txt', 'r') as file:
120
  about = file.read()