From 0392c1f70f0624bd405f0a7592f9b1b30d9e0bcc Mon Sep 17 00:00:00 2001 From: Eric-Guo Date: Mon, 1 Jul 2019 14:35:19 +0800 Subject: [PATCH] Release 0.11.3 --- CHANGELOG.md | 6 ++++++ README-CN.md | 8 +++++++- README.md | 18 +++++++++++++++++- VERSION | 2 +- 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c81337f9..35eaec0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## v0.11.3 (released at 07/02/2019) + +* New addvoicetorecofortext and queryrecoresultfortext support. +* improve existing class detect by @3014zhangshuo #261 +* new wxa_get_wxacode_unlimit API for miniapp by @paicha #260 + ## v0.11.2 (released at 05/08/2019) * bugfix short_url to shorturl in wechat console tool by @yuanxinyu #259 diff --git a/README-CN.md b/README-CN.md index fa80eec4..f1e7dffe 100644 --- a/README-CN.md +++ b/README-CN.md @@ -725,7 +725,13 @@ class WechatsController < ActionController::Base # 处理语音信息 on :voice do |request| - request.reply.voice(request[:MediaId]) #直接语音音返回给用户 + # 直接语音音返回给用户 + # request.reply.voice(request[:MediaId]) + + voice_id = request[:MediaId] + # 开通语音识别后,用户每次发送语音给服务号时,微信会在推送的语音消息XML数据包中,增加一个Recognition字段 + recognition = request[:Recognition] + request.reply.text "#{voice_id} #{recognition}" end # 处理视频信息 diff --git a/README.md b/README.md index ff1911ea..fb702b8a 100644 --- a/README.md +++ b/README.md @@ -663,6 +663,16 @@ end Using `Wechat.api` to access the wechat api function at any place. +Below is an example via `rails console` to call AI Voice Recognition API: + +```bash +# Audio file with ID3 version 2.4.0, contains:MPEG ADTS, layer III, v2, 40 kbps, 16 kHz, Monaural +test_voice_file='test_voice.mp3' +Wechat.api.addvoicetorecofortext('test_voice_id', File.open(test_voice_file)) +Wechat.api.queryrecoresultfortext 'test_voice_id' +``` + + ## Checking the signature Using `Wechat.decrypt(encrypted_data,session_key, iv)` to decode the data. via. [Signature Checking](https://developers.weixin.qq.com/miniprogram/dev/api/signature.html) @@ -750,7 +760,13 @@ class WechatsController < ActionController::Base # When user sends a voice on :voice do |request| - request.reply.voice(request[:MediaId]) # Echo the sent voice to user + # Echo the sent voice to user + # request.reply.voice(request[:MediaId]) + + voice_id = request[:MediaId] + # It's only avaiable for Service Account and enable it in dashboard. + recognition = request[:Recognition] + request.reply.text "#{voice_id} #{recognition}" end # When user sends a video diff --git a/VERSION b/VERSION index bc859cbd..1a96df19 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.11.2 +0.11.3