Skip to content

Commit

Permalink
minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrus2281 committed Oct 17, 2024
1 parent 23b24e0 commit da3c35f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ classifiers = [
dependencies = [
"PyYAML>=6.0.1",
"slack_bolt>=1.18.1",
"solace_ai_connector>=0.1.1",
"solace_ai_connector>=0.1.3",
"prettytable>=3.10.0",
]

[project.urls]
Expand Down
14 changes: 8 additions & 6 deletions src/solace_ai_connector_slack/components/slack_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,15 @@ def handle_event(self, event):
user_email = self.get_user_email(event.get("user"))
(text, mention_emails) = self.process_text_for_mentions(event["text"])

# Determine the thread_ts to put in the message
# Determine the reply_to thread to put in the message
if event.get("channel_type") == "im" and event.get("subtype", event.get("type")) == "app_mention":
ts = event.get("ts")
# First message uses ts, subsequent messages use thread_ts
reply_to = event.get("thread_ts") or event.get("ts")
else:
ts = None
# First message uses ts, subsequent messages use thread_ts
# thread_ts is null in direct messages
reply_to = event.get("thread_ts")

reply_to = event.get("thread_ts") or ts
if reply_to:
thread_id = f"{event.get("channel")}_{reply_to}"
else:
Expand All @@ -291,7 +293,7 @@ def handle_event(self, event):
"mentions": mention_emails,
"type": event.get("type"),
"client_msg_id": event.get("client_msg_id"),
"ts": ts,
"ts": event.get("ts"),
"channel": event.get("channel"),
"channel_name": event.get("channel_name", ""),
"subtype": event.get("subtype"),
Expand All @@ -306,7 +308,7 @@ def handle_event(self, event):
"team_id": event.get("team"),
"type": event.get("type"),
"client_msg_id": event.get("client_msg_id"),
"ts": ts,
"ts": event.get("ts"),
"thread_ts": event.get("thread_ts"),
"channel": event.get("channel"),
"subtype": event.get("subtype"),
Expand Down

0 comments on commit da3c35f

Please sign in to comment.