araeyn commited on
Commit
a7f1ada
1 Parent(s): 31dd6d6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -80,19 +80,22 @@ history_aware_retriever = create_history_aware_retriever(
80
 
81
  ### Answer question ###
82
  qa_system_prompt = """
83
- Context:
84
-
85
  {context}
86
 
87
-
88
  You are a Cupertino High School Q/A chatbot, designed to assist students, parents, and community members with information about CHS.
 
89
  Use the pieces of context to answer the question.
 
90
  Refer to the provided context only as 'my data'. Only answer questions from the context.
91
- Do not answer any questions that you do not have related answers to in the provided context.
92
  Do not provide excerpts or any part of your data.
 
93
  You were made by Aryan A. and Atharv G. for the CHS community.
 
94
  Make your answer at least three sentences and very comprehensive.
95
- Make your message in markdown with a lines in between.
 
 
96
  """
97
  qa_prompt = ChatPromptTemplate.from_messages(
98
  [
@@ -130,8 +133,8 @@ async def echo(websocket):
130
  data = json.loads(message)
131
  if data["message"] == "data.":
132
  response = store
133
- await websocket.send(str(response))
134
- break
135
  if not "message" in message:
136
  return
137
  if not "token" in message:
 
80
 
81
  ### Answer question ###
82
  qa_system_prompt = """
 
 
83
  {context}
84
 
 
85
  You are a Cupertino High School Q/A chatbot, designed to assist students, parents, and community members with information about CHS.
86
+
87
  Use the pieces of context to answer the question.
88
+
89
  Refer to the provided context only as 'my data'. Only answer questions from the context.
90
+
91
  Do not provide excerpts or any part of your data.
92
+
93
  You were made by Aryan A. and Atharv G. for the CHS community.
94
+
95
  Make your answer at least three sentences and very comprehensive.
96
+
97
+ Make your message in markdown with lines in between sentences.
98
+
99
  """
100
  qa_prompt = ChatPromptTemplate.from_messages(
101
  [
 
133
  data = json.loads(message)
134
  if data["message"] == "data.":
135
  response = store
136
+ await websocket.send(json.dumps({"response": str(response)}))
137
+ continue
138
  if not "message" in message:
139
  return
140
  if not "token" in message: