-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathapp.js
54 lines (43 loc) · 1.69 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// app.js
// 源码引入方式,方便调试
import Bmob from 'utils/hydrogen-js-sdk/src/lib/app.js'
// import Bmob from 'utils/hydrogen-js-sdk/dist/Bmob-2.4.13.min.js'
Bmob.initialize('bc7814ffb203da9f', '123456');
// 初始化 Bmob.initialize('你的Application ID', '你的REST API Key');
// Bmob.initialize('9731770784b8c006', '111111')
// Bmob.domain('http://website-restful.bmobapp.com')
// Bmob.domain('http://apitest.codenow.cn')
// Bmob.domain('https://api.codenow.cn')
App({
onLaunch: function () {
// 按钮点击发送消息
setTimeout(()=>{
// 发送消息
// console.log(ChatAi,"x");
// console.log(12);
// session 会话id,可以传用户objectId,或者随机数
// content 内容,提问的内容,如果希望上下文,可以这样传入
// {"model":"gpt-3.5-turbo","messages":[{"content":"你好","role":"user"},{"content":"你好,有什么我可以为你提供的帮助吗?","role":"assistant"},{"content":"请问Bmob是什么产品","role":"user"}],"stream":true}
// let datas = {"messages":[{"content":"你好","role":"user"}],"session":"b1"}
// ChatAi.send(JSON.stringify(datas))
},3000)
const query = Bmob.Query('_User')
// query.equalTo('username','!=','ff')
query.find().then(res => {
console.log(res)
})
// 一键登录
Bmob.User.auth().then(res => {
console.log(res);
console.log('一键登录成功')
var userData = { nickName: res.nickName, objectId: res.objectId, openid: res.openid, userPic: res.userPic, username: res.username };
wx.setStorageSync('userData', userData);
wx.setStorageSync('openid', res.openid)
}).catch(err => {
console.log(err);
})
},
globalData: {
userInfo: null
}
})