Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhongsun96 committed Oct 30, 2023
1 parent 08909b4 commit 383fe4d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
27 changes: 20 additions & 7 deletions backend/danswer/connectors/gong/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,15 @@ def _get_workspace_id_map(self) -> dict[str, str]:
response.raise_for_status()

workspaces_details = response.json().get("workspaces")
return {workspace["name"]: workspace["id"] for workspace in workspaces_details}
name_id_map = {
workspace["name"]: workspace["id"] for workspace in workspaces_details
}
id_id_map = {
workspace["id"]: workspace["id"] for workspace in workspaces_details
}
# In very rare case, if a workspace is given a name which is the id of another workspace,
# Then the user input is treated as the name
return {**id_id_map, **name_id_map}

def _get_transcript_batches(
self, start_datetime: str | None = None, end_datetime: str | None = None
Expand Down Expand Up @@ -178,8 +186,14 @@ def _fetch_calls(
continue

call_details = call_details_map[call_id]

call_metadata = call_details["metaData"]

call_time_str = call_metadata["started"]
call_title = call_metadata["title"]
logger.info(
f"Indexing Gong call from {call_time_str.split('T', 1)[0]}: {call_title}"
)

call_parties = call_details["parties"]

id_to_name_map = self._parse_parties(call_parties)
Expand All @@ -188,7 +202,6 @@ def _fetch_calls(
speaker_to_name: dict[str, str] = {}

transcript_text = ""
call_title = call_metadata["title"]
if call_title:
transcript_text += f"Call Title: {call_title}\n\n"

Expand Down Expand Up @@ -226,10 +239,10 @@ def _fetch_calls(
source=DocumentSource.GONG,
# Should not ever be Untitled as a call cannot be made without a Title
semantic_identifier=call_title or "Untitled",
doc_updated_at=datetime.fromisoformat(
call_metadata["started"]
).astimezone(timezone.utc),
metadata={"Start Time": call_metadata["started"]},
doc_updated_at=datetime.fromisoformat(call_time_str).astimezone(
timezone.utc
),
metadata={},
)
)
yield doc_batch
Expand Down
5 changes: 3 additions & 2 deletions web/src/app/admin/connectors/gong/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,9 @@ const Main = () => {
name: "workspaces",
label: "Workspaces:",
subtext:
"Specify 0 or more workspaces to index. Be sure to use the EXACT workspace name from Gong. " +
"If no workspaces are specified, transcripts from all workspaces will be indexed.",
"Specify 0 or more workspaces to index. Provide the workspace ID or the EXACT workspace " +
"name from Gong. If no workspaces are specified, transcripts from all workspaces will " +
"be indexed.",
})}
validationSchema={Yup.object().shape({
workspaces: Yup.array().of(
Expand Down

0 comments on commit 383fe4d

Please sign in to comment.