eagle0504 commited on
Commit
bf62c66
·
1 Parent(s): 44937e4

chekbox added

Browse files
Files changed (1) hide show
  1. app.py +16 -9
app.py CHANGED
@@ -115,6 +115,7 @@ with st.sidebar:
115
  "Colorado Springs, Colorado, United States",
116
  ),
117
  )
 
118
 
119
  # Add a button to clear the session state
120
  if st.button("Clear Session"):
@@ -165,14 +166,19 @@ if prompt := st.chat_input(
165
  # API Call
166
  query = src_key_word + " " + prompt
167
  try:
168
- md_data = invoke_search_api(
169
- api_key=API_KEY, query=query, location=location, num=num
170
- )
171
- md_data = md_data["data"]
172
- response = f"""
173
- Please see search results below: \n{md_data}
174
- """
175
- ref_table_string = response
 
 
 
 
 
176
 
177
  # API Call
178
  bot = ChatBot()
@@ -182,7 +188,8 @@ if prompt := st.chat_input(
182
  Here's user prompt: {prompt}
183
  Here's relevant content: {response}
184
 
185
- Answer user prompt based on the relevant content."""
 
186
  )
187
 
188
  except Exception as e:
 
115
  "Colorado Springs, Colorado, United States",
116
  ),
117
  )
118
+ only_use_chatbot = st.checkbox("Only use chatbot.")
119
 
120
  # Add a button to clear the session state
121
  if st.button("Clear Session"):
 
166
  # API Call
167
  query = src_key_word + " " + prompt
168
  try:
169
+ if only_use_chatbot:
170
+ md_data = "<empty>"
171
+ response = "<empty>"
172
+ ref_table_string = "<empty>"
173
+ else:
174
+ md_data = invoke_search_api(
175
+ api_key=API_KEY, query=query, location=location, num=num
176
+ )
177
+ md_data = md_data["data"]
178
+ response = f"""
179
+ Please see search results below: \n{md_data}
180
+ """
181
+ ref_table_string = response
182
 
183
  # API Call
184
  bot = ChatBot()
 
188
  Here's user prompt: {prompt}
189
  Here's relevant content: {response}
190
 
191
+ Answer user prompt based on the relevant content.
192
+ If relevant content is <empty>, use your best judgement or chat history."""
193
  )
194
 
195
  except Exception as e: