Rename extract_content online results field to webpages

This commit is contained in:
Debanjum Singh Solanky 2024-03-14 15:52:21 +05:30
parent b22a7dae5d
commit 1167f6ddf9
3 changed files with 8 additions and 8 deletions

View file

@ -177,8 +177,8 @@ def converse_offline(
if ConversationCommand.Online in conversation_commands:
simplified_online_results = online_results.copy()
for result in online_results:
if online_results[result].get("extracted_content"):
simplified_online_results[result] = online_results[result]["extracted_content"]
if online_results[result].get("webpages"):
simplified_online_results[result] = online_results[result]["webpages"]
conversation_primer = f"{prompts.online_search_conversation.format(online_results=str(simplified_online_results))}\n{conversation_primer}"
if not is_none_or_empty(compiled_references_message):

View file

@ -72,9 +72,9 @@ async def search_online(query: str, conversation_history: dict, location: Locati
results = await asyncio.gather(*tasks)
# Collect extracted info from the retrieved web pages
for subquery, extracted_webpage_content in results:
if extracted_webpage_content is not None:
response_dict[subquery]["extracted_content"] = extracted_webpage_content
for subquery, webpage_extract in results:
if webpage_extract is not None:
response_dict[subquery]["webpages"] = webpage_extract
return response_dict
@ -104,7 +104,7 @@ async def read_webpages(query: str, conversation_history: dict, location: Locati
results: Dict[str, Dict[str, str]] = defaultdict(dict)
for url in urls:
_, result = await read_webpage_and_extract_content(query, url)
results[url]["extracted_content"] = result
results[url]["webpages"] = result
return results

View file

@ -334,8 +334,8 @@ async def generate_better_image_prompt(
for result in online_results:
if online_results[result].get("answerBox"):
simplified_online_results[result] = online_results[result]["answerBox"]
elif online_results[result].get("extracted_content"):
simplified_online_results[result] = online_results[result]["extracted_content"]
elif online_results[result].get("webpages"):
simplified_online_results[result] = online_results[result]["webpages"]
image_prompt = prompts.image_generation_improve_prompt.format(
query=q,