Your Name commited on
Commit
1218a11
1 Parent(s): f6ab9bd

errorハンドリング

Browse files
Files changed (2) hide show
  1. app.py +2 -1
  2. github +1 -1
app.py CHANGED
@@ -1,7 +1,6 @@
1
  import gradio as gr
2
  import os
3
 
4
-
5
  from langchain import OpenAI, ConversationChain
6
  from langchain.prompts import PromptTemplate
7
  from langchain.embeddings.openai import OpenAIEmbeddings
@@ -47,6 +46,8 @@ def chat(message, site,history):
47
  #siteの//以前を削除
48
  site = site.replace("https://","")
49
  response = agent_chain.run(input=message+" site:"+site)
 
 
50
  history.append((message, response))
51
 
52
  return history, history
 
1
  import gradio as gr
2
  import os
3
 
 
4
  from langchain import OpenAI, ConversationChain
5
  from langchain.prompts import PromptTemplate
6
  from langchain.embeddings.openai import OpenAIEmbeddings
 
46
  #siteの//以前を削除
47
  site = site.replace("https://","")
48
  response = agent_chain.run(input=message+" site:"+site)
49
+ if not response:
50
+ response = "website not found"
51
  history.append((message, response))
52
 
53
  return history, history
github CHANGED
@@ -1 +1 @@
1
- Subproject commit 0b612aaaa0111bb09cfa8a491f27d4d717dd4a92
 
1
+ Subproject commit f9b4d012cf772c42a52ca4c1395fd75bbbbf5437