Skip to content

Commit

Permalink
status命令
Browse files Browse the repository at this point in the history
  • Loading branch information
gutrse3321 committed Jun 25, 2018
1 parent 12dfc53 commit ea57572
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
Empty file added src/renderer/core/index.js
Empty file.
32 changes: 23 additions & 9 deletions src/renderer/views/Home/chatroom.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
<span class="marisa-cmd">application</span>&nbsp;管理外部应用接口</del>
</span>
<span class="system-cmd cmd-collect">
<del>
<span class="marisa-cmd">status</span>&nbsp;查看目前知识所掌握情况</del>
<span class="marisa-cmd">status</span>&nbsp;查看目前知识所掌握情况
</span>
另外你也可以通过输入
<del style="font-weight:bold;">hint</del> 查看其他人自定义的内容提示或小小线索<br><br> 魔理沙无条件的相信你..她把你交给她的所有知识视作珍宝并会很认真的将其牢牢记住..不要让她学坏哦!
Expand Down Expand Up @@ -77,10 +76,13 @@ export default {
case 'teach':
this.talk_list.push({
name: MARISA,
content: '<br />好的,你要教我什么呢?<br/ >格式:You的消息`白絲魔理沙的回复'
content: '要教给魔里沙什么 ..? 现在只能学习语句.. 如"问`答".. 中止教学输入 exit ..'
})
this.cmd_flag = 1
break
case 'status':
this._marisaStatus()
break
default: this._marisaReply(_content)
}
},
Expand All @@ -101,8 +103,7 @@ export default {
ratio++
}
})
console.log('ratio:' + ratio)
if ((ratio / keywords.length) > 0.8) {
if ((ratio / keywords.length) >= 0.5) {
answer = memorise[i].answer
break
}
Expand All @@ -119,12 +120,17 @@ export default {
name: MARISA,
content: '唔嗯...不懂你在说什么呢...'
})
console.log(this.$dictionary.doSegment(_content, {
simple: true
}))
}
},
_teachMarisa (_content) {
if (_content === 'exit') {
this.talk_list.push({
name: YOU,
content: '白丝魔理沙,退出学习模式'
})
this.cmd_flag = 0
return
}
// 将you`marisa格式转换为[you,marisa]数组
let str = _content.split('`')
// 将you的句子分词分一个数组
Expand All @@ -144,7 +150,7 @@ export default {
ratio++
}
})
if ((ratio / keywords.length) > 0.5) {
if ((ratio / keywords.length) >= 0.5) {
keywords.concat(toPpl)
// 去除重复的关键词或字
keywords = Array.from(new Set(keywords.filter((x, i, self) => self.indexOf(x) === i)))
Expand All @@ -171,6 +177,14 @@ export default {
})
this.cmd_flag = 0
},
_marisaStatus () {
let memorise = this.$db.get('memorise').value().length
let weight = 0.00011 * parseFloat(memorise)
this.talk_list.push({
name: MARISA,
content: `目前魔理沙的脑重量是${weight} 克。如果我现在还不能理解您的意思的话,请教给我更多的知识,我会非常非常用心学习的~`
})
},
_scrollBottom () {
this.$nextTick(() => {
let _scrollHeight = this.$refs.talk_place.scrollHeight
Expand Down

0 comments on commit ea57572

Please sign in to comment.