@@ -11,9 +11,6 @@ class BoltAgent:
1111 Experimental:
1212 This API is experimental and may change in future releases.
1313
14- FIXME: chat_stream() only works when thread_ts is available (DMs and threaded replies).
15- It does not work on channel messages because ts is not provided to BoltAgent yet.
16-
1714 @app.event("app_mention")
1815 def handle_mention(agent):
1916 stream = agent.chat_stream()
@@ -27,12 +24,14 @@ def __init__(
2724 client : WebClient ,
2825 channel_id : Optional [str ] = None ,
2926 thread_ts : Optional [str ] = None ,
27+ ts : Optional [str ] = None ,
3028 team_id : Optional [str ] = None ,
3129 user_id : Optional [str ] = None ,
3230 ):
3331 self ._client = client
3432 self ._channel_id = channel_id
3533 self ._thread_ts = thread_ts
34+ self ._ts = ts
3635 self ._team_id = team_id
3736 self ._user_id = user_id
3837
@@ -67,7 +66,7 @@ def chat_stream(
6766 # Argument validation is delegated to chat_stream() and the API
6867 return self ._client .chat_stream (
6968 channel = channel or self ._channel_id , # type: ignore[arg-type]
70- thread_ts = thread_ts or self ._thread_ts , # type: ignore[arg-type]
69+ thread_ts = thread_ts or self ._thread_ts or self . _ts , # type: ignore[arg-type]
7170 recipient_team_id = recipient_team_id or self ._team_id ,
7271 recipient_user_id = recipient_user_id or self ._user_id ,
7372 ** kwargs ,
@@ -96,7 +95,7 @@ def set_status(
9695 """
9796 return self ._client .assistant_threads_setStatus (
9897 channel_id = channel or self ._channel_id , # type: ignore[arg-type]
99- thread_ts = thread_ts or self ._thread_ts , # type: ignore[arg-type]
98+ thread_ts = thread_ts or self ._thread_ts or self . _ts , # type: ignore[arg-type]
10099 status = status ,
101100 loading_messages = loading_messages ,
102101 ** kwargs ,
@@ -133,7 +132,7 @@ def set_suggested_prompts(
133132
134133 return self ._client .assistant_threads_setSuggestedPrompts (
135134 channel_id = channel or self ._channel_id , # type: ignore[arg-type]
136- thread_ts = thread_ts or self ._thread_ts , # type: ignore[arg-type]
135+ thread_ts = thread_ts or self ._thread_ts or self . _ts , # type: ignore[arg-type]
137136 prompts = prompts_arg ,
138137 title = title ,
139138 ** kwargs ,
0 commit comments