diff --git a/backend/danswer/connectors/freshdesk/connector.py b/backend/danswer/connectors/freshdesk/connector.py index 04033b05f3f..db2a293e95f 100644 --- a/backend/danswer/connectors/freshdesk/connector.py +++ b/backend/danswer/connectors/freshdesk/connector.py @@ -42,18 +42,28 @@ "to_emails", } -_SOURCE_NUMBER_TYPE_MAP = { - "1": "Email", - "2": "Portal", - "3": "Phone", - "7": "Chat", - "9": "Feedback Widget", - "10": "Outbound Email", +_SOURCE_NUMBER_TYPE_MAP: dict[int, str] = { + 1: "Email", + 2: "Portal", + 3: "Phone", + 7: "Chat", + 9: "Feedback Widget", + 10: "Outbound Email", } -_PRIORITY_NUMBER_TYPE_MAP = {"1": "low", "2": "medium", "3": "high", "4": "urgent"} +_PRIORITY_NUMBER_TYPE_MAP: dict[int, str] = { + 1: "low", + 2: "medium", + 3: "high", + 4: "urgent", +} -_STATUS_NUMBER_TYPE_MAP = {"2": "open", "3": "pending", "4": "resolved", "5": "closed"} +_STATUS_NUMBER_TYPE_MAP: dict[int, str] = { + 2: "open", + 3: "pending", + 4: "resolved", + 5: "closed", +} def _create_metadata_from_ticket(ticket: dict) -> dict: @@ -91,7 +101,7 @@ def _create_metadata_from_ticket(ticket: dict) -> dict: # Convert source numbers to human-parsable string if source_number := ticket.get("source"): metadata["source"] = _SOURCE_NUMBER_TYPE_MAP.get( - str(source_number), "Unknown Source Type" + source_number, "Unknown Source Type" ) # Convert priority numbers to human-parsable string @@ -103,7 +113,7 @@ def _create_metadata_from_ticket(ticket: dict) -> dict: # Convert status to human-parsable string if status_number := ticket.get("status"): metadata["status"] = _STATUS_NUMBER_TYPE_MAP.get( - str(status_number), "Unknown Status" + status_number, "Unknown Status" ) due_by = datetime.fromisoformat(ticket["due_by"].replace("Z", "+00:00"))