Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion slack_sdk/web/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2091,13 +2091,24 @@ async def assistant_threads_setStatus(
thread_ts: str,
status: str,
loading_messages: Optional[List[str]] = None,
icon_emoji: Optional[str] = None,
icon_url: Optional[str] = None,
username: Optional[str] = None,
**kwargs,
) -> AsyncSlackResponse:
"""Set the status for an AI assistant thread.
https://docs.slack.dev/reference/methods/assistant.threads.setStatus
"""
kwargs.update(
{"channel_id": channel_id, "thread_ts": thread_ts, "status": status, "loading_messages": loading_messages}
{
"channel_id": channel_id,
"thread_ts": thread_ts,
"status": status,
"loading_messages": loading_messages,
"icon_emoji": icon_emoji,
"icon_url": icon_url,
"username": username,
}
)
kwargs = _remove_none_values(kwargs)
return await self.api_call("assistant.threads.setStatus", json=kwargs)
Expand Down Expand Up @@ -2903,6 +2914,9 @@ async def chat_startStream(
recipient_user_id: Optional[str] = None,
chunks: Optional[Sequence[Union[Dict, Chunk]]] = None,
task_display_mode: Optional[str] = None, # timeline, plan
icon_emoji: Optional[str] = None,
icon_url: Optional[str] = None,
username: Optional[str] = None,
**kwargs,
) -> AsyncSlackResponse:
"""Starts a new streaming conversation.
Expand All @@ -2917,6 +2931,9 @@ async def chat_startStream(
"recipient_user_id": recipient_user_id,
"chunks": chunks,
"task_display_mode": task_display_mode,
"icon_emoji": icon_emoji,
"icon_url": icon_url,
"username": username,
}
)
_parse_web_class_objects(kwargs)
Expand Down
19 changes: 18 additions & 1 deletion slack_sdk/web/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2081,13 +2081,24 @@ def assistant_threads_setStatus(
thread_ts: str,
status: str,
loading_messages: Optional[List[str]] = None,
icon_emoji: Optional[str] = None,
icon_url: Optional[str] = None,
username: Optional[str] = None,
**kwargs,
) -> SlackResponse:
"""Set the status for an AI assistant thread.
https://docs.slack.dev/reference/methods/assistant.threads.setStatus
"""
kwargs.update(
{"channel_id": channel_id, "thread_ts": thread_ts, "status": status, "loading_messages": loading_messages}
{
"channel_id": channel_id,
"thread_ts": thread_ts,
"status": status,
"loading_messages": loading_messages,
"icon_emoji": icon_emoji,
"icon_url": icon_url,
"username": username,
}
)
kwargs = _remove_none_values(kwargs)
return self.api_call("assistant.threads.setStatus", json=kwargs)
Expand Down Expand Up @@ -2893,6 +2904,9 @@ def chat_startStream(
recipient_user_id: Optional[str] = None,
chunks: Optional[Sequence[Union[Dict, Chunk]]] = None,
task_display_mode: Optional[str] = None, # timeline, plan
icon_emoji: Optional[str] = None,
icon_url: Optional[str] = None,
username: Optional[str] = None,
**kwargs,
) -> SlackResponse:
"""Starts a new streaming conversation.
Expand All @@ -2907,6 +2921,9 @@ def chat_startStream(
"recipient_user_id": recipient_user_id,
"chunks": chunks,
"task_display_mode": task_display_mode,
"icon_emoji": icon_emoji,
"icon_url": icon_url,
"username": username,
}
)
_parse_web_class_objects(kwargs)
Expand Down
19 changes: 18 additions & 1 deletion slack_sdk/web/legacy_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2092,13 +2092,24 @@ def assistant_threads_setStatus(
thread_ts: str,
status: str,
loading_messages: Optional[List[str]] = None,
icon_emoji: Optional[str] = None,
icon_url: Optional[str] = None,
username: Optional[str] = None,
**kwargs,
) -> Union[Future, SlackResponse]:
"""Set the status for an AI assistant thread.
https://docs.slack.dev/reference/methods/assistant.threads.setStatus
"""
kwargs.update(
{"channel_id": channel_id, "thread_ts": thread_ts, "status": status, "loading_messages": loading_messages}
{
"channel_id": channel_id,
"thread_ts": thread_ts,
"status": status,
"loading_messages": loading_messages,
"icon_emoji": icon_emoji,
"icon_url": icon_url,
"username": username,
}
)
kwargs = _remove_none_values(kwargs)
return self.api_call("assistant.threads.setStatus", json=kwargs)
Expand Down Expand Up @@ -2904,6 +2915,9 @@ def chat_startStream(
recipient_user_id: Optional[str] = None,
chunks: Optional[Sequence[Union[Dict, Chunk]]] = None,
task_display_mode: Optional[str] = None, # timeline, plan
icon_emoji: Optional[str] = None,
icon_url: Optional[str] = None,
username: Optional[str] = None,
**kwargs,
) -> Union[Future, SlackResponse]:
"""Starts a new streaming conversation.
Expand All @@ -2918,6 +2932,9 @@ def chat_startStream(
"recipient_user_id": recipient_user_id,
"chunks": chunks,
"task_display_mode": task_display_mode,
"icon_emoji": icon_emoji,
"icon_url": icon_url,
"username": username,
}
)
_parse_web_class_objects(kwargs)
Expand Down
28 changes: 28 additions & 0 deletions tests/slack_sdk_async/web/test_web_client_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,19 @@ async def run_method(self, method_name, method, async_method):
status="is typing...",
loading_states=["Thinking...", "Writing..."],
)
method(
channel_id="D111",
thread_ts="111.222",
status="counting...",
username="Abacus",
icon_emoji="abacus",
)
await async_method(
channel_id="D111",
thread_ts="111.222",
status="dreaming...",
icon_url="https://example.com/clouds-square.png",
)
elif method_name == "assistant_threads_setTitle":
self.api_methods_to_call.remove(method(channel_id="D111", thread_ts="111.222", title="New chat")["method"])
await async_method(channel_id="D111", thread_ts="111.222", title="New chat")
Expand Down Expand Up @@ -587,6 +600,21 @@ async def run_method(self, method_name, method, async_method):
await async_method(channel="C123", thread_ts="123.123")
method(channel="C123", thread_ts="123.123", recipient_team_id="T123", recipient_user_id="U123")
await async_method(channel="C123", thread_ts="123.123", recipient_team_id="T123", recipient_user_id="U123")
method(
channel="C123",
thread_ts="123.123",
recipient_team_id="T123",
recipient_user_id="U123",
username="Abacus",
icon_emoji="abacus",
)
await async_method(
channel="C123",
thread_ts="123.123",
recipient_team_id="T123",
recipient_user_id="U123",
icon_url="https://example.com/clouds-square.png",
)
elif method_name == "chat_stopStream":
self.api_methods_to_call.remove(
method(channel="C123", ts="123.123", blocks=[{"type": "markdown", "text": "**twelve**"}])["method"]
Expand Down