From 4c39960917404b39472bae855781f71433b632ee Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Thu, 22 Feb 2024 20:16:22 +0530 Subject: [PATCH] Make number of conversation starters to get from DB configurable --- src/khoj/database/adapters/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/khoj/database/adapters/__init__.py b/src/khoj/database/adapters/__init__.py index c075700e..050a0bfc 100644 --- a/src/khoj/database/adapters/__init__.py +++ b/src/khoj/database/adapters/__init__.py @@ -566,7 +566,7 @@ class ConversationAdapters: return await SpeechToTextModelOptions.objects.filter().afirst() @staticmethod - async def aget_conversation_starters(user: KhojUser): + async def aget_conversation_starters(user: KhojUser, max_results=3): all_questions = [] if await ReflectiveQuestion.objects.filter(user=user).aexists(): all_questions = await sync_to_async(ReflectiveQuestion.objects.filter(user=user).values_list)( @@ -577,7 +577,6 @@ class ConversationAdapters: "question", flat=True ) - max_results = 3 all_questions = await sync_to_async(list)(all_questions) # type: ignore if len(all_questions) < max_results: return all_questions