customer_service_im 0.8.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e66af9540fef1eb464557fde36fbda5f24661842f657a52f7bb44e4315d8f594
4
- data.tar.gz: 0a71a2bfffd470a0ea9a0e01610cb9162e5d2d625a6529b99dbfeca2e1980291
3
+ metadata.gz: bdb6e3a10e83a9ed675186562239e5a099fcc57b956a703350a2d613eaf26f1a
4
+ data.tar.gz: 826c65eab6e7bcb07e588665b19f21cb16153bfd4adb1d053d685797b115bdb3
5
5
  SHA512:
6
- metadata.gz: be4b5f529789ff41c3cb65649ffdf2d09060cc6818062982ef6a258f9cfbd1c87a83f8248bfb786892a6b79b695edbcd42a549396103b465f839abcad99e9fc4
7
- data.tar.gz: f00c05ba7be0a33add96a4e7f2868a1cbc242259276730872bad0ed3019090678811e834eca53728572d480c0646780a2df820bde7efb55fcd3c666243853202
6
+ metadata.gz: 3d135860b854ea1b2e525c5e589c6c42d81095ce7973f235690be8792baff9507d2999740f503164123bb888712c7165b1be2b85ee4ab3c1292ca3a700ce1344
7
+ data.tar.gz: c6e3f4efee007bea41d82963e11f1ff16d69661717a8d482ef3d30ef39864281a4219d28d24bef7f7b08c799607dd20901a80b27c16af38b7c6bedc4081d0d88
@@ -82,7 +82,7 @@ module CustomerServiceIm
82
82
  else
83
83
  logger = Logger.new Rails.root.join("log/speech_recognition.log")
84
84
  logger.error result.errors
85
- raise TsrRecognizeError.new(result.errors)
85
+ raise CustomerServiceIm::AsrRecognizeError.new(result.errors)
86
86
  end
87
87
  end
88
88
 
@@ -1,12 +1,6 @@
1
1
 
2
2
  TxAsr.setup do |config|
3
3
 
4
- # TODO 需要将 secret_key 和 secret_id 改为你实际项目中的配置
5
- config.secret_key = "JL6amhMkqfDVWGjuoRp1DI8j48wTnunQ"
6
- config.secret_id = "AKIDta1B5i49yXpqb5HCqELBk35qJWS7VcS1"
7
- config.region = "ap-guangzhou"
8
-
9
-
10
4
  # 声音格式: 支持 mp3 和 wav
11
5
  config.voice_format = "mp3"
12
6
 
@@ -0,0 +1,4 @@
1
+
2
+ module CustomerServiceIm
3
+ class AsrRecognizeError < StandardError; end
4
+ end
@@ -1,3 +1,3 @@
1
1
  module CustomerServiceIm
2
- VERSION = '0.8.0'
2
+ VERSION = '0.12.0'
3
3
  end
@@ -1,6 +1,7 @@
1
1
  require "customer_service_im/version"
2
2
  require "customer_service_im/engine"
3
3
  require "customer_service_im/core_ext"
4
+ require "customer_service_im/asr_recognize_error"
4
5
  # require 'shoulda'
5
6
  require "jwt"
6
7
  require 'jbuilder'
@@ -10,11 +11,16 @@ require 'mini_program'
10
11
 
11
12
  module CustomerServiceIm
12
13
  # Your code goes here...
13
- mattr_accessor :appid, :app_secret, :jwt_secret
14
+ mattr_accessor :appid, :app_secret, :jwt_secret, :asr_config
14
15
 
15
16
  def self.setup
16
17
  if block_given?
17
18
  yield self
19
+ MiniProgram.appid = appid
20
+ MiniProgram.app_secret = app_secret
21
+ TxAsr.secret_key = asr_config&.fetch(:secret_key, :blank_asr_secret_key)
22
+ TxAsr.secret_id = asr_config&.fetch(:secret_id, :blank_asr_secret_id)
23
+ TxAsr.region = asr_config&.fetch(:region, :blank_asr_region)
18
24
  end
19
25
  end
20
26
  end
@@ -3,5 +3,6 @@ class CustomerServiceIm::InstallGenerator < Rails::Generators::Base
3
3
 
4
4
  def copy_initializer
5
5
  copy_file "initializer.rb", "config/initializers/customer_service_im.rb"
6
+ generate "mini_program:install"
6
7
  end
7
8
  end
@@ -3,4 +3,11 @@ CustomerServiceIm.setup do |config|
3
3
  config.jwt_secret = Rails.application.secret_key_base
4
4
  config.appid = "xxx"
5
5
  config.app_secret = "x1x"
6
+
7
+ # tencent asr config
8
+ config.asr_config = {
9
+ secret_key: "tencent asr secret key",
10
+ secret_id: "tencent asr secret id",
11
+ region: "tencent asr "
12
+ }
6
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: customer_service_im
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ian
@@ -189,6 +189,7 @@ files:
189
189
  - db/migrate/20211026062727_add_password_digest_to_customer_service_im_staffs.rb
190
190
  - db/migrate/20211026062951_add_email_to_customer_service_im_staffs.rb
191
191
  - lib/customer_service_im.rb
192
+ - lib/customer_service_im/asr_recognize_error.rb
192
193
  - lib/customer_service_im/core_ext.rb
193
194
  - lib/customer_service_im/engine.rb
194
195
  - lib/customer_service_im/version.rb
@@ -196,7 +197,6 @@ files:
196
197
  - lib/generators/customer_service_im/install/install_generator.rb
197
198
  - lib/generators/customer_service_im/install/templates/initializer.rb
198
199
  - lib/tasks/customer_service_im_tasks.rake
199
- - lib/tsr_recognize_error.rb
200
200
  homepage: https://github.com/bkyz/customer_service_im
201
201
  licenses:
202
202
  - MIT
@@ -1,2 +0,0 @@
1
-
2
- class TsrRecognizeError < StandardError; end