|
@@ -1,7 +1,16 @@
|
|
|
<template>
|
|
|
<div style="width:1000px; margin: auto;">
|
|
|
<el-row>
|
|
|
- <el-col :span="18">
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-card class="chat-msg">
|
|
|
+ <ul>
|
|
|
+ <li v-for="item in top10" :key="item.question" @click="searchByTop10(item.question)">
|
|
|
+ {{ item.question }}
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </el-card>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
<div class="chat-window-wrapper" ref="chatWindowWrapper">
|
|
|
<el-card class="chat-window" ref="chatWindow">
|
|
|
<div v-for="(message, index) in messages" :key="index" class="message">
|
|
@@ -43,7 +52,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { question } from "@/api/knowledge/search";
|
|
|
+import { question, getTop10 } from "@/api/knowledge/search";
|
|
|
export default {
|
|
|
name: 'question',
|
|
|
dicts: ['show_msg'],
|
|
@@ -54,8 +63,12 @@ export default {
|
|
|
requestError: false,
|
|
|
isWaitingForResponse: false,
|
|
|
hint: "",
|
|
|
+ top10:[],
|
|
|
};
|
|
|
},
|
|
|
+ created(){
|
|
|
+ this.getTop10();
|
|
|
+ },
|
|
|
mounted(){
|
|
|
this.hint = this.getHint();
|
|
|
},
|
|
@@ -119,6 +132,15 @@ export default {
|
|
|
chatWindowWrapper.scrollTop = chatWindowWrapper.scrollHeight;
|
|
|
});
|
|
|
},
|
|
|
+ getTop10() {
|
|
|
+ getTop10().then(resp => {
|
|
|
+ this.top10 = resp.data
|
|
|
+ })
|
|
|
+ },
|
|
|
+ searchByTop10(question){
|
|
|
+ this.inputMessage = question;
|
|
|
+ this.sendMessage(null)
|
|
|
+ }
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
@@ -230,6 +252,8 @@ export default {
|
|
|
height: calc(100vh - 200px);
|
|
|
/* max-height: 500px; */
|
|
|
overflow-y: auto;
|
|
|
+ margin-left: 5px;
|
|
|
+ margin-right: 5px;
|
|
|
}
|
|
|
|
|
|
.chat-window {
|
|
@@ -239,7 +263,6 @@ export default {
|
|
|
.chat-msg {
|
|
|
height: calc(100vh - 200px);
|
|
|
white-space: pre-wrap;
|
|
|
- margin-left: 5px;
|
|
|
font-size: 1rem;
|
|
|
}
|
|
|
</style>
|