mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 21:19:12 +00:00
Test select webpage as data source and extract web urls chat actors
This commit is contained in:
@@ -11,6 +11,7 @@ from khoj.routers.helpers import (
|
|||||||
aget_relevant_information_sources,
|
aget_relevant_information_sources,
|
||||||
aget_relevant_output_modes,
|
aget_relevant_output_modes,
|
||||||
generate_online_subqueries,
|
generate_online_subqueries,
|
||||||
|
infer_webpage_urls,
|
||||||
)
|
)
|
||||||
from khoj.utils.helpers import ConversationCommand
|
from khoj.utils.helpers import ConversationCommand
|
||||||
|
|
||||||
@@ -510,6 +511,34 @@ async def test_select_data_sources_actor_chooses_to_search_online(chat_client):
|
|||||||
assert ConversationCommand.Online in conversation_commands
|
assert ConversationCommand.Online in conversation_commands
|
||||||
|
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------------------------------
|
||||||
|
@pytest.mark.anyio
|
||||||
|
@pytest.mark.django_db(transaction=True)
|
||||||
|
async def test_select_data_sources_actor_chooses_to_read_webpage(chat_client):
|
||||||
|
# Arrange
|
||||||
|
user_query = "Summarize the wikipedia page on the history of the internet"
|
||||||
|
|
||||||
|
# Act
|
||||||
|
conversation_commands = await aget_relevant_information_sources(user_query, {})
|
||||||
|
|
||||||
|
# Assert
|
||||||
|
assert ConversationCommand.Webpage in conversation_commands
|
||||||
|
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------------------------------
|
||||||
|
@pytest.mark.anyio
|
||||||
|
@pytest.mark.django_db(transaction=True)
|
||||||
|
async def test_infer_webpage_urls_actor_extracts_correct_links(chat_client):
|
||||||
|
# Arrange
|
||||||
|
user_query = "Summarize the wikipedia page on the history of the internet"
|
||||||
|
|
||||||
|
# Act
|
||||||
|
urls = await infer_webpage_urls(user_query, {}, None)
|
||||||
|
|
||||||
|
# Assert
|
||||||
|
assert "https://en.wikipedia.org/wiki/History_of_the_Internet" in urls
|
||||||
|
|
||||||
|
|
||||||
# Helpers
|
# Helpers
|
||||||
# ----------------------------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------------------------
|
||||||
def populate_chat_history(message_list):
|
def populate_chat_history(message_list):
|
||||||
|
|||||||
Reference in New Issue
Block a user