bot_platform 0.1.0 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.idea/.gitignore +8 -0
- data/.idea/bot_platform.iml +317 -0
- data/.idea/misc.xml +4 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vcs.xml +6 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +25 -0
- data/Gemfile.lock +1 -1
- data/LICENSE +21 -0
- data/README.md +21 -9
- data/bin/cli +34 -0
- data/bot_platform.gemspec +3 -2
- data/docs/channels.md +13 -0
- data/lib/bot_platform/activity.rb +32 -0
- data/lib/bot_platform/adapter.rb +87 -0
- data/lib/bot_platform/asserts.rb +69 -0
- data/lib/bot_platform/boot.rb +12 -0
- data/lib/bot_platform/channels/base.rb +26 -0
- data/lib/bot_platform/channels/chatwork.rb +1 -0
- data/lib/bot_platform/channels/console.rb +60 -0
- data/lib/bot_platform/channels/facebook.rb +1 -0
- data/lib/bot_platform/channels/line.rb +1 -0
- data/lib/bot_platform/channels/lineworks.rb +102 -0
- data/lib/bot_platform/channels/skype.rb +1 -0
- data/lib/bot_platform/channels/skype_for_business.rb +1 -0
- data/lib/bot_platform/channels/slack.rb +15 -0
- data/lib/bot_platform/channels/teams.rb +15 -0
- data/lib/bot_platform/channels/web.rb +15 -0
- data/lib/bot_platform/channels/wechat.rb +1 -0
- data/lib/bot_platform/channels.rb +9 -0
- data/lib/bot_platform/cli.rb +97 -0
- data/lib/bot_platform/conversation_state.rb +32 -0
- data/lib/bot_platform/dialogs/dialog.rb +48 -0
- data/lib/bot_platform/dialogs/dialog_context.rb +104 -0
- data/lib/bot_platform/dialogs/dialog_instance.rb +15 -0
- data/lib/bot_platform/dialogs/dialog_result.rb +22 -0
- data/lib/bot_platform/dialogs/dialog_set.rb +38 -0
- data/lib/bot_platform/dialogs/dialog_state.rb +11 -0
- data/lib/bot_platform/dialogs/prompts/prompt.rb +84 -0
- data/lib/bot_platform/dialogs/prompts/prompt_options.rb +12 -0
- data/lib/bot_platform/dialogs/prompts/prompt_recognizer_result.rb +16 -0
- data/lib/bot_platform/dialogs/prompts/text_prompt.rb +36 -0
- data/lib/bot_platform/dialogs.rb +17 -0
- data/lib/bot_platform/message_factory.rb +9 -0
- data/lib/bot_platform/state/bot_state.rb +21 -0
- data/lib/bot_platform/state/conversation_state.rb +17 -0
- data/lib/bot_platform/state/user_state.rb +1 -0
- data/lib/bot_platform/storage/memory_storage.rb +51 -0
- data/lib/bot_platform/storage/mysql_storage.rb +1 -0
- data/lib/bot_platform/storage/redis_storage.rb +1 -0
- data/lib/bot_platform/storage/storageable.rb +33 -0
- data/lib/bot_platform/turn_context.rb +105 -0
- data/lib/bot_platform/version.rb +1 -1
- data/lib/bot_platform.rb +11 -0
- data/samples/dialogs/dialog_simple.rb +29 -0
- data/samples/echo.rb +5 -0
- metadata +56 -5
@@ -0,0 +1,29 @@
|
|
1
|
+
class DialogSimple
|
2
|
+
attr_accessor :dialogs
|
3
|
+
|
4
|
+
def initialize
|
5
|
+
@dialogs = BotPlatform::Dialogs::DialogSet.new
|
6
|
+
@dialogs.add(BotPlatform::Dialogs::Prompts::TextPrompt.new("name"))
|
7
|
+
|
8
|
+
storage = BotPlatform::Storage::MemoryStorage.instance
|
9
|
+
@conversation_state = BotPlatform::State::ConversationState.new storage
|
10
|
+
end
|
11
|
+
|
12
|
+
def on_turn(ctx)
|
13
|
+
dialog_ctx = @dialogs.create_dialog_context(ctx)
|
14
|
+
results = dialog_ctx.continue_dialog
|
15
|
+
options = BotPlatform::Dialogs::Prompts::PromptOptions.new
|
16
|
+
options.prompt = BotPlatform::MessageFactory.Text("Input your name please:")
|
17
|
+
if results.status == :empty
|
18
|
+
dialog_ctx.prompt(
|
19
|
+
"name",
|
20
|
+
options
|
21
|
+
)
|
22
|
+
elsif results.status == :complete
|
23
|
+
unless results.result.nil?
|
24
|
+
ctx.send_activity BotPlatform::MessageFactory.Text("Hello! #{results.result}!")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
@conversation_state.save_changes(ctx, false)
|
28
|
+
end
|
29
|
+
end
|
data/samples/echo.rb
ADDED
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bot_platform
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ningfeng Yang
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
13
|
+
description: One bot, multiple channels supported
|
14
14
|
email:
|
15
15
|
- nf.yang@lifevar.com
|
16
16
|
executables:
|
@@ -20,26 +20,77 @@ extra_rdoc_files: []
|
|
20
20
|
files:
|
21
21
|
- ".circleci/config.yml"
|
22
22
|
- ".gitignore"
|
23
|
+
- ".idea/.gitignore"
|
24
|
+
- ".idea/bot_platform.iml"
|
25
|
+
- ".idea/misc.xml"
|
26
|
+
- ".idea/modules.xml"
|
27
|
+
- ".idea/vcs.xml"
|
23
28
|
- ".rspec"
|
24
29
|
- ".rubocop.yml"
|
30
|
+
- ".ruby-version"
|
25
31
|
- CHANGELOG.md
|
26
32
|
- CODE_OF_CONDUCT.md
|
27
33
|
- Gemfile
|
28
34
|
- Gemfile.lock
|
35
|
+
- LICENSE
|
29
36
|
- README.md
|
30
37
|
- Rakefile
|
38
|
+
- bin/cli
|
31
39
|
- bin/console
|
32
40
|
- bin/setup
|
33
41
|
- bot_platform.gemspec
|
42
|
+
- docs/channels.md
|
34
43
|
- exe/welcome
|
35
44
|
- lib/bot_platform.rb
|
45
|
+
- lib/bot_platform/activity.rb
|
46
|
+
- lib/bot_platform/adapter.rb
|
47
|
+
- lib/bot_platform/asserts.rb
|
48
|
+
- lib/bot_platform/boot.rb
|
49
|
+
- lib/bot_platform/channels.rb
|
50
|
+
- lib/bot_platform/channels/base.rb
|
51
|
+
- lib/bot_platform/channels/chatwork.rb
|
52
|
+
- lib/bot_platform/channels/console.rb
|
53
|
+
- lib/bot_platform/channels/facebook.rb
|
54
|
+
- lib/bot_platform/channels/line.rb
|
55
|
+
- lib/bot_platform/channels/lineworks.rb
|
56
|
+
- lib/bot_platform/channels/skype.rb
|
57
|
+
- lib/bot_platform/channels/skype_for_business.rb
|
58
|
+
- lib/bot_platform/channels/slack.rb
|
59
|
+
- lib/bot_platform/channels/teams.rb
|
60
|
+
- lib/bot_platform/channels/web.rb
|
61
|
+
- lib/bot_platform/channels/wechat.rb
|
62
|
+
- lib/bot_platform/cli.rb
|
63
|
+
- lib/bot_platform/conversation_state.rb
|
64
|
+
- lib/bot_platform/dialogs.rb
|
65
|
+
- lib/bot_platform/dialogs/dialog.rb
|
66
|
+
- lib/bot_platform/dialogs/dialog_context.rb
|
67
|
+
- lib/bot_platform/dialogs/dialog_instance.rb
|
68
|
+
- lib/bot_platform/dialogs/dialog_result.rb
|
69
|
+
- lib/bot_platform/dialogs/dialog_set.rb
|
70
|
+
- lib/bot_platform/dialogs/dialog_state.rb
|
71
|
+
- lib/bot_platform/dialogs/prompts/prompt.rb
|
72
|
+
- lib/bot_platform/dialogs/prompts/prompt_options.rb
|
73
|
+
- lib/bot_platform/dialogs/prompts/prompt_recognizer_result.rb
|
74
|
+
- lib/bot_platform/dialogs/prompts/text_prompt.rb
|
75
|
+
- lib/bot_platform/message_factory.rb
|
76
|
+
- lib/bot_platform/state/bot_state.rb
|
77
|
+
- lib/bot_platform/state/conversation_state.rb
|
78
|
+
- lib/bot_platform/state/user_state.rb
|
79
|
+
- lib/bot_platform/storage/memory_storage.rb
|
80
|
+
- lib/bot_platform/storage/mysql_storage.rb
|
81
|
+
- lib/bot_platform/storage/redis_storage.rb
|
82
|
+
- lib/bot_platform/storage/storageable.rb
|
83
|
+
- lib/bot_platform/turn_context.rb
|
36
84
|
- lib/bot_platform/version.rb
|
85
|
+
- samples/dialogs/dialog_simple.rb
|
86
|
+
- samples/echo.rb
|
37
87
|
homepage: https://github.com/lifevar/bot-platform
|
38
|
-
licenses:
|
88
|
+
licenses:
|
89
|
+
- MIT
|
39
90
|
metadata:
|
40
91
|
homepage_uri: https://github.com/lifevar/bot-platform
|
41
92
|
source_code_uri: https://github.com/lifevar/bot-platform
|
42
|
-
changelog_uri: https://github.com/
|
93
|
+
changelog_uri: https://github.com/Lifevar/bot-platform/blob/main/CHANGELOG.md
|
43
94
|
post_install_message:
|
44
95
|
rdoc_options: []
|
45
96
|
require_paths:
|