customer_service_im 0.13.0 → 0.14.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 +54 -6
- data/lib/customer_service_im/version.rb +1 -1
- data/lib/customer_service_im.rb +0 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fabb9e1f4f4302eb3d1a50a44be2fb9aef4eff4d8ddc3868e7599d3d57192d4
|
4
|
+
data.tar.gz: cc468ad78fb41e22a185372ea22c88d1193c96dabde202b6e1613c0b7708910f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab10c8a0820d38e14a8b6a0fd543bcbca431cb2a44b6bcc54a12debb13cc9e95d1f9fb688ed867672804deae6a927b6af322bdf7ae45331320e048e989c2871c
|
7
|
+
data.tar.gz: 4ee88b2022a1216cca8a3280cd0e5b82530ab4d262f85014a16792e8d465f07d019c9959112f39a4461a4ae72f69143a30a3ab66cc56160bcc0978ea2d8e7169
|
data/README.md
CHANGED
@@ -1,24 +1,72 @@
|
|
1
1
|
# CustomerServiceIm
|
2
|
-
|
2
|
+
客服 Engine
|
3
3
|
|
4
4
|
## Usage
|
5
5
|
How to use my plugin.
|
6
6
|
|
7
7
|
## Installation
|
8
|
-
Add this line to your application's Gemfile:
|
9
8
|
|
9
|
+
1. 在`Gemfile`里边添加如下代码
|
10
10
|
```ruby
|
11
11
|
gem 'customer_service_im'
|
12
12
|
```
|
13
13
|
|
14
|
-
|
14
|
+
2. 安装 gem
|
15
15
|
```bash
|
16
|
-
$ bundle
|
16
|
+
$ bundle i
|
17
17
|
```
|
18
18
|
|
19
|
-
|
19
|
+
3. 执行 Engine 安装的命令
|
20
20
|
```bash
|
21
|
-
|
21
|
+
rails g customer_service_im:install
|
22
|
+
```
|
23
|
+
|
24
|
+
4. 修改`config/initializers/customer_service_im.rb`里边的配置信息,小程序配置和腾讯语音识别配置
|
25
|
+
|
26
|
+
5. 安装 Engine 迁移
|
27
|
+
```bash
|
28
|
+
rails customer_service_im:install:migrations
|
29
|
+
```
|
30
|
+
|
31
|
+
6. 安装 `ActiveStorage` ,如果宿主应用已安装则可跳过,操作冪等,可重复执行
|
32
|
+
```bash
|
33
|
+
rails active_storage:install
|
34
|
+
```
|
35
|
+
|
36
|
+
7. 执行迁移文件
|
37
|
+
```bash
|
38
|
+
rails db:migrate
|
39
|
+
```
|
40
|
+
|
41
|
+
8. 删除宿主应用的`app/channels`,目前没有好的解决方案,暂时先这样
|
42
|
+
|
43
|
+
9. 配置对应环境`websocket`域名白名单,如`config/initializers/development.rb`
|
44
|
+
```ruby
|
45
|
+
Rails.application.configure do
|
46
|
+
# ...
|
47
|
+
# config.action_cable.allowed_request_origins = [/http:\/\/*/, /https:\/\/*/]
|
48
|
+
config.action_cable.allowed_request_origins = [/http:\/\/example\.com/, /https:\/\/example\.com/]
|
49
|
+
# ...
|
50
|
+
end
|
51
|
+
```
|
52
|
+
|
53
|
+
10. 挂载 engine ,在`config/routes.rb`中添加
|
54
|
+
```ruby
|
55
|
+
mount CustomerServiceIm::Engine => "/customer_service"
|
56
|
+
```
|
57
|
+
|
58
|
+
11. 设置对应环境(如:`config/initializers/development.rb`)的默认 host 地址,用于拼接语音识别文件的 url 地址,必须外网能够访问
|
59
|
+
```ruby
|
60
|
+
Rails.application.configure do
|
61
|
+
# ...
|
62
|
+
Rails.application.routes.default_url_options[:host] = ENV.fetch("DEFAULT_HOST", "https://demo.mini-geek.com")
|
63
|
+
# ...
|
64
|
+
end
|
65
|
+
```
|
66
|
+
|
67
|
+
12. 启用服务
|
68
|
+
```bash
|
69
|
+
$ rails s -b 0.0.0.0
|
22
70
|
```
|
23
71
|
|
24
72
|
## Contributing
|
data/lib/customer_service_im.rb
CHANGED
@@ -16,8 +16,6 @@ module CustomerServiceIm
|
|
16
16
|
def self.setup
|
17
17
|
if block_given?
|
18
18
|
yield self
|
19
|
-
MiniProgram.appid = appid
|
20
|
-
MiniProgram.app_secret = app_secret
|
21
19
|
TxAsr.secret_key = asr_config&.fetch(:secret_key, :blank_asr_secret_key)
|
22
20
|
TxAsr.secret_id = asr_config&.fetch(:secret_id, :blank_asr_secret_id)
|
23
21
|
TxAsr.region = asr_config&.fetch(:region, :blank_asr_region)
|