-
-
Notifications
You must be signed in to change notification settings - Fork 336
Description
Is your feature request related to a problem? Please describe.
Currently, when NestBot is mentioned or observes monitored channels, and does not immediately have an answer, it displays a "Thinking" message.
Describe the solution you'd like
Replace the "Thinking" message for mentions and monitored channels' unanswered messages with a 👀 reaction. This will visually indicate that NestBot is aware of the message and is beginning to work on it, improving the perceived responsiveness and user experience.
Relevant code for reference
The following code handles the "Thinking" message logic for mentions and messages in monitored channels:
1. Handles posting the "Thinking" message for app mentions:
backend/apps/slack/events/app_mention.py
def handle_event(self, event, client):
# ...
thread_ts = event.get("thread_ts") or event.get("ts")
placeholder = client.chat_postMessage(
channel=channel_id,
blocks=[markdown("⏳ Thinking…")],
text="Thinking…",
thread_ts=thread_ts,
)
reply_blocks = get_blocks(query=query)
client.chat_update(
channel=channel_id,
ts=placeholder["ts"],
blocks=reply_blocks,
text=query,
)2. Handles unanswered messages in monitored channels and enqueues AI reply jobs:
backend/apps/slack/events/message_posted.py
from apps.slack.services.message_auto_reply import generate_ai_reply_if_unanswered
# ...
django_rq.get_queue("ai").enqueue_in(
timedelta(minutes=QUEUE_RESPONSE_TIME_MINUTES),
generate_ai_reply_if_unanswered,
message.id,
)3. Actual AI reply posting if a message is found to be unanswered:
backend/apps/slack/services/message_auto_reply.py
@job("ai")
def generate_ai_reply_if_unanswered(message_id: int):
# ...
result = client.conversations_replies(
channel=message.conversation.slack_channel_id,
ts=message.slack_message_id,
limit=1,
)
if result.get("messages") and result["messages"][0].get("reply_count", 0) > 0:
return
ai_response_text = process_ai_query(query=message.text)
if not ai_response_text:
return
client.chat_postMessage(
channel=message.conversation.slack_channel_id,
blocks=get_blocks(ai_response_text),
text=ai_response_text,
thread_ts=message.slack_message_id,
)Recommendation:
To implement this request, replace the client.chat_postMessage with the "Thinking…" message to use a Slack reaction (:eyes:) instead, e.g.
client.reactions_add(
channel=channel_id,
timestamp=thread_ts,
name="eyes",
)and ensure similar logic is applied where applicable for unanswered messages.
Are you going to work on implementing this?
- No
Additional context
Be sure to update or add tests to verify that the new 👀 reaction is used in the relevant workflows, and that prior "Thinking" messaging is no longer displayed for the specified situations.
// generated with copilot
Metadata
Metadata
Assignees
Labels
Type
Projects
Status