slack-smart-bot 1.14.2 → 1.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +222 -37
- data/img/chat_gpt.png +0 -0
- data/img/chat_gpt_session.png +0 -0
- data/img/chat_gpt_share.png +0 -0
- data/img/command_add_sc.png +0 -0
- data/img/command_bot_help_echo.png +0 -0
- data/img/command_loop.png +0 -0
- data/img/command_my_timeoff.png +0 -0
- data/img/command_recap.png +0 -0
- data/img/command_repl1.png +0 -0
- data/img/command_repl2.png +0 -0
- data/img/command_ruby.png +0 -0
- data/img/command_run_repl.png +0 -0
- data/img/command_see_announcements.png +0 -0
- data/img/command_see_statuses.png +0 -0
- data/img/command_see_team.png +0 -0
- data/img/command_summarize.png +0 -0
- data/img/commands_inline.png +0 -0
- data/img/commands_on_demand.png +0 -0
- data/img/commands_on_external_call.png +0 -0
- data/img/image_editing.png +0 -0
- data/img/image_generation.png +0 -0
- data/img/image_variations.png +0 -0
- data/img/openai-300.png +0 -0
- data/img/openai.png +0 -0
- data/img/slack-300.png +0 -0
- data/img/slack.png +0 -0
- data/img/smart-bot-150.png +0 -0
- data/img/smart-bot-profile-pic-2.png +0 -0
- data/img/smart-bot-profile-pic.png +0 -0
- data/img/smart-bot.png +0 -0
- data/img/whisper.png +0 -0
- data/lib/slack/smart-bot/ai/open_ai/connect.rb +165 -43
- data/lib/slack/smart-bot/ai/open_ai/models.rb +61 -9
- data/lib/slack/smart-bot/ai/open_ai/send_gpt_chat.rb +67 -11
- data/lib/slack/smart-bot/ai/open_ai/send_image_edit.rb +4 -3
- data/lib/slack/smart-bot/ai/open_ai/send_image_generation.rb +4 -4
- data/lib/slack/smart-bot/ai/open_ai/send_image_variation.rb +4 -3
- data/lib/slack/smart-bot/ai/open_ai/whisper_transcribe.rb +4 -3
- data/lib/slack/smart-bot/comm/ask.rb +20 -8
- data/lib/slack/smart-bot/comm/dont_understand.rb +2 -2
- data/lib/slack/smart-bot/comm/event_hello.rb +30 -1
- data/lib/slack/smart-bot/comm/get_channel_members.rb +2 -1
- data/lib/slack/smart-bot/comm/get_presence.rb +1 -0
- data/lib/slack/smart-bot/comm/get_smartbot_team_info.rb +10 -0
- data/lib/slack/smart-bot/comm/get_user_info.rb +45 -6
- data/lib/slack/smart-bot/comm/get_users.rb +8 -1
- data/lib/slack/smart-bot/comm/respond.rb +225 -196
- data/lib/slack/smart-bot/comm/send_msg_channel.rb +2 -2
- data/lib/slack/smart-bot/comm/send_msg_user.rb +10 -9
- data/lib/slack/smart-bot/comm/unreact.rb +2 -2
- data/lib/slack/smart-bot/comm.rb +1 -0
- data/lib/slack/smart-bot/commands/general/add_admin.rb +16 -6
- data/lib/slack/smart-bot/commands/general/add_announcement.rb +3 -3
- data/lib/slack/smart-bot/commands/general/add_vacation.rb +28 -12
- data/lib/slack/smart-bot/commands/general/ai/open_ai/open_ai_chat.rb +272 -23
- data/lib/slack/smart-bot/commands/general/ai/open_ai/open_ai_chat_add_collaborator.rb +42 -0
- data/lib/slack/smart-bot/commands/general/ai/open_ai/open_ai_chat_copy_session.rb +89 -0
- data/lib/slack/smart-bot/commands/general/ai/open_ai/open_ai_chat_delete_session.rb +45 -0
- data/lib/slack/smart-bot/commands/general/ai/open_ai/open_ai_chat_get_prompts.rb +41 -0
- data/lib/slack/smart-bot/commands/general/ai/open_ai/open_ai_chat_list_sessions.rb +81 -0
- data/lib/slack/smart-bot/commands/general/ai/open_ai/open_ai_chat_share_session.rb +52 -0
- data/lib/slack/smart-bot/commands/general/ai/open_ai/open_ai_chat_use_model.rb +52 -0
- data/lib/slack/smart-bot/commands/general/ai/open_ai/open_ai_edit_image.rb +14 -11
- data/lib/slack/smart-bot/commands/general/ai/open_ai/open_ai_generate_image.rb +15 -11
- data/lib/slack/smart-bot/commands/general/ai/open_ai/open_ai_models.rb +29 -17
- data/lib/slack/smart-bot/commands/general/ai/open_ai/open_ai_variations_image.rb +16 -13
- data/lib/slack/smart-bot/commands/general/ai/open_ai/open_ai_whisper.rb +13 -7
- data/lib/slack/smart-bot/commands/general/allow_access.rb +8 -4
- data/lib/slack/smart-bot/commands/general/bot_help.rb +24 -10
- data/lib/slack/smart-bot/commands/general/bye_bot.rb +9 -5
- data/lib/slack/smart-bot/commands/general/delete_announcement.rb +2 -1
- data/lib/slack/smart-bot/commands/general/delete_share.rb +2 -1
- data/lib/slack/smart-bot/commands/general/deny_access.rb +1 -1
- data/lib/slack/smart-bot/commands/general/get_smartbot_readme.rb +15 -0
- data/lib/slack/smart-bot/commands/general/hi_bot.rb +10 -4
- data/lib/slack/smart-bot/commands/general/personal_settings.rb +26 -8
- data/lib/slack/smart-bot/commands/general/poster.rb +26 -2
- data/lib/slack/smart-bot/commands/general/public_holidays.rb +14 -24
- data/lib/slack/smart-bot/commands/general/recap.rb +399 -0
- data/lib/slack/smart-bot/commands/general/remove_admin.rb +19 -9
- data/lib/slack/smart-bot/commands/general/remove_vacation.rb +23 -6
- data/lib/slack/smart-bot/commands/general/see_access.rb +2 -1
- data/lib/slack/smart-bot/commands/general/see_admins.rb +8 -4
- data/lib/slack/smart-bot/commands/general/see_announcements.rb +5 -5
- data/lib/slack/smart-bot/commands/general/see_favorite_commands.rb +4 -4
- data/lib/slack/smart-bot/commands/general/see_shares.rb +1 -1
- data/lib/slack/smart-bot/commands/general/see_vacations.rb +34 -17
- data/lib/slack/smart-bot/commands/general/set_public_holidays.rb +4 -2
- data/lib/slack/smart-bot/commands/general/share_messages.rb +3 -3
- data/lib/slack/smart-bot/commands/general/summarize.rb +191 -0
- data/lib/slack/smart-bot/commands/general/teams/add_team.rb +4 -8
- data/lib/slack/smart-bot/commands/general/teams/delete_team.rb +3 -3
- data/lib/slack/smart-bot/commands/general/teams/memos/add_memo_team.rb +34 -29
- data/lib/slack/smart-bot/commands/general/teams/memos/add_memo_team_comment.rb +1 -1
- data/lib/slack/smart-bot/commands/general/teams/memos/delete_memo_team.rb +6 -4
- data/lib/slack/smart-bot/commands/general/teams/memos/see_memo_team.rb +26 -15
- data/lib/slack/smart-bot/commands/general/teams/memos/see_memos_team.rb +33 -24
- data/lib/slack/smart-bot/commands/general/teams/memos/set_memo_status.rb +4 -4
- data/lib/slack/smart-bot/commands/general/teams/ping_team.rb +10 -8
- data/lib/slack/smart-bot/commands/general/teams/see_teams.rb +73 -61
- data/lib/slack/smart-bot/commands/general/teams/see_vacations_team.rb +28 -13
- data/lib/slack/smart-bot/commands/general/teams/update_team.rb +9 -9
- data/lib/slack/smart-bot/commands/general_bot_commands.rb +1152 -839
- data/lib/slack/smart-bot/commands/on_bot/add_shortcut.rb +18 -17
- data/lib/slack/smart-bot/commands/on_bot/admin/add_routine.rb +11 -9
- data/lib/slack/smart-bot/commands/on_bot/admin/remove_routine.rb +2 -0
- data/lib/slack/smart-bot/commands/on_bot/admin/run_routine.rb +1 -0
- data/lib/slack/smart-bot/commands/on_bot/admin/see_routines.rb +5 -3
- data/lib/slack/smart-bot/commands/on_bot/admin_master/delete_message.rb +2 -3
- data/lib/slack/smart-bot/commands/on_bot/admin_master/get_bot_logs.rb +2 -3
- data/lib/slack/smart-bot/commands/on_bot/admin_master/react_to.rb +2 -3
- data/lib/slack/smart-bot/commands/on_bot/admin_master/send_message.rb +7 -6
- data/lib/slack/smart-bot/commands/on_bot/admin_master/update_message.rb +2 -3
- data/lib/slack/smart-bot/commands/on_bot/delete_repl.rb +1 -1
- data/lib/slack/smart-bot/commands/on_bot/delete_shortcut.rb +21 -20
- data/lib/slack/smart-bot/commands/on_bot/general/bot_stats.rb +40 -7
- data/lib/slack/smart-bot/commands/on_bot/general/bot_status.rb +6 -2
- data/lib/slack/smart-bot/commands/on_bot/general/stop_using_rules.rb +7 -6
- data/lib/slack/smart-bot/commands/on_bot/general/suggest_command.rb +5 -4
- data/lib/slack/smart-bot/commands/on_bot/general/use_rules.rb +4 -3
- data/lib/slack/smart-bot/commands/on_bot/get_repl.rb +4 -4
- data/lib/slack/smart-bot/commands/on_bot/kill_repl.rb +1 -1
- data/lib/slack/smart-bot/commands/on_bot/repl.rb +109 -53
- data/lib/slack/smart-bot/commands/on_bot/repl_client.rb +35 -29
- data/lib/slack/smart-bot/commands/on_bot/run_repl.rb +5 -5
- data/lib/slack/smart-bot/commands/on_bot/see_repls.rb +1 -2
- data/lib/slack/smart-bot/commands/on_bot/see_shortcuts.rb +5 -4
- data/lib/slack/smart-bot/commands/on_extended/bot_rules.rb +22 -12
- data/lib/slack/smart-bot/commands/on_master/admin_master/exit_bot.rb +12 -7
- data/lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb +2 -2
- data/lib/slack/smart-bot/commands/on_master/admin_master/publish_announcements.rb +1 -1
- data/lib/slack/smart-bot/commands/on_master/admin_master/set_general_message.rb +5 -5
- data/lib/slack/smart-bot/commands/on_master/admin_master/set_maintenance.rb +5 -5
- data/lib/slack/smart-bot/commands/on_master/create_bot.rb +3 -3
- data/lib/slack/smart-bot/commands.rb +10 -0
- data/lib/slack/smart-bot/config.rb +126 -0
- data/lib/slack/smart-bot/listen.rb +12 -11
- data/lib/slack/smart-bot/process.rb +62 -55
- data/lib/slack/smart-bot/process_first.rb +106 -65
- data/lib/slack/smart-bot/treat_message.rb +79 -47
- data/lib/slack/smart-bot/utils/answer.rb +11 -3
- data/lib/slack/smart-bot/utils/answer_delete.rb +11 -3
- data/lib/slack/smart-bot/utils/check_vacations.rb +21 -3
- data/lib/slack/smart-bot/utils/create_routine_thread.rb +13 -13
- data/lib/slack/smart-bot/utils/display_calendar.rb +42 -8
- data/lib/slack/smart-bot/utils/encryption/decrypt.rb +16 -9
- data/lib/slack/smart-bot/utils/encryption/encrypt.rb +14 -11
- data/lib/slack/smart-bot/utils/find_user.rb +71 -0
- data/lib/slack/smart-bot/utils/get_access_channels.rb +22 -3
- data/lib/slack/smart-bot/utils/get_channels_name_and_id.rb +3 -4
- data/lib/slack/smart-bot/utils/get_command_ids.rb +5 -5
- data/lib/slack/smart-bot/utils/get_countries_candelarific.rb +18 -0
- data/lib/slack/smart-bot/utils/get_help.rb +21 -19
- data/lib/slack/smart-bot/utils/get_openai_sessions.rb +47 -0
- data/lib/slack/smart-bot/utils/get_personal_settings.rb +29 -3
- data/lib/slack/smart-bot/utils/get_rules_imported.rb +27 -6
- data/lib/slack/smart-bot/utils/get_shares.rb +1 -1
- data/lib/slack/smart-bot/utils/get_team_members.rb +4 -4
- data/lib/slack/smart-bot/utils/get_vacations.rb +15 -7
- data/lib/slack/smart-bot/utils/has_access.rb +10 -4
- data/lib/slack/smart-bot/utils/is_admin.rb +25 -17
- data/lib/slack/smart-bot/utils/local_time.rb +29 -0
- data/lib/slack/smart-bot/utils/save_stats.rb +5 -3
- data/lib/slack/smart-bot/utils/update_access_channels.rb +19 -3
- data/lib/slack/smart-bot/utils/update_openai_sessions.rb +42 -0
- data/lib/slack/smart-bot/utils/update_personal_settings.rb +11 -3
- data/lib/slack/smart-bot/utils/update_rules_imported.rb +18 -3
- data/lib/slack/smart-bot/utils/update_vacations.rb +5 -2
- data/lib/slack/smart-bot/utils/upgrade_to_use_team_ids.rb +276 -0
- data/lib/slack/smart-bot/utils.rb +6 -1
- data/lib/slack-smart-bot.rb +182 -76
- data/lib/slack-smart-bot_general_commands.rb +10 -9
- data/whats_new.txt +30 -13
- metadata +148 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c3c10ede28d806c5c386904621b877fdc1077f84f758b5affde34b3160340bf
|
4
|
+
data.tar.gz: 4db939606739e903c5d2916ea4d12409457eb3a62a8a740a0dec42f022f6bb70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d204840c2f03710234fcc7f959b85256065cc312784cd5bb0f3e40aced01301a0a695c35e66161091d0b88e11d2e57283e47782752543240fff1ed00cda7ad0d
|
7
|
+
data.tar.gz: f06acd8003f313d2711710778e4a7119434d349107c4930e68800ef61620b367635ec047191061830711ee4c6eefbd5ade67eb06f320cdea2f249338cad22eb5
|
data/README.md
CHANGED
@@ -8,17 +8,18 @@
|
|
8
8
|
![GitHub last commit](https://img.shields.io/github/last-commit/MarioRuiz/slack-smart-bot)
|
9
9
|
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/MarioRuiz/slack-smart-bot)
|
10
10
|
|
11
|
-
Create a Slack bot that is
|
11
|
+
Create a highly smart Slack bot that is incredibly easy to customize and expand.
|
12
12
|
|
13
|
-
The
|
13
|
+
The primary purpose of this Ruby gem is to be used internally within your company, allowing teams to create dedicated channels with their own bot to assist them with their daily tasks. Almost any task can be automated with ease!
|
14
14
|
|
15
|
-
slack-smart-bot
|
15
|
+
slack-smart-bot has the ability to create bots on demand, set up shortcuts, execute Ruby code, utilize ChatGPT, DALL-E, Whisper, and more. All of this can be done directly within a chat channel, even from your mobile phone. Whether you need to run forgotten tests, retrieve results, restart a server, summarize a channel or just a thread, or engage in a ChatGPT session, the possibilities are limitless.
|
16
16
|
|
17
|
-
<img src="
|
17
|
+
<img src="img/smart-bot-150.png"><img src="img/slack-300.png"><img src="img/openai-300.png">
|
18
18
|
|
19
19
|
# Table of Contents
|
20
|
+
(A): Only for Admins
|
20
21
|
|
21
|
-
- [Installation and configuration](#installation-and-configuration)
|
22
|
+
- [Installation and configuration](#installation-and-configuration) (A)
|
22
23
|
- [Usage](#usage)
|
23
24
|
* [creating the MASTER BOT](#creating-the-master-bot) (A)
|
24
25
|
* [How to access the Smart Bot](#how-to-access-the-smart-bot)
|
@@ -41,22 +42,24 @@ slack-smart-bot can create bots on demand, create shortcuts, run ruby code... ju
|
|
41
42
|
* [Teams](#teams)
|
42
43
|
* [Time off management](#time-off-management)
|
43
44
|
* [OpenAI](#openai)
|
44
|
-
+ [OpenAI Set up](#openai-setup)
|
45
|
+
+ [OpenAI Set up](#openai-setup) (A)
|
45
46
|
+ [Chat GPT](#chatgpt)
|
46
47
|
+ [Image Generation](#image-generation)
|
47
48
|
+ [Image Variations](#image-variations)
|
48
49
|
+ [Image Editing](#image-editing)
|
49
50
|
+ [Whisper](#whisper)
|
50
51
|
+ [Models](#models)
|
52
|
+
* [Recap](#recap)
|
53
|
+
* [Summarize](#summarize)
|
54
|
+
* [Personal Settings](#personal-settings)
|
51
55
|
* [Tips](#tips)
|
52
56
|
+ [Send a file](#send-a-file) (A)
|
53
57
|
+ [Download a file](#download-a-file) (A)
|
54
58
|
- [Contributing](#contributing)
|
55
59
|
- [License](#license)
|
56
60
|
|
57
|
-
(A): Only for Admins
|
58
|
-
|
59
61
|
## Installation and configuration
|
62
|
+
> for admins
|
60
63
|
|
61
64
|
$ gem install slack-smart-bot
|
62
65
|
|
@@ -72,7 +75,9 @@ settings = {
|
|
72
75
|
# the channel that will act like the master channel, main channel
|
73
76
|
master_channel: 'my_master_channel',
|
74
77
|
masters: ["mario"], #names of the master users
|
75
|
-
token: 'xxxxxxxxxxxxxxxxxx' # the API Slack token
|
78
|
+
token: 'xxxxxxxxxxxxxxxxxx', # the API Slack token
|
79
|
+
user_token: 'yyyyyyyyyy', # The API Slack User token
|
80
|
+
granular_token: 'zzzzzzzz' # The API Granular Slack Token
|
76
81
|
}
|
77
82
|
|
78
83
|
puts "Connecting #{settings.inspect}"
|
@@ -84,28 +89,87 @@ The master_channel will be the channel where you will be able to create other bo
|
|
84
89
|
|
85
90
|
The masters will have full access to everything. You need to use the slack user name defined on https://YOUR_WORK_SPACE.slack.com/account/settings#username.
|
86
91
|
|
87
|
-
|
92
|
+
Create the SmartBot *[Slack App. Bot Token](https://api.slack.com/slack-apps)* :
|
93
|
+
|
94
|
+
1) [Create a Classic Slack App](https://api.slack.com/apps?new_classic_app=1) This will be our *@smart-bot App* we will interact with. This App will use RTM to connect to Slack.
|
88
95
|
|
89
|
-
|
96
|
+
1) Add a bot user to your app. On Add features and functionality section for your app, select *Bots*. Click on *Add a Legacy Bot User*
|
90
97
|
|
91
|
-
|
98
|
+
1) On your app click on the menu on the left: *OAuth & Permissions*. Add the 'users.profile:write' scope. This is necessary for the SmartBot to be able to change the slack status of other users.
|
99
|
+
|
100
|
+
1) Now you will need to ask a workspace admin to click on *Install App to Workspace*.
|
92
101
|
|
93
|
-
1)
|
102
|
+
1) Copy your *Bot User OAuth Access Token* and add it to the SmartBot settings with key :token
|
94
103
|
|
95
|
-
1)
|
104
|
+
1) Ask a workspace admin to provide the *User OAuth Token* and add it to the SmartBot settings with key :user_token
|
96
105
|
|
97
|
-
|
106
|
+
Now we will create the GranularSmartBot Slack App to get access to certain end points as a regular Slack App:
|
98
107
|
|
99
|
-
1)
|
108
|
+
1) [Create a Granular Slack App](https://api.slack.com/apps?new_app=1) This will be our @granular-smart-bot App. It will be used internally on the SmartBot. It is a regular Slack App with scopes.
|
100
109
|
|
110
|
+
1) On your app click on the menu on the left: *OAuth & Permissions* and add on Bot Token Scopes the necessary Scopes: app_mentions:read, channels:history, channels:read, chat:write, chat:write.customize, emoji:read, files:read, groups:history, groups:read, im:history, im:read, im:write, incoming-webhook, mpim:history, mpim:read, mpim:write, reactions:read, reactions:write, team:read, users.profile:read, users:read, users:read.email
|
111
|
+
|
112
|
+
1) Click on *Install App to Workspace*.
|
101
113
|
|
102
|
-
|
114
|
+
1) Copy the *Bot User OAuth Token* and add it to the SmartBot settings with the key :granular_token
|
103
115
|
|
116
|
+
Both Apps need to be on the channels we want to use the SmartBot.
|
104
117
|
|
105
|
-
*Remember to invite the smart bot to the channels where they will be accessible before
|
118
|
+
*Remember to invite the smart bot to the channels where they will be accessible before starting the bot*
|
106
119
|
|
107
120
|
SmartBot will notify about SmartBot status changes or any SmartBot incident if defined the status_channel in settings file and the channel exists. By default: smartbot-status
|
108
121
|
|
122
|
+
|
123
|
+
This is an example of typical settings to be supplied for the *Slack Smart Bot* instance:
|
124
|
+
```ruby
|
125
|
+
settings = {
|
126
|
+
token: ENV["SLACK_BOT_TOKEN"],
|
127
|
+
user_token: ENV['SLACK_USER_TOKEN'],
|
128
|
+
granular_token: ENV['SLACK_GRANULAR_BOT_TOKEN'],
|
129
|
+
masters: ["mario", "peterv", "lisawhite"], #master admin users
|
130
|
+
master_channel: "smartbot_master",
|
131
|
+
silent: true,
|
132
|
+
stats: true,
|
133
|
+
encrypt: true,
|
134
|
+
encryption: { # if not encryption key supplied then it will be generated one using the host name and the Slack token
|
135
|
+
key: ENV['ENCRYPTION_KEY'],
|
136
|
+
iv: ENV['ENCRYPTION_IV']
|
137
|
+
},
|
138
|
+
github: {
|
139
|
+
token: ENV['GITHUB_TOKEN']
|
140
|
+
},
|
141
|
+
jira: {
|
142
|
+
host: ENV['JIRA_HOST'],
|
143
|
+
user: ENV['JIRA_USER'],
|
144
|
+
password: ENV['JIRA_PASSWORD']
|
145
|
+
},
|
146
|
+
public_holidays: {
|
147
|
+
api_key: ENV['CALENDARIFIC_API_KEY'],
|
148
|
+
default_calendar: 'spain/madrid'
|
149
|
+
},
|
150
|
+
ai: {
|
151
|
+
open_ai: {
|
152
|
+
access_token: ENV["OPENAI_ACCESS_TOKEN"],
|
153
|
+
chat_gpt: {
|
154
|
+
model: 'gpt-3.5-turbo-0613', # to be used by default for the user calling chatgpt command
|
155
|
+
smartbot_model: 'gpt-4-32k-0613' # to be used by default by the SmartBot internally
|
156
|
+
}
|
157
|
+
}
|
158
|
+
}
|
159
|
+
}
|
160
|
+
|
161
|
+
```
|
162
|
+
|
163
|
+
You can see all the accepted settings on: [/lib/slack/smart-bot/config.rb](/lib/slack/smart-bot/config.rb)
|
164
|
+
|
165
|
+
To use the other integrated services:
|
166
|
+
* OpenAI: https://platform.openai.com/account/api-keys
|
167
|
+
* Calendarific: https://www.calendarific.com
|
168
|
+
* GitHub: https://github.com/settings/tokens
|
169
|
+
* Jira: https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/
|
170
|
+
|
171
|
+
|
172
|
+
|
109
173
|
## Usage
|
110
174
|
|
111
175
|
### creating the MASTER BOT
|
@@ -243,7 +307,7 @@ Examples:
|
|
243
307
|
<img src="img/commands_on_external_call.png" width="400">
|
244
308
|
|
245
309
|
Examples on DM:
|
246
|
-
>**_Peter>_** `#sales show report from India`
|
310
|
+
>**_Peter>_** `#sales show report from India`
|
247
311
|
>**_Peter>_** `on #sales notify clients`
|
248
312
|
|
249
313
|
If you want the Smart Bot just listen to part of the message you send, add the commands you want using '`' and start the line with '-!', '-!!' or '-^'
|
@@ -292,7 +356,7 @@ For the examples use _ and for the rules `. This is a good example of a Help sup
|
|
292
356
|
# help: _execute smoke tests on db1_
|
293
357
|
```
|
294
358
|
|
295
|
-
To see what's new just call `What's new`
|
359
|
+
To see what's new just call `What's new`. And to get the SmartBot README call `get smartbot readme`.
|
296
360
|
|
297
361
|
### Bot Management
|
298
362
|
> for admins
|
@@ -358,6 +422,7 @@ Also it is possible to attach a Ruby file and the Smart Bot will run and post th
|
|
358
422
|
#### REPL
|
359
423
|
> for all users
|
360
424
|
|
425
|
+
For a quick introduction play this video:
|
361
426
|
[![SmartBot REPLs](https://img.youtube.com/vi/URMI3BdD7J8/0.jpg)](https://www.youtube.com/watch?v=URMI3BdD7J8)
|
362
427
|
|
363
428
|
Easily starts a REPL session so you will be able to create a script directly from the slack conversation. You will be able to share the REPL so they can run it or see the content.
|
@@ -379,6 +444,8 @@ To pre-execute some ruby when starting the session add the code to `.smart-bot-r
|
|
379
444
|
|
380
445
|
If you want to see the methods of a class or module you created use `ls TheModuleOrClass`. To see all documentation of a method: `doc TheModuleOrClass.method_name`. And to see the source code of a method: `code TheModuleOrClass.method_name`. Examples: `ls Sales`, `doc Sales.list`, `code Sales.list`
|
381
446
|
|
447
|
+
During the REPL session you can ask *ChatGPT* about the code or any other question. Just start the message with `?` and the Smart Bot will ask ChatGPT and will post the answer. Example: `? How to create a new customer?`. If you send just the question mark without a prompt then ChatGPT will suggest next code line. Example: `?`
|
448
|
+
|
382
449
|
You can supply the Environmental Variables you need for the Session
|
383
450
|
|
384
451
|
Examples:
|
@@ -576,7 +643,7 @@ If you want to change who has access to a specific command without restarting th
|
|
576
643
|
# helpadmin:
|
577
644
|
when /\A\s*update\s+access\s*\z/i
|
578
645
|
save_stats(:update_access)
|
579
|
-
if is_admin?(
|
646
|
+
if is_admin?()
|
580
647
|
config.allow_access.repl = ['marioruiz', 'samcooke']
|
581
648
|
respond "updated on <##{@channel_id}>!"
|
582
649
|
else
|
@@ -591,7 +658,7 @@ if has_access?(:your_command_id)
|
|
591
658
|
end
|
592
659
|
```
|
593
660
|
|
594
|
-
Also you can allow or deny access for specific commands and users on any specific channel all you need is the Smartbot to be a member of the channel and use these commands on Slack:
|
661
|
+
Also you can allow or deny access for specific commands and users on any specific channel all you need is the Smartbot to be a member of the channel and use these commands on Slack:
|
595
662
|
`allow access COMMAND_ID`
|
596
663
|
`allow access COMMAND_ID @user1 @user99`
|
597
664
|
It will allow the specified command to be used on the channel.
|
@@ -619,8 +686,9 @@ Examples:
|
|
619
686
|
>**_`most used commands`_**
|
620
687
|
|
621
688
|
### Teams
|
622
|
-
> for all users
|
689
|
+
> for all users
|
623
690
|
|
691
|
+
For a quick introduction play this video:
|
624
692
|
[![SmartBot Teams](https://img.youtube.com/vi/u8B4aGDXH9M/0.jpg)](https://www.youtube.com/watch?v=u8B4aGDXH9M)
|
625
693
|
|
626
694
|
You can add, update, see, ping and delete teams. When calling `see TEAM_NAME team` the availability of the members will be displayed.
|
@@ -695,11 +763,10 @@ The vacation plan will be displayed also with the team when calling `see team NA
|
|
695
763
|
|
696
764
|
Also, you can see the vacation plan for the team for a specific period: `vacations team NAME YYYY/MM/DD`
|
697
765
|
|
698
|
-
To be able to use this command you need to allow the 'users.profile:write' scope on your Slack App and an admin user of the workspace needs to install the app. Set the user token on the SmartBot settings:
|
766
|
+
To be able to use this command you need to allow the 'users.profile:write' scope on your Slack App and an admin user of the workspace needs to install the app. Set the user token provided by the workspace on the SmartBot settings:
|
699
767
|
|
700
768
|
```ruby
|
701
769
|
settings = {
|
702
|
-
token: ENV["SLACK_BOT_TOKEN"],
|
703
770
|
user_token: ENV['SLACK_USER_TOKEN']
|
704
771
|
}
|
705
772
|
```
|
@@ -710,7 +777,7 @@ Add to your Smartbot configuration:
|
|
710
777
|
```ruby
|
711
778
|
settings = {
|
712
779
|
public_holidays: {
|
713
|
-
api_key:
|
780
|
+
api_key: ENV['CALENDARIFIC_API_KEY']
|
714
781
|
}
|
715
782
|
}
|
716
783
|
```
|
@@ -723,30 +790,57 @@ Other 'time off' commands: **_`remove time off ID`_**, **_`see my time off`_**,
|
|
723
790
|
|
724
791
|
|
725
792
|
### OpenAI
|
726
|
-
|
793
|
+
|
727
794
|
#### OpenAI setup
|
728
|
-
|
795
|
+
> for admins
|
796
|
+
|
797
|
+
To be able to use this SmartBot general command you need to ask for an API token: https://platform.openai.com/account/api-keys or supply a Host and api_key for Azure OpenAI.
|
729
798
|
|
730
799
|
Then specify in the SmartBot config the keys:
|
731
800
|
|
732
801
|
```ruby
|
733
802
|
ai: {
|
803
|
+
# for all open_ai services
|
734
804
|
open_ai: {
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
805
|
+
#default host and token for all openAI services
|
806
|
+
host: 'HOST', # optional
|
807
|
+
access_token: 'OPENAI_ACCESS_TOKEN',
|
808
|
+
# Optional. For chatGPT. If supplied it will be used instead of the ones defined for all open_ai services
|
809
|
+
chat_gpt: {
|
810
|
+
host: 'HOST',
|
811
|
+
access_token: 'OPENAI_ACCESS_TOKEN', #or OPENAI_API_KEY from Azure
|
812
|
+
api_type: :openai_azure, #Default type will be :openai (possible values are :openai, :openai_azure)
|
813
|
+
#If supplied :openai_azure then it is necessary to supply host
|
814
|
+
api_version: '2023-03-15-preview', # Default api version for :openai_azure
|
815
|
+
model: 'gpt-3.5-turbo',
|
816
|
+
smartbot_model: 'gpt-3.5-turbo'
|
817
|
+
},
|
818
|
+
# Optional. For DALL-E. If supplied it will be used instead of the ones defined for all open_ai services
|
819
|
+
dall_e: {
|
820
|
+
host: 'HOST',
|
821
|
+
access_token: 'OPENAI_ACCESS_TOKEN',
|
822
|
+
image_size: '256x256',
|
823
|
+
},
|
824
|
+
# Optional. For Whisper. If supplied it will be used instead of the ones defined for all open_ai services
|
825
|
+
whisper: {
|
826
|
+
host: 'HOST',
|
827
|
+
access_token: 'OPENAI_ACCESS_TOKEN',
|
828
|
+
model: 'whisper-1',
|
829
|
+
}
|
740
830
|
}
|
741
831
|
}
|
742
832
|
```
|
743
833
|
|
744
834
|
Or if you want you can set your personal access token just to be used by you by calling on a DM with the SmartBot the command: `set personal settings ai.open_ai.access_token ACCESS_TOKEN`
|
745
|
-
Also you can specify personal settings for `
|
835
|
+
Also, you can specify personal settings for `host`, `ai.open_ai.chat_gpt.model`, `ai.open_ai.chat_gpt.smartbot_model`, `ai.open_ai.whisper.model` or `ai.open_ai.dall_e.image_size`, instead of using the default values.
|
836
|
+
For using different hosts or tokens for each service you can use the `chat_gpt`, `dall_e` or `whisper` keys.
|
746
837
|
|
747
838
|
#### ChatGPT
|
839
|
+
> for all users
|
840
|
+
|
841
|
+
For a quick introduction play this video:
|
842
|
+
[![SmartBot ChatGPT](https://img.youtube.com/vi/zri_R6sLtBA/0.jpg)](https://www.youtube.com/watch?v=zri_R6sLtBA)
|
748
843
|
|
749
|
-
`??`
|
750
844
|
`?? PROMPT`
|
751
845
|
`? PROMPT`
|
752
846
|
Chat GPT will generate a response based on the PROMPT indicated.
|
@@ -755,9 +849,37 @@ You can share a message and use it as input for the supplied prompt.
|
|
755
849
|
|
756
850
|
<img src="img/chat_gpt.png" width="650">
|
757
851
|
|
758
|
-
<img src="img/chat_gpt_share.png" width="
|
852
|
+
<img src="img/chat_gpt_share.png" width="600">
|
853
|
+
|
854
|
+
|
855
|
+
When using ?? a temporary chatGPT session will be created. If you want to start a session with a given name use `chatGPT SESSION_NAME`. You can add also the description of the session by using `chatGPT SESSION_NAME "DESCRIPTION"`.
|
856
|
+
If you want to categorize your sessions you can use `chatGPT SESSION_NAME >TAG_NAME`.
|
857
|
+
You can supply also a specific GPT model to be used. `chatGPT SESSION_NAME MODEL_NAME`.
|
858
|
+
To get all prompts from a specific session name use `chatGPT get SESSION_NAME`.
|
859
|
+
To list all sessions you created use `chatGPT sessions`.
|
860
|
+
When starting a new session, if you ask SmartBot to answer on a Thread by using !! or ^, then it won't be necessary to send ? before the prompt. In this case, every single message you send will be considered a prompt to be treated. After 30 minutes of inactivity, SmartBot will stop listening to the thread. You will need to continue the session after that. If you want to avoid a message to be treated then start it with a hyphen '-'.
|
861
|
+
To add a collaborator when on a thread, you can use directly `add collaborator @USER`
|
862
|
+
If you include in the prompt `!URL` then it will download and use the content of the URL as input for the prompt.
|
863
|
+
When on a thread you can change the model to be used by sending `use model MODEL_NAME`. For a temporary session if you want to create the session with a specific model use `?? use model MODEL_NAME`. The model supplied can be a substring of the model name, SmartBot will try to find the model that matches the substring.
|
864
|
+
|
865
|
+
<img src="img/chat_gpt_session.png" width="650">
|
866
|
+
|
867
|
+
You can copy your session by using `chatGPT copy SESSION_NAME NEW_SESSION_NAME`.
|
868
|
+
To share your session with everyone use `chatGPT share SESSION_NAME`. Then the session will be available for everyone to use. If you prefer to share it with a specific channel use `chatGPT share SESSION_NAME #CHANNEL`. In that case, only the users on that channel will be able to use the session.
|
869
|
+
To list all public sessions call `chatGPT public sessions`. To list all shared sessions in a channel, from that channel call `chatGPT shared sessions`. You can also filter the sessions by tag, for example, `chatGPT public sessions >TAG_NAME`.
|
870
|
+
If you want to use any public or shared session, you can use `chatGPT use USER_NAME SESSION_NAME` or `chatGPT use USER_NAME SESSION_NAME NEW_SESSION_NAME`.
|
871
|
+
To remove any shared session from the list, call `chatGPT stop sharing SESSION_NAME` or `chatGPT stop sharing SESSION_NAME #CHANNEL`.
|
872
|
+
|
873
|
+
Play this video:
|
874
|
+
[![SmartBot ChatGPT Share Sessions](https://img.youtube.com/vi/Mnve3tnEd-8/0.jpg)](https://www.youtube.com/watch?v=Mnve3tnEd-8)
|
875
|
+
|
876
|
+
You can also use ChatGPT when creating REPLs. During the REPL session you can ask *ChatGPT* about the code or any other question. Just start the message with `?` and the Smart Bot will ask ChatGPT and will post the answer. Example: `? How to create a new customer?`. If you send just the question mark without a prompt then ChatGPT will suggest next code line. Example: `?`
|
877
|
+
To send the results of a *SmartBot command* as input for a *ChatGPT* session, use `COMMAND ?? PROMPT`. Example: `bot help ?? how can I use the time off commands`. If you are on a thread you can send more SmartBot commands to the same session by using `COMMAND ?? PROMPT`.
|
878
|
+
|
759
879
|
|
760
880
|
#### Image Generation
|
881
|
+
> for all users
|
882
|
+
|
761
883
|
`??i PROMPT`
|
762
884
|
`?i PROMPT`
|
763
885
|
`?ir`
|
@@ -768,6 +890,7 @@ if using `?ir` will generate a new image using the session prompts.
|
|
768
890
|
<img src="img/image_generation.png" width="400">
|
769
891
|
|
770
892
|
#### Image Variations
|
893
|
+
> for all users
|
771
894
|
|
772
895
|
`?iv`
|
773
896
|
`?ivNUMBER`
|
@@ -778,6 +901,7 @@ If an image is attached then it will generate temporary variations of the attach
|
|
778
901
|
<img src="img/image_variations.png" width="400">
|
779
902
|
|
780
903
|
#### Image Editing
|
904
|
+
> for all users
|
781
905
|
|
782
906
|
`?ie PROMPT`
|
783
907
|
It will edit the attached image with the supplied PROMPT. The supplied image needs to be an image with a transparent area.
|
@@ -786,6 +910,7 @@ The PROMPT need to explain the final result of the image.
|
|
786
910
|
<img src="img/image_editing.png" width="400">
|
787
911
|
|
788
912
|
#### Whisper
|
913
|
+
> for all users
|
789
914
|
|
790
915
|
`?w PROMPT`
|
791
916
|
`?w`
|
@@ -794,11 +919,71 @@ It will transcribe the audio file attached and perform the PROMPT indicated if s
|
|
794
919
|
<img src="img/whisper.png" width="650">
|
795
920
|
|
796
921
|
#### Models
|
922
|
+
> for all users
|
797
923
|
|
798
924
|
`?m`
|
799
925
|
`?m MODEL`
|
926
|
+
`chatgpt models`
|
800
927
|
It will return the list of models available or the details of the model indicated.
|
801
928
|
|
929
|
+
### Recap
|
930
|
+
> for all users
|
931
|
+
|
932
|
+
`recap`
|
933
|
+
`my recap`
|
934
|
+
`recap from YYYY/MM/DD`
|
935
|
+
`recap from YYYY/MM/DD to YYYY/MM/DD`
|
936
|
+
`recap YYYY`
|
937
|
+
`recap #CHANNEL`
|
938
|
+
`my recap #CHANNEL`
|
939
|
+
`recap from YYYY/MM/DD #CHANNEL`
|
940
|
+
`recap from YYYY/MM/DD to YYYY/MM/DD #CHANNEL`
|
941
|
+
`recap YYYY #CHANNEL`
|
942
|
+
It will show a recap of the channel. If channel not supplied, it will show the recap of the current channel.
|
943
|
+
If 'my' is added, it will show also a recap of your messages.
|
944
|
+
If only one date is added, it will show the recap from that day to 31st of December of that year.
|
945
|
+
If only one year is added, it will show the recap from 1st of January to 31st of December of that year.
|
946
|
+
Examples:
|
947
|
+
>**_`recap`_**
|
948
|
+
>**_`my recap`_**
|
949
|
+
>**_`recap 2023`_**
|
950
|
+
>**_`recap from 2023/07/01 to 2023/12/31 #sales`_**
|
951
|
+
>**_`recap 2022 #sales`_**
|
952
|
+
|
953
|
+
<img src="img/command_recap.png" width="250">
|
954
|
+
|
955
|
+
### Summarize
|
956
|
+
> for all users
|
957
|
+
|
958
|
+
`summarize`
|
959
|
+
`summarize since YYYY/MM/DD`
|
960
|
+
`summarize #CHANNEL`
|
961
|
+
`summarize #CHANNEL since YYYY/MM/DD`
|
962
|
+
`summarize URL_THREAD`
|
963
|
+
It will summarize using ChatGPT the messages in the channel since the date specified.
|
964
|
+
If no date is specified it will summarize the last 30 days.
|
965
|
+
If time off added using Time Off command it will summarize since your last time off started.
|
966
|
+
If no channel is specified it will summarize the current channel.
|
967
|
+
If a thread URL is specified it will summarize the thread.
|
968
|
+
If the command is used in a thread it will summarize the thread.
|
969
|
+
Examples:
|
970
|
+
>**_`summarize`_**
|
971
|
+
>**_`summarize since 2024/01/22`_**
|
972
|
+
>**_`summarize #sales`_**
|
973
|
+
>**_`summarize #sales since 2024/01/22`_**
|
974
|
+
>**_`summarize https://yourcompany.slack.com/archives/C111JG4V4DZ/p1622549264010700`_**
|
975
|
+
|
976
|
+
<img src="img/command_summarize.png" width="500">
|
977
|
+
|
978
|
+
### Personal Settings
|
979
|
+
On a DM with SmartBot you can call `set personal settings` command and supply your specific personal settings just for you. Then the command using those settings will be specific for you with the value indicated here.
|
980
|
+
Examples:
|
981
|
+
>**_`set personal settings ai.open_ai.access_token Axdd3SSccffddZZZDFFDxf7`_**
|
982
|
+
>**_`set personal settings ai.open_ai_chat_gpt.model gpt-4-turbo-preview`_**
|
983
|
+
>**_`set personal settings authorizations.confluence.host confluence.love.example.com`_**
|
984
|
+
>**_`set personal settings authorizations.confluence.authorization Bearer XDfjjdkAAAjjjdkkslsladjjjd`_**
|
985
|
+
|
986
|
+
Other commands: `delete personal settings SETTINGS_ID`, `get personal settings`, `get personal settings SETTINGS_ID`
|
802
987
|
|
803
988
|
### Tips
|
804
989
|
> for admins
|
@@ -818,7 +1003,7 @@ When uploading a file the message added to 'Add a message about the file' will b
|
|
818
1003
|
```ruby
|
819
1004
|
when /^do something with my file/i
|
820
1005
|
if !files.nil? and files.size == 1 and files[0].filetype == 'yaml'
|
821
|
-
require
|
1006
|
+
require "nice_http"
|
822
1007
|
http = NiceHttp.new(host: "https://files.slack.com", headers: { "Authorization" => "Bearer #{config.token}" })
|
823
1008
|
res = http.get(files[0].url_private_download, save_data: './tmp/')
|
824
1009
|
# if you want to directly access to the content use: `res.data`
|
data/img/chat_gpt.png
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/img/openai-300.png
ADDED
Binary file
|
data/img/openai.png
ADDED
Binary file
|
data/img/slack-300.png
ADDED
Binary file
|
data/img/slack.png
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/img/smart-bot.png
ADDED
Binary file
|
data/img/whisper.png
ADDED
Binary file
|