mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-03-29 11:12:02 +01:00
Zendesk Tags (#1089)
This commit is contained in:
parent
514e7f6e41
commit
e505486ca4
@ -21,6 +21,8 @@ def _article_to_document(article: Article) -> Document:
|
||||
display_name=article.author.name, email=article.author.email
|
||||
)
|
||||
update_time = time_str_to_utc(article.updated_at)
|
||||
labels = [str(label) for label in article.label_names]
|
||||
|
||||
return Document(
|
||||
id=f"article:{article.id}",
|
||||
sections=[
|
||||
@ -30,7 +32,7 @@ def _article_to_document(article: Article) -> Document:
|
||||
semantic_identifier=article.title,
|
||||
doc_updated_at=update_time,
|
||||
primary_owners=[author],
|
||||
metadata={"type": "article"},
|
||||
metadata={"labels": labels} if labels else {},
|
||||
)
|
||||
|
||||
|
||||
@ -45,8 +47,15 @@ class ZendeskConnector(LoadConnector, PollConnector):
|
||||
self.zendesk_client: Zenpy | None = None
|
||||
|
||||
def load_credentials(self, credentials: dict[str, Any]) -> dict[str, Any] | None:
|
||||
# Subdomain is actually the whole URL
|
||||
subdomain = (
|
||||
credentials["zendesk_subdomain"]
|
||||
.replace("https://", "")
|
||||
.split(".zendesk.com")[0]
|
||||
)
|
||||
|
||||
self.zendesk_client = Zenpy(
|
||||
subdomain=credentials["zendesk_subdomain"],
|
||||
subdomain=subdomain,
|
||||
email=credentials["zendesk_email"],
|
||||
token=credentials["zendesk_token"],
|
||||
)
|
||||
|
@ -80,7 +80,7 @@ const Main = () => {
|
||||
<div className="flex mb-1 text-sm">
|
||||
<p className="my-auto">Existing API Token: </p>
|
||||
<p className="ml-1 italic my-auto max-w-md">
|
||||
{zendeskCredential.credential_json?.zendesk_email}
|
||||
{zendeskCredential.credential_json?.zendesk_token}
|
||||
</p>
|
||||
<button
|
||||
className="ml-1 hover:bg-hover rounded p-1"
|
||||
@ -119,7 +119,7 @@ const Main = () => {
|
||||
<>
|
||||
<TextFormField
|
||||
name="zendesk_subdomain"
|
||||
label="Zendesk Subdomain (<subdomain>.zendesk.com):"
|
||||
label="Zendesk Domain (ie. https://danswer.zendesk.com):"
|
||||
/>
|
||||
<TextFormField
|
||||
name="zendesk_email"
|
||||
@ -174,7 +174,7 @@ const Main = () => {
|
||||
getCredential={(credential) => {
|
||||
return (
|
||||
<div>
|
||||
<p>{credential.credential_json.zendesk_email}</p>
|
||||
<p>{credential.credential_json.zendesk_token}</p>
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user