|
|
@@ -89,7 +89,7 @@ module.exports = { |
|
|
|
"batch": 16, |
|
|
|
"minLoadFrameNum": 50 |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
"chatConfig": { |
|
|
|
"class": "CXHubChat", |
|
|
|
"url": "https://commercial-fab.xiaoice.com/api/hub/organizations/org-qufangwang/agents/64af7b926e1ba4813c4bd6d7/environments/draft/sessions", |
|
|
@@ -99,7 +99,7 @@ module.exports = { |
|
|
|
}], |
|
|
|
"csChatUrl": "https://commercial-fab.xiaoice.com/api/hub/organizations/org-qufangwang/characters//sessions" |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
"logConfig": { |
|
|
|
"class": "AliTraceLogger", |
|
|
|
"metaData": { |
|
|
@@ -109,7 +109,7 @@ module.exports = { |
|
|
|
"agentId": "64af7b926e1ba4813c4bd6d7" |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
"talkConfig": { |
|
|
|
"class": "CarouselTalk", |
|
|
|
"url": "https://commercial-fab.xiaoice.com", |
|
|
@@ -136,6 +136,7 @@ module.exports = { |
|
|
|
onLoad() { |
|
|
|
let _this = this |
|
|
|
this.plugin = requirePlugin("digital-human-plugin").api; |
|
|
|
console.log(this.plugin, 'this.plugin') |
|
|
|
this.plugin.init({ |
|
|
|
...this.config, |
|
|
|
onReceivedAsrText: (text) => { |
|
|
@@ -156,7 +157,7 @@ module.exports = { |
|
|
|
]; |
|
|
|
async function talk(texts) { |
|
|
|
// 轮播文本内容 |
|
|
|
for (let i = 0; i < texts.length; i++) { |
|
|
|
for (let i = 0; i < texts.length; i++) { |
|
|
|
await _this.plugin.human.talkAsync( |
|
|
|
texts[i].text, |
|
|
|
texts[i].gesture, { |
|
|
@@ -191,10 +192,28 @@ module.exports = { |
|
|
|
methods: { |
|
|
|
// // 模拟聊天回复接口 |
|
|
|
async getReply(text) { |
|
|
|
return await this.mockReplies[Math.floor(Math.random() * this.mockReplies.length)] |
|
|
|
return await uni.request({ |
|
|
|
url: `${this.config.chatConfig.url}/1`, |
|
|
|
method: 'POST', |
|
|
|
data: { |
|
|
|
"text": text, |
|
|
|
"currentSceneInfo": { |
|
|
|
"sceneId": "" |
|
|
|
} |
|
|
|
}, |
|
|
|
success: (res) => { |
|
|
|
console.log(res) |
|
|
|
} |
|
|
|
}) |
|
|
|
// return await this.mockReplies[Math.floor(Math.random() * this.mockReplies.length)] |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
sendChat(e) { |
|
|
|
this.customChat(e.detail.value) |
|
|
|
}, |
|
|
|
|
|
|
|
async customChat(text) { |
|
|
|
console.log(text) |
|
|
|
// // 调用自定义的api获取回复 |
|
|
|
const reply = await this.getReply(text) |
|
|
|
// // 主动调用播放接口,并等待播放完成 |
|
|
|