Spaces:
Runtime error
Runtime error
Your Name
commited on
Commit
·
97044e9
1
Parent(s):
7399aac
errorHandling
Browse files
app.py
CHANGED
|
@@ -45,10 +45,11 @@ def chat(message, site,history):
|
|
| 45 |
history = history or []
|
| 46 |
#siteの//以前を削除
|
| 47 |
site = site.replace("https://","")
|
| 48 |
-
|
| 49 |
response = agent_chain.run(input=message+" site:"+site)
|
| 50 |
-
|
| 51 |
-
|
|
|
|
| 52 |
history.append((message, response))
|
| 53 |
|
| 54 |
return history, history
|
|
|
|
| 45 |
history = history or []
|
| 46 |
#siteの//以前を削除
|
| 47 |
site = site.replace("https://","")
|
| 48 |
+
try:
|
| 49 |
response = agent_chain.run(input=message+" site:"+site)
|
| 50 |
+
except KeyError:
|
| 51 |
+
if not response:
|
| 52 |
+
response = "website not found"
|
| 53 |
history.append((message, response))
|
| 54 |
|
| 55 |
return history, history
|