Skip to content

Commit

Permalink
Fix null checking in state for content config API and telemetry API
Browse files Browse the repository at this point in the history
  • Loading branch information
sabaimran committed Jun 26, 2023
1 parent 5e39421 commit 35e24d7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/khoj/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def save_chat_session():

@schedule.repeat(schedule.every(59).minutes)
def upload_telemetry():
if not state.config.app.should_log_telemetry or not state.telemetry:
if not state.config or not state.config.app.should_log_telemetry or not state.telemetry:
message = "📡 No telemetry to upload" if not state.telemetry else "📡 Telemetry logging disabled"
logger.debug(message)
return
Expand Down
3 changes: 2 additions & 1 deletion src/khoj/routers/web_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ def content_config_page(request: Request, content_type: str):
compressed_jsonl=default_content_type["compressed-jsonl"],
embeddings_file=default_content_type["embeddings-file"],
)

current_config = (
state.config.content_type[content_type]
if state.config and state.config.content_type and content_type in state.config.content_type
if state.config and state.config.content_type and state.config.content_type[content_type] # type: ignore
else default_config
)
current_config = json.loads(current_config.json())
Expand Down

0 comments on commit 35e24d7

Please sign in to comment.