Skip to content

Commit aec74d2

Browse files
committed
feat: add assistant_threads_setStatus with loading messages
Set a visible "Thinking..." status with rotating loading messages in all three handler paths (DM, mention, modal) across both pydantic-ai and openai-agents-sdk implementations. Add assistant:write scope to both manifests.
1 parent f1adaf9 commit aec74d2

10 files changed

Lines changed: 91 additions & 5 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"manifest": {
3-
"source": "remote"
3+
"source": "local"
44
},
55
"project_id": "f4a2c8e1-7b3d-4e9a-b5f6-2d8c1a0e3f7b"
66
}

openai-agents-sdk/listeners/events/app_mentioned.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,20 @@ def handle_app_mentioned(client: WebClient, event: dict, logger: Logger, say: Sa
4040
)
4141
return
4242

43+
# Set assistant thread status with loading messages
44+
client.assistant_threads_setStatus(
45+
channel_id=channel_id,
46+
thread_ts=thread_ts,
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+
4357
# Add eyes reaction
4458
client.reactions_add(
4559
channel=channel_id,

openai-agents-sdk/listeners/events/message_im.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,20 @@ def handle_message_im(client: WebClient, event: dict, logger: Logger, say: Say):
3737
thread_ts = event.get("thread_ts") or event["ts"]
3838
user_id = event["user"]
3939

40+
# Set assistant thread status with loading messages
41+
client.assistant_threads_setStatus(
42+
channel_id=channel_id,
43+
thread_ts=thread_ts,
44+
status="Thinking...",
45+
loading_messages=[
46+
"Teaching the hamsters to type faster…",
47+
"Untangling the internet cables…",
48+
"Consulting the office goldfish…",
49+
"Polishing up the response just for you…",
50+
"Convincing the AI to stop overthinking…",
51+
],
52+
)
53+
4054
# Add eyes reaction only to the first message (not threaded replies)
4155
if not event.get("thread_ts"):
4256
client.reactions_add(

openai-agents-sdk/listeners/views/issue_modal.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,20 @@ def handle_issue_submission(ack: Ack, body: dict, client: WebClient, logger: Log
3333
)
3434
thread_ts = initial["ts"]
3535

36+
# Set assistant thread status with loading messages
37+
client.assistant_threads_setStatus(
38+
channel_id=channel_id,
39+
thread_ts=thread_ts,
40+
status="Thinking...",
41+
loading_messages=[
42+
"Teaching the hamsters to type faster…",
43+
"Untangling the internet cables…",
44+
"Consulting the office goldfish…",
45+
"Polishing up the response just for you…",
46+
"Convincing the AI to stop overthinking…",
47+
],
48+
)
49+
3650
# Add eyes reaction
3751
client.reactions_add(
3852
channel=channel_id,

openai-agents-sdk/manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"im:write",
2424
"reactions:write",
2525
"reactions:read",
26-
"users:read"
26+
"users:read",
27+
"assistant:write"
2728
]
2829
}
2930
},

pydantic-ai/.slack/config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"manifest": {
3-
"source": "remote"
3+
"source": "local"
44
},
55
"project_id": "b6f4dc0a-e44e-46fa-8118-7e2c8d870f6c"
6-
}
6+
}

pydantic-ai/listeners/events/app_mentioned.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,20 @@ def handle_app_mentioned(client: WebClient, event: dict, logger: Logger, say: Sa
3939
)
4040
return
4141

42+
# Set assistant thread status with loading messages
43+
client.assistant_threads_setStatus(
44+
channel_id=channel_id,
45+
thread_ts=thread_ts,
46+
status="Thinking...",
47+
loading_messages=[
48+
"Teaching the hamsters to type faster…",
49+
"Untangling the internet cables…",
50+
"Consulting the office goldfish…",
51+
"Polishing up the response just for you…",
52+
"Convincing the AI to stop overthinking…",
53+
],
54+
)
55+
4256
# Add eyes reaction only to the first message (not threaded replies)
4357
if not event.get("thread_ts"):
4458
client.reactions_add(

pydantic-ai/listeners/events/message_im.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,20 @@ def handle_message_im(client: WebClient, event: dict, logger: Logger, say: Say):
3636
thread_ts = event.get("thread_ts") or event["ts"]
3737
user_id = event["user"]
3838

39+
# Set assistant thread status with loading messages
40+
client.assistant_threads_setStatus(
41+
channel_id=channel_id,
42+
thread_ts=thread_ts,
43+
status="Thinking...",
44+
loading_messages=[
45+
"Teaching the hamsters to type faster…",
46+
"Untangling the internet cables…",
47+
"Consulting the office goldfish…",
48+
"Polishing up the response just for you…",
49+
"Convincing the AI to stop overthinking…",
50+
],
51+
)
52+
3953
# Add eyes reaction only to the first message (not threaded replies)
4054
if not event.get("thread_ts"):
4155
client.reactions_add(

pydantic-ai/listeners/views/issue_modal.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,20 @@ def handle_issue_submission(ack: Ack, body: dict, client: WebClient, logger: Log
3232
)
3333
thread_ts = initial["ts"]
3434

35+
# Set assistant thread status with loading messages
36+
client.assistant_threads_setStatus(
37+
channel_id=channel_id,
38+
thread_ts=thread_ts,
39+
status="Thinking...",
40+
loading_messages=[
41+
"Teaching the hamsters to type faster…",
42+
"Untangling the internet cables…",
43+
"Consulting the office goldfish…",
44+
"Polishing up the response just for you…",
45+
"Convincing the AI to stop overthinking…",
46+
],
47+
)
48+
3549
# Add eyes reaction
3650
client.reactions_add(
3751
channel=channel_id,

pydantic-ai/manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"im:write",
2424
"reactions:write",
2525
"reactions:read",
26-
"users:read"
26+
"users:read",
27+
"assistant:write"
2728
]
2829
}
2930
},

0 commit comments

Comments
 (0)