From a15711e63500d9f681002ef4aad0d31382769371 Mon Sep 17 00:00:00 2001 From: sabaimran Date: Sat, 15 Jul 2023 15:53:56 -0700 Subject: [PATCH] Fix null type checks in get /config --- src/khoj/routers/web_client.py | 35 +++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/src/khoj/routers/web_client.py b/src/khoj/routers/web_client.py index 43ffb357..29179cdd 100644 --- a/src/khoj/routers/web_client.py +++ b/src/khoj/routers/web_client.py @@ -39,15 +39,36 @@ if not state.demo: processor=None, ) current_config = state.config or json.loads(default_full_config.json()) + successfully_configured = { - "pdf": state.content_index.pdf is not None, - "markdown": state.content_index.markdown is not None, - "org": state.content_index.org is not None, - "image": state.content_index.image is not None, - "github": state.content_index.github is not None, - "notion": state.content_index.notion is not None, - "conversation": state.processor_config.conversation is not None, + "pdf": False, + "markdown": False, + "org": False, + "image": False, + "github": False, + "notion": False, + "conversation": False, } + + if state.content_index: + successfully_configured.update( + { + "pdf": state.content_index.pdf is not None, + "markdown": state.content_index.markdown is not None, + "org": state.content_index.org is not None, + "image": state.content_index.image is not None, + "github": state.content_index.github is not None, + "notion": state.content_index.notion is not None, + } + ) + + if state.processor_config: + successfully_configured.update( + { + "conversation": state.processor_config.conversation is not None, + } + ) + return templates.TemplateResponse( "config.html", context={