-
Notifications
You must be signed in to change notification settings - Fork 0
feat: use BoltAgent for chat_stream in all implementations #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ | |
| import re | ||
| from logging import Logger | ||
|
|
||
| from slack_bolt.agent.async_agent import AsyncBoltAgent | ||
| from slack_bolt.context.say.async_say import AsyncSay | ||
| from slack_sdk.web.async_client import AsyncWebClient | ||
|
|
||
|
|
@@ -22,7 +23,11 @@ | |
|
|
||
|
|
||
| async def handle_app_mentioned( | ||
| client: AsyncWebClient, event: dict, logger: Logger, say: AsyncSay | ||
| client: AsyncWebClient, | ||
| event: dict, | ||
| agent: AsyncBoltAgent, | ||
| logger: Logger, | ||
| say: AsyncSay, | ||
| ): | ||
| """Handle @Casey mentions in channels.""" | ||
| try: | ||
|
|
@@ -73,9 +78,9 @@ async def handle_app_mentioned( | |
| ) | ||
|
|
||
| # Stream response in thread with feedback buttons | ||
| streamer = await client.chat_stream( | ||
| streamer = await agent.chat_stream( | ||
| channel=channel_id, | ||
| recipient_team_id=team_id, | ||
| recipient_team_id=team_id, # chat_stream helper cannot infer event["team"] from client | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: In Bolt Python, we should fix the helper to resolve |
||
| recipient_user_id=user_id, | ||
| thread_ts=thread_ts, | ||
| ) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| from logging import Logger | ||
|
|
||
| from slack_bolt import Ack | ||
| from slack_bolt.agent.async_agent import AsyncBoltAgent | ||
| from slack_sdk.web.async_client import AsyncWebClient | ||
|
|
||
| from agent import run_casey_agent | ||
|
|
@@ -9,7 +10,7 @@ | |
|
|
||
|
|
||
| async def handle_issue_submission( | ||
| ack: Ack, body: dict, client: AsyncWebClient, logger: Logger | ||
| ack: Ack, body: dict, client: AsyncWebClient, agent: AsyncBoltAgent, logger: Logger | ||
| ): | ||
| """Handle modal submission: open DM, post issue, and run Casey agent.""" | ||
| await ack() | ||
|
|
@@ -60,7 +61,7 @@ async def handle_issue_submission( | |
| response_text, new_session_id = await run_casey_agent(user_message) | ||
|
|
||
| # Stream the response in thread with feedback buttons | ||
| streamer = await client.chat_stream( | ||
| streamer = await agent.chat_stream( | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: When a user presses a button on the App Home and submit the modal, a DM is sent with the message. Ideally, the However, currently the response is handled inside the The good news is that we can still provide the arguments required to customize it. So that's working well! |
||
| channel=channel_id, | ||
| recipient_team_id=team_id, | ||
| recipient_user_id=user_id, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: Good news,
AsyncBoltAgentworks!