chore: Slack enhance support file_path (#337)

This commit is contained in:
Wendong-Fan 2025-09-16 16:04:23 +08:00 committed by GitHub
commit fd4c9002d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -51,13 +51,10 @@ class SlackToolkit(BaseSlackToolkit, AbstractToolkit):
@listen_toolkit(
BaseSlackToolkit.send_slack_message,
lambda _,
message,
channel_id,
user=None: f"send Slack message: {message} to channel id: {channel_id} for user: {user}",
lambda _, message, channel_id, file_path=None, user=None: f"send Slack message: {message} to channel id: {channel_id}, file: {file_path}, user: {user}",
)
def send_slack_message(self, message: str, channel_id: str, user: str | None = None) -> str:
return super().send_slack_message(message, channel_id, user)
def send_slack_message(self, message: str, channel_id: str, file_path: str | None = None, user: str | None = None) -> str:
return super().send_slack_message(message, channel_id, file_path, user)
@listen_toolkit(
BaseSlackToolkit.delete_slack_message,
@ -68,6 +65,20 @@ class SlackToolkit(BaseSlackToolkit, AbstractToolkit):
def delete_slack_message(self, time_stamp: str, channel_id: str) -> str:
return super().delete_slack_message(time_stamp, channel_id)
@listen_toolkit(
BaseSlackToolkit.get_slack_user_list,
lambda _: "get Slack user list",
)
def get_slack_user_list(self) -> str:
return super().get_slack_user_list()
@listen_toolkit(
BaseSlackToolkit.get_slack_user_info,
lambda _, user_id: f"get Slack user info with user id: {user_id}",
)
def get_slack_user_info(self, user_id: str) -> str:
return super().get_slack_user_info(user_id)
@classmethod
def get_can_use_tools(cls, api_task_id: str) -> list[FunctionTool]:
logger.debug(f"slack===={env('SLACK_BOT_TOKEN')}")