Fix null checking in state for content config API and telemetry API

This commit is contained in:
sabaimran
2023-06-26 11:37:34 -07:00
parent 5e39421f56
commit 35e24d7851
2 changed files with 3 additions and 2 deletions

View File

@@ -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

View File

@@ -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())