mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-19 03:58:30 +02:00
Zendesk Tags (#1089)
This commit is contained in:
@@ -21,6 +21,8 @@ def _article_to_document(article: Article) -> Document:
|
|||||||
display_name=article.author.name, email=article.author.email
|
display_name=article.author.name, email=article.author.email
|
||||||
)
|
)
|
||||||
update_time = time_str_to_utc(article.updated_at)
|
update_time = time_str_to_utc(article.updated_at)
|
||||||
|
labels = [str(label) for label in article.label_names]
|
||||||
|
|
||||||
return Document(
|
return Document(
|
||||||
id=f"article:{article.id}",
|
id=f"article:{article.id}",
|
||||||
sections=[
|
sections=[
|
||||||
@@ -30,7 +32,7 @@ def _article_to_document(article: Article) -> Document:
|
|||||||
semantic_identifier=article.title,
|
semantic_identifier=article.title,
|
||||||
doc_updated_at=update_time,
|
doc_updated_at=update_time,
|
||||||
primary_owners=[author],
|
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
|
self.zendesk_client: Zenpy | None = None
|
||||||
|
|
||||||
def load_credentials(self, credentials: dict[str, Any]) -> dict[str, Any] | 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(
|
self.zendesk_client = Zenpy(
|
||||||
subdomain=credentials["zendesk_subdomain"],
|
subdomain=subdomain,
|
||||||
email=credentials["zendesk_email"],
|
email=credentials["zendesk_email"],
|
||||||
token=credentials["zendesk_token"],
|
token=credentials["zendesk_token"],
|
||||||
)
|
)
|
||||||
|
@@ -80,7 +80,7 @@ const Main = () => {
|
|||||||
<div className="flex mb-1 text-sm">
|
<div className="flex mb-1 text-sm">
|
||||||
<p className="my-auto">Existing API Token: </p>
|
<p className="my-auto">Existing API Token: </p>
|
||||||
<p className="ml-1 italic my-auto max-w-md">
|
<p className="ml-1 italic my-auto max-w-md">
|
||||||
{zendeskCredential.credential_json?.zendesk_email}
|
{zendeskCredential.credential_json?.zendesk_token}
|
||||||
</p>
|
</p>
|
||||||
<button
|
<button
|
||||||
className="ml-1 hover:bg-hover rounded p-1"
|
className="ml-1 hover:bg-hover rounded p-1"
|
||||||
@@ -119,7 +119,7 @@ const Main = () => {
|
|||||||
<>
|
<>
|
||||||
<TextFormField
|
<TextFormField
|
||||||
name="zendesk_subdomain"
|
name="zendesk_subdomain"
|
||||||
label="Zendesk Subdomain (<subdomain>.zendesk.com):"
|
label="Zendesk Domain (ie. https://danswer.zendesk.com):"
|
||||||
/>
|
/>
|
||||||
<TextFormField
|
<TextFormField
|
||||||
name="zendesk_email"
|
name="zendesk_email"
|
||||||
@@ -174,7 +174,7 @@ const Main = () => {
|
|||||||
getCredential={(credential) => {
|
getCredential={(credential) => {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<p>{credential.credential_json.zendesk_email}</p>
|
<p>{credential.credential_json.zendesk_token}</p>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
|
Reference in New Issue
Block a user