eagle0504 commited on
Commit
e514fa3
·
verified ·
1 Parent(s): 93c5237

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -8
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,20 @@ 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()
 
115
  "Colorado Springs, Colorado, United States",
116
  ),
117
  )
118
+ do_not_use_internet = st.checkbox("Do not user internet. Chat only.")
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 do_not_use_internet:
170
+ response = f"""
171
+ There is no search results here. Treat is as a standard conversation.
172
+ """
173
+ ref_table_string = """### No search triggered for this run."""
174
+ else:
175
+ md_data = invoke_search_api(
176
+ api_key=API_KEY, query=query, location=location, num=num
177
+ )
178
+ md_data = md_data["data"]
179
+ response = f"""
180
+ Please see search results below: \n{md_data}
181
+ """
182
+ ref_table_string = response
183
 
184
  # API Call
185
  bot = ChatBot()