Skip to content

Commit 0dcc875

Browse files
authored
feat: include status loading messages and more feedback blocks (#45)
1 parent 9963b3d commit 0dcc875

File tree

4 files changed

+27
-10
lines changed

4 files changed

+27
-10
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Join the [Slack Developer Program](https://api.slack.com/developer-program) for
1616

1717
Add this app to your workspace using either the Slack CLI or other development tooling, then read ahead to configuring LLM responses in the **[Providers](#providers)** section.
1818

19-
### Using Slack CLI
19+
<details><summary><strong>Using Slack CLI</strong></summary>
2020

2121
Install the latest version of the Slack CLI for your operating system:
2222

@@ -46,7 +46,11 @@ slack install
4646

4747
After the Slack app has been created you're all set to configure the LLM provider!
4848

49-
### Using Terminal
49+
</details>
50+
51+
<details><summary><strong>Using Terminal</strong></summary>
52+
53+
#### Create Your Slack App
5054

5155
1. Open [https://api.slack.com/apps/new](https://api.slack.com/apps/new) and choose "From an app manifest"
5256
2. Choose the workspace you want to install the application to
@@ -91,6 +95,8 @@ source .venv/bin/activate # for Windows OS, .\.venv\Scripts\Activate instead sh
9195
pip install -r requirements.txt
9296
```
9397

98+
</details>
99+
94100
## Providers
95101

96102
### OpenAI Setup

agent/tools/dice.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import random
2-
import time
32

43
from openai.types.responses import FunctionToolParam
54

@@ -23,9 +22,6 @@ def roll_dice(sides: int = 6, count: int = 1) -> dict:
2322
rolls = [random.randint(1, sides) for _ in range(count)]
2423
total = sum(rolls)
2524

26-
# Add a pause between rolls to demonstrate loading states
27-
time.sleep(2)
28-
2925
return {
3026
"rolls": rolls,
3127
"total": total,

listeners/assistant/assistant_thread_started.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def assistant_thread_started(
2626
},
2727
{
2828
"title": "Roll dice for a random number",
29-
"message": "Roll two 12-sided dice and three 6-sided dice for a psuedo-random score.",
29+
"message": "Roll two 12-sided dice and three 6-sided dice for a pseudo-random score.",
3030
},
3131
]
3232
)

listeners/assistant/message.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,22 @@ def message(
4040
thread_ts = payload["thread_ts"]
4141
user_id = context.user_id
4242

43-
# The first example shows detailed thinking steps similar to tool calls
44-
# displayed as plan.
43+
# The first example shows a message with thinking steps that has different
44+
# chunks to construct and update a plan alongside text outputs.
4545
if message["text"] == "Wonder a few deep thoughts.":
46+
set_status(
47+
status="thinking...",
48+
loading_messages=[
49+
"Teaching the hamsters to type faster…",
50+
"Untangling the internet cables…",
51+
"Consulting the office goldfish…",
52+
"Polishing up the response just for you…",
53+
"Convincing the AI to stop overthinking…",
54+
],
55+
)
56+
57+
time.sleep(4)
58+
4659
streamer = client.chat_stream(
4760
channel=channel_id,
4861
recipient_team_id=team_id,
@@ -89,12 +102,12 @@ def message(
89102
id="002",
90103
title="Performing acrobatics...",
91104
status="in_progress",
92-
details="- Jumping atop ropes\n- Juggling bowling pins\n- Riding a single wheel too",
93105
),
94106
],
95107
)
96108
time.sleep(4)
97109

110+
feedback_block = create_feedback_block()
98111
streamer.stop(
99112
chunks=[
100113
PlanUpdateChunk(
@@ -104,11 +117,13 @@ def message(
104117
id="002",
105118
title="Performing acrobatics...",
106119
status="complete",
120+
details="- Jumped atop ropes\n- Juggled bowling pins\n- Rode a single wheel too",
107121
),
108122
MarkdownTextChunk(
109123
text="The crowd appears to be astounded and applauds :popcorn:"
110124
),
111125
],
126+
blocks=feedback_block,
112127
)
113128

114129
# This second example shows a generated text response for a provided prompt

0 commit comments

Comments
 (0)