mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-09 21:29:11 +00:00
Make number of conversation starters to get from DB configurable
This commit is contained in:
@@ -566,7 +566,7 @@ class ConversationAdapters:
|
|||||||
return await SpeechToTextModelOptions.objects.filter().afirst()
|
return await SpeechToTextModelOptions.objects.filter().afirst()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
async def aget_conversation_starters(user: KhojUser):
|
async def aget_conversation_starters(user: KhojUser, max_results=3):
|
||||||
all_questions = []
|
all_questions = []
|
||||||
if await ReflectiveQuestion.objects.filter(user=user).aexists():
|
if await ReflectiveQuestion.objects.filter(user=user).aexists():
|
||||||
all_questions = await sync_to_async(ReflectiveQuestion.objects.filter(user=user).values_list)(
|
all_questions = await sync_to_async(ReflectiveQuestion.objects.filter(user=user).values_list)(
|
||||||
@@ -577,7 +577,6 @@ class ConversationAdapters:
|
|||||||
"question", flat=True
|
"question", flat=True
|
||||||
)
|
)
|
||||||
|
|
||||||
max_results = 3
|
|
||||||
all_questions = await sync_to_async(list)(all_questions) # type: ignore
|
all_questions = await sync_to_async(list)(all_questions) # type: ignore
|
||||||
if len(all_questions) < max_results:
|
if len(all_questions) < max_results:
|
||||||
return all_questions
|
return all_questions
|
||||||
|
|||||||
Reference in New Issue
Block a user