Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -271,7 +271,7 @@ def find_all(purpose,task,history, url):
|
|
| 271 |
#if action_input in query.tasks:
|
| 272 |
print ("trying")
|
| 273 |
try:
|
| 274 |
-
if
|
| 275 |
rawp = []
|
| 276 |
source = urllib.request.urlopen(url).read()
|
| 277 |
soup = bs4.BeautifulSoup(source,'lxml')
|
|
@@ -298,15 +298,15 @@ def find_all(purpose,task,history, url):
|
|
| 298 |
print("compressing...")
|
| 299 |
rawp = compress_data(c,purpose,task,rawp)
|
| 300 |
print (rawp)
|
| 301 |
-
history
|
| 302 |
task = "complete?"
|
| 303 |
return "UPDATE-TASK", None, history, task
|
| 304 |
else:
|
| 305 |
-
history
|
| 306 |
return "UPDATE-TASK", None, history, task
|
| 307 |
except Exception as e:
|
| 308 |
print (e)
|
| 309 |
-
history
|
| 310 |
return "UPDATE-TASK", None, history, task
|
| 311 |
|
| 312 |
#else:
|
|
|
|
| 271 |
#if action_input in query.tasks:
|
| 272 |
print ("trying")
|
| 273 |
try:
|
| 274 |
+
if url != "" and url != None:
|
| 275 |
rawp = []
|
| 276 |
source = urllib.request.urlopen(url).read()
|
| 277 |
soup = bs4.BeautifulSoup(source,'lxml')
|
|
|
|
| 298 |
print("compressing...")
|
| 299 |
rawp = compress_data(c,purpose,task,rawp)
|
| 300 |
print (rawp)
|
| 301 |
+
history += "observation: the search results are:\n {}\n".format(rawp)
|
| 302 |
task = "complete?"
|
| 303 |
return "UPDATE-TASK", None, history, task
|
| 304 |
else:
|
| 305 |
+
history += "observation: I need to trigger a search using the following syntax:\naction: WEBSITE_SCRAPE action_input=SEARCH_QUERY\n"
|
| 306 |
return "UPDATE-TASK", None, history, task
|
| 307 |
except Exception as e:
|
| 308 |
print (e)
|
| 309 |
+
history += "observation: I need to trigger a search using the following syntax:\naction: WEBSITE_SCRAPE action_input=SEARCH_QUERY\n"
|
| 310 |
return "UPDATE-TASK", None, history, task
|
| 311 |
|
| 312 |
#else:
|