Skip to content

Commit 131f8e1

Browse files
authored
Add title argument to SetSuggestedPrompts arguments (#1187)
1 parent 888a11f commit 131f8e1

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

slack_bolt/context/set_suggested_prompts/async_set_suggested_prompts.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import List, Dict, Union
1+
from typing import List, Dict, Union, Optional
22

33
from slack_sdk.web.async_client import AsyncWebClient
44
from slack_sdk.web.async_slack_response import AsyncSlackResponse
@@ -19,7 +19,11 @@ def __init__(
1919
self.channel_id = channel_id
2020
self.thread_ts = thread_ts
2121

22-
async def __call__(self, prompts: List[Union[str, Dict[str, str]]]) -> AsyncSlackResponse:
22+
async def __call__(
23+
self,
24+
prompts: List[Union[str, Dict[str, str]]],
25+
title: Optional[str] = None,
26+
) -> AsyncSlackResponse:
2327
prompts_arg: List[Dict[str, str]] = []
2428
for prompt in prompts:
2529
if isinstance(prompt, str):
@@ -31,4 +35,5 @@ async def __call__(self, prompts: List[Union[str, Dict[str, str]]]) -> AsyncSlac
3135
channel_id=self.channel_id,
3236
thread_ts=self.thread_ts,
3337
prompts=prompts_arg,
38+
title=title,
3439
)

slack_bolt/context/set_suggested_prompts/set_suggested_prompts.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import List, Dict, Union
1+
from typing import List, Dict, Union, Optional
22

33
from slack_sdk import WebClient
44
from slack_sdk.web import SlackResponse
@@ -19,7 +19,11 @@ def __init__(
1919
self.channel_id = channel_id
2020
self.thread_ts = thread_ts
2121

22-
def __call__(self, prompts: List[Union[str, Dict[str, str]]]) -> SlackResponse:
22+
def __call__(
23+
self,
24+
prompts: List[Union[str, Dict[str, str]]],
25+
title: Optional[str] = None,
26+
) -> SlackResponse:
2327
prompts_arg: List[Dict[str, str]] = []
2428
for prompt in prompts:
2529
if isinstance(prompt, str):
@@ -31,4 +35,5 @@ def __call__(self, prompts: List[Union[str, Dict[str, str]]]) -> SlackResponse:
3135
channel_id=self.channel_id,
3236
thread_ts=self.thread_ts,
3337
prompts=prompts_arg,
38+
title=title,
3439
)

tests/scenario_tests/test_events_assistant.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ def start_thread(say: Say, set_suggested_prompts: SetSuggestedPrompts, context:
4646
assert context.thread_ts == "1726133698.626339"
4747
say("Hi, how can I help you today?")
4848
set_suggested_prompts(prompts=[{"title": "What does SLACK stand for?", "message": "What does SLACK stand for?"}])
49+
set_suggested_prompts(
50+
prompts=[{"title": "What does SLACK stand for?", "message": "What does SLACK stand for?"}], title="foo"
51+
)
4952
state["called"] = True
5053

5154
@assistant.thread_context_changed

tests/scenario_tests_async/test_events_assistant.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ async def start_thread(say: AsyncSay, set_suggested_prompts: AsyncSetSuggestedPr
6161
await set_suggested_prompts(
6262
prompts=[{"title": "What does SLACK stand for?", "message": "What does SLACK stand for?"}]
6363
)
64+
await set_suggested_prompts(
65+
prompts=[{"title": "What does SLACK stand for?", "message": "What does SLACK stand for?"}],
66+
title="foo",
67+
)
6468
state["called"] = True
6569

6670
@assistant.thread_context_changed

0 commit comments

Comments
 (0)