11import logging
2- from typing import List , Dict
3- from slack_bolt import Assistant , BoltContext , Say , SetSuggestedPrompts
2+ from typing import Dict , List
3+
4+ from slack_bolt import Assistant , BoltContext , Say , SetStatus , SetSuggestedPrompts
45from slack_bolt .context .get_thread_context import GetThreadContext
56from slack_sdk import WebClient
6- from slack_sdk .models .blocks import Block , ContextActionsBlock , FeedbackButtonsElement , FeedbackButtonObject
7+ from slack_sdk .models .blocks import Block , ContextActionsBlock , FeedbackButtonObject , FeedbackButtonsElement
78
89from ..llm_caller import call_llm
910
@@ -83,23 +84,27 @@ def start_assistant_thread(
8384# This listener is invoked when the human user sends a reply in the assistant thread
8485@assistant .user_message
8586def respond_in_assistant_thread (
86- payload : dict ,
87- logger : logging .Logger ,
88- context : BoltContext ,
8987 client : WebClient ,
88+ context : BoltContext ,
89+ logger : logging .Logger ,
90+ payload : dict ,
9091 say : Say ,
92+ set_status : SetStatus ,
9193):
9294 try :
9395 channel_id = payload ["channel" ]
9496 thread_ts = payload ["thread_ts" ]
9597
96- loading_messages = [
97- "Teaching the hamsters to type faster…" ,
98- "Untangling the internet cables…" ,
99- "Consulting the office goldfish…" ,
100- "Polishing up the response just for you…" ,
101- "Convincing the AI to stop overthinking…" ,
102- ]
98+ set_status (
99+ status = "Drafting..." ,
100+ loading_messages = [
101+ "Teaching the hamsters to type faster…" ,
102+ "Untangling the internet cables…" ,
103+ "Consulting the office goldfish…" ,
104+ "Polishing up the response just for you…" ,
105+ "Convincing the AI to stop overthinking…" ,
106+ ],
107+ )
103108
104109 replies = client .conversations_replies (
105110 channel = context .channel_id ,
@@ -114,10 +119,6 @@ def respond_in_assistant_thread(
114119
115120 returned_message = call_llm (messages_in_thread )
116121
117- client .assistant_threads_setStatus (
118- channel_id = channel_id , thread_ts = thread_ts , status = "Bolt is typing" , loading_messages = loading_messages
119- )
120-
121122 stream_response = client .chat_startStream (
122123 channel = channel_id ,
123124 thread_ts = thread_ts ,
0 commit comments