2019年5月微信正式开放微信对话开放平台,类似于百度的UNIT,阿里云的云小蜜(目前都是免费使用),微信对话开放平台,提供了系统对话技能,涵盖了天气,新闻,股票,听歌,聊天,FM,百科,成语接龙。微信小程序要想使用这些功能,要基于微信小程序插件openaiwidget,小程序数据包还要接入开源小程序代码,那么具体步骤是?下面一文,我将一步一步的为你介绍如何接入。
1、下载小程序源码数据包
小程序数据包我已经整理完毕了,放在公众号上,回复【微信对话】获取。
2、在微信公众号添加插件openaiwidget
3、源码接入小程序中
将解压的aizs文件夹放入pages文件夹里,然后在app.json中加入以下红色部分(version填写当前最新版本)。
"pages": [
"pages/index/index",
"pages/aizs/originalPlugin/originalPlugin",
"pages/aizs/originalPluginPage/originalPluginPage",
"pages/aizs/customUnsupportedMessage/customUnsupportedMessage",
"pages/aizs/customTextMessage/customTextMessage",
"pages/aizs/customQueryMessage/customQueryMessage",
"pages/aizs/customoperateCard/customoperateCard",
"pages/aizs/customNewsMessage/customNewsMessage",
"pages/aizs/customMusicMessage/customMusicMessage",
"pages/aizs/customMiniprogramMessage/customMiniprogramMessage",
"pages/aizs/customImageMessage/customImageMessage",
"pages/aizs/customGuideCard/customMusicMessage",
"pages/special/special"
],
"plugins": {
"myPlugin":{
"version":"1.1.10",
"provider": "wx8c631f7e9f2465e1"
},
"WechatSI": {
"version": "0.3.3",//填写最新版本即可
"provider": "wx069ba97219f66d99"
},
"window": {
"backgroundColor": "#fff",
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "Genius日记",
"navigationBarTextStyle": "black"
},
"tabBar": {
"color": "#999",
"selectedColor": "#434343",
"borderStyle": "white",
"backgroundColor": "#f8f8f8",
"list": [
{
"pagePath": "pages/index/index",
"iconPath": "images/tabbar/tab-home-on.png",
"selectedIconPath": "images/tabbar/tab-home-active.png",
"text": "首页"
},
{
"pagePath": "pages/topic/topic",
"iconPath": "images/tabbar/tab-forum-on.png",
"selectedIconPath": "images/tabbar/tab-forum-active.png",
"text": "栏目"
},
{
"pagePath": "pages/aizs/originalPluginPage/originalPluginPage",
"iconPath": "images/tabbar/aizs.png",
"selectedIconPath": "images/tabbar/aizs.png",
"text": "智能助手"
},
{
"pagePath": "pages/special/special",
"iconPath": "images/tabbar/tab-special-on.png",
"selectedIconPath": "images/tabbar/tab-special-active.png",
"text": "专题"
},
{
"pagePath": "pages/mine/mine",
"iconPath": "images/tabbar/tab-my-on.png",
"selectedIconPath": "images/tabbar/tab-my-active.png",
"text": "我的"
}
]
},
"networkTimeout": {
"request": 10000,
"connectSocket": 10000,
"uploadFile": 10000,
"downloadFile": 10000
},
"navigateToMiniProgramAppIdList": [
"wxb474cbcf5a87a39f",
"wx0d680bf511523e42",
"wx9690d2c3af4f4572",
"wx4cf53bda66b14de9"
],
"requiredBackgroundModes": [
"audio"
],
"sitemapLocation": "sitemap.json"
}
4、修改appid等信息
先使用浏览器打开微信对话开放平台,创建一个机器人,然后获取appid,将originalPluginPage.js原先的appid替换成自己的appid,左上角文件-保存就接入成功。
5、手机真机调试没有问题,就可以上传审核了,如果有更新会直接提醒你,通过手机生成体验版就可以直接升级了,有疑问,公众号内回复【行长】,获取我的联系方式,或者通过扫第一张小程序码,点击我的,那里有个联系客服,也可以直接发送信息到我微信,而且我不知道你是谁。
暂无评论