Spaces:
Sleeping
Sleeping
Tuchuanhuhuhu
commited on
Commit
·
e121fd7
1
Parent(s):
6a2a50c
解决川虎助理访问某些网页时崩溃的问题
Browse files
modules/models/ChuanhuAgent.py
CHANGED
|
@@ -146,6 +146,8 @@ class ChuanhuAgent_Client(BaseLLMModel):
|
|
| 146 |
|
| 147 |
def summary_url(self, url):
|
| 148 |
text = self.fetch_url_content(url)
|
|
|
|
|
|
|
| 149 |
text_summary = self.summary(text)
|
| 150 |
url_content = "webpage content summary:\n" + text_summary
|
| 151 |
|
|
@@ -153,6 +155,8 @@ class ChuanhuAgent_Client(BaseLLMModel):
|
|
| 153 |
|
| 154 |
def ask_url(self, url, question):
|
| 155 |
text = self.fetch_url_content(url)
|
|
|
|
|
|
|
| 156 |
texts = Document(page_content=text)
|
| 157 |
texts = self.text_splitter.split_documents([texts])
|
| 158 |
# use embedding
|
|
|
|
| 146 |
|
| 147 |
def summary_url(self, url):
|
| 148 |
text = self.fetch_url_content(url)
|
| 149 |
+
if text == "":
|
| 150 |
+
return "URL unavailable."
|
| 151 |
text_summary = self.summary(text)
|
| 152 |
url_content = "webpage content summary:\n" + text_summary
|
| 153 |
|
|
|
|
| 155 |
|
| 156 |
def ask_url(self, url, question):
|
| 157 |
text = self.fetch_url_content(url)
|
| 158 |
+
if text == "":
|
| 159 |
+
return "URL unavailable."
|
| 160 |
texts = Document(page_content=text)
|
| 161 |
texts = self.text_splitter.split_documents([texts])
|
| 162 |
# use embedding
|