Skip to content

Commit

Permalink
Removed print logs and updated selection in connector to be required …
Browse files Browse the repository at this point in the history
…and have a default vaule.
  • Loading branch information
jwjordan committed Aug 18, 2024
1 parent 5a0454e commit 9a37a7f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
11 changes: 3 additions & 8 deletions backend/danswer/connectors/zendesk/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
from danswer.connectors.models import Section
from danswer.file_processing.html_utils import parse_html_page_basic

# Define a constant for the time delay
TIME_DELAY_SECONDS = 5

def _article_to_document(article: Article, content_tags: dict[str, str]) -> Document:
author = BasicExpertInfo(
Expand Down Expand Up @@ -235,22 +237,15 @@ def _poll_tickets(self, start: SecondsSinceUnixEpoch | None) -> GenerateDocument
except StopIteration:
# No more tickets to process
if doc_batch:
print(f"Yielding final batch of {len(doc_batch)} tickets")
yield doc_batch
print(f"Finished processing. Total tickets processed: {total_processed}")
return
except Exception as e:
print(f"Error processing ticket: {str(e)}")

if doc_batch:
print(f"Yielding batch of {len(doc_batch)} tickets")
yield doc_batch

print(f"Total tickets processed: {total_processed}")
time.sleep(5) # 5-second delay between batches to rate-limit calling the Zendesk API
time.sleep(TIME_DELAY_SECONDS) # 5-second delay between batches to rate-limit calling the Zendesk API

except Exception as e:
print(f"Error fetching tickets from Zendesk: {str(e)}")
raise

if __name__ == "__main__":
Expand Down
3 changes: 2 additions & 1 deletion web/src/lib/connectors/connectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -561,11 +561,12 @@ For example, specifying .*-support.* as a "channel" will cause the connector to
query: "Select the what content this connector will index:",
label: "Content Type",
name: "content_type",
optional: true,
optional: false,
options: [
{ name: "articles", value: "articles" },
{ name: "tickets", value: "tickets" }
],
default: 0,
}
],
},
Expand Down

0 comments on commit 9a37a7f

Please sign in to comment.