Your Name commited on
Commit
97044e9
·
1 Parent(s): 7399aac

errorHandling

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -45,10 +45,11 @@ def chat(message, site,history):
45
  history = history or []
46
  #siteの//以前を削除
47
  site = site.replace("https://","")
48
- if agent_chain.run(input=message+" site:"+site):
49
  response = agent_chain.run(input=message+" site:"+site)
50
- if not response:
51
- response = "website not found"
 
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