Update app.py
Browse files
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 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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()
|