mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-05 05:39:11 +00:00
Improve notes search actor to always create a non-empty list of queries
- Remove the option for Notes search query generation actor to return no queries. Whether search should be performed is decided before, this step doesn't need to decide that - But do not throw warning if the response is a list with no elements
This commit is contained in:
@@ -11,7 +11,6 @@ from khoj.processor.conversation.openai.utils import (
|
||||
completion_with_backoff,
|
||||
)
|
||||
from khoj.processor.conversation.utils import generate_chatml_messages_with_context
|
||||
from khoj.utils.constants import empty_escape_sequences
|
||||
from khoj.utils.helpers import ConversationCommand, is_none_or_empty
|
||||
from khoj.utils.rawconfig import LocationData
|
||||
|
||||
@@ -75,7 +74,7 @@ def extract_questions(
|
||||
response = response.strip()
|
||||
response = json.loads(response)
|
||||
response = [q.strip() for q in response if q.strip()]
|
||||
if not isinstance(response, list) or not response or len(response) == 0:
|
||||
if not isinstance(response, list) or not response:
|
||||
logger.error(f"Invalid response for constructing subqueries: {response}")
|
||||
return [text]
|
||||
return response
|
||||
|
||||
Reference in New Issue
Block a user