mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-07 21:29:13 +00:00
Use logger.warning since logger.warn is deprecated
This commit is contained in:
@@ -37,7 +37,7 @@ def configure_server(args, required=False):
|
|||||||
logger.error(f"Exiting as Khoj is not configured.\nConfigure it via GUI or by editing {state.config_file}.")
|
logger.error(f"Exiting as Khoj is not configured.\nConfigure it via GUI or by editing {state.config_file}.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
logger.warn(
|
logger.warning(
|
||||||
f"Khoj is not configured.\nConfigure it via khoj GUI, plugins or by editing {state.config_file}."
|
f"Khoj is not configured.\nConfigure it via khoj GUI, plugins or by editing {state.config_file}."
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
@@ -88,7 +88,7 @@ def configure_search_types(config: FullConfig):
|
|||||||
|
|
||||||
def configure_search(model: SearchModels, config: FullConfig, regenerate: bool, t: Optional[state.SearchType] = None):
|
def configure_search(model: SearchModels, config: FullConfig, regenerate: bool, t: Optional[state.SearchType] = None):
|
||||||
if config is None or config.content_type is None or config.search_type is None:
|
if config is None or config.content_type is None or config.search_type is None:
|
||||||
logger.warn("🚨 No Content or Search type is configured.")
|
logger.warning("🚨 No Content or Search type is configured.")
|
||||||
return
|
return
|
||||||
|
|
||||||
# Initialize Org Notes Search
|
# Initialize Org Notes Search
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ def extract_questions(text, model="text-davinci-003", conversation_log={}, api_k
|
|||||||
.replace("', '", '", "')
|
.replace("', '", '", "')
|
||||||
)
|
)
|
||||||
except json.decoder.JSONDecodeError:
|
except json.decoder.JSONDecodeError:
|
||||||
logger.warn(f"GPT returned invalid JSON. Falling back to using user message as search query.\n{response}")
|
logger.warning(f"GPT returned invalid JSON. Falling back to using user message as search query.\n{response}")
|
||||||
questions = [text]
|
questions = [text]
|
||||||
logger.debug(f"Extracted Questions by GPT: {questions}")
|
logger.debug(f"Extracted Questions by GPT: {questions}")
|
||||||
return questions
|
return questions
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ class MarkdownToJsonl(TextToJsonl):
|
|||||||
}
|
}
|
||||||
|
|
||||||
if any(files_with_non_markdown_extensions):
|
if any(files_with_non_markdown_extensions):
|
||||||
logger.warn(
|
logger.warning(
|
||||||
f"[Warning] There maybe non markdown-mode files in the input set: {files_with_non_markdown_extensions}"
|
f"[Warning] There maybe non markdown-mode files in the input set: {files_with_non_markdown_extensions}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ class OrgToJsonl(TextToJsonl):
|
|||||||
|
|
||||||
files_with_non_org_extensions = {org_file for org_file in all_org_files if not org_file.endswith(".org")}
|
files_with_non_org_extensions = {org_file for org_file in all_org_files if not org_file.endswith(".org")}
|
||||||
if any(files_with_non_org_extensions):
|
if any(files_with_non_org_extensions):
|
||||||
logger.warn(f"There maybe non org-mode files in the input set: {files_with_non_org_extensions}")
|
logger.warning(f"There maybe non org-mode files in the input set: {files_with_non_org_extensions}")
|
||||||
|
|
||||||
logger.debug(f"Processing files: {all_org_files}")
|
logger.debug(f"Processing files: {all_org_files}")
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,9 @@ class PdfToJsonl(TextToJsonl):
|
|||||||
files_with_non_pdf_extensions = {pdf_file for pdf_file in all_pdf_files if not pdf_file.endswith(".pdf")}
|
files_with_non_pdf_extensions = {pdf_file for pdf_file in all_pdf_files if not pdf_file.endswith(".pdf")}
|
||||||
|
|
||||||
if any(files_with_non_pdf_extensions):
|
if any(files_with_non_pdf_extensions):
|
||||||
logger.warn(f"[Warning] There maybe non pdf-mode files in the input set: {files_with_non_pdf_extensions}")
|
logger.warning(
|
||||||
|
f"[Warning] There maybe non pdf-mode files in the input set: {files_with_non_pdf_extensions}"
|
||||||
|
)
|
||||||
|
|
||||||
logger.debug(f"Processing files: {all_pdf_files}")
|
logger.debug(f"Processing files: {all_pdf_files}")
|
||||||
|
|
||||||
|
|||||||
@@ -147,10 +147,10 @@ async def search(
|
|||||||
# Run validation checks
|
# Run validation checks
|
||||||
results: List[SearchResponse] = []
|
results: List[SearchResponse] = []
|
||||||
if q is None or q == "":
|
if q is None or q == "":
|
||||||
logger.warn(f"No query param (q) passed in API call to initiate search")
|
logger.warning(f"No query param (q) passed in API call to initiate search")
|
||||||
return results
|
return results
|
||||||
if not state.model or not any(state.model.__dict__.values()):
|
if not state.model or not any(state.model.__dict__.values()):
|
||||||
logger.warn(f"No search models loaded. Configure a search model before initiating search")
|
logger.warning(f"No search models loaded. Configure a search model before initiating search")
|
||||||
return results
|
return results
|
||||||
|
|
||||||
# initialize variables
|
# initialize variables
|
||||||
|
|||||||
Reference in New Issue
Block a user