|
|
@@ -230,7 +230,7 @@
|
|
|
<option value="customer">客户问答</option>
|
|
|
<option value="internal">内部查询</option>
|
|
|
</select> -->
|
|
|
- <select v-model="qaRating" class="filter-select">
|
|
|
+ <select v-model="qaRating" class="filter-select" @change='getRating'>
|
|
|
<option value="all">全部评价</option>
|
|
|
<option value="positive">好评</option>
|
|
|
<option value="negative">待优化</option>
|
|
|
@@ -238,7 +238,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="qa-list">
|
|
|
- <div v-for="qa in filteredQA" :key="qa.id" class="qa-card">
|
|
|
+ <div v-for="qa in qaRecords" :key="qa.id" class="qa-card">
|
|
|
<!-- <div class="qa-source">
|
|
|
<span class="source-badge" :class="qa.sourceType">{{ qa.sourceLabel }}</span>
|
|
|
</div> -->
|
|
|
@@ -255,10 +255,10 @@
|
|
|
<div class="qa-footer">
|
|
|
<div class="qa-time">{{ qa.time }}</div>
|
|
|
<div class="qa-rating">
|
|
|
- <button class="rating-btn" @click="rateQA(qa, 'positive')"><!-- :class="{ active: qa.rating === 'positive' }" -->
|
|
|
+ <button class="rating-btn" :class="{ active: qa.myAgree === 1}" @click="rateQA(qa, 'positive')">
|
|
|
<i class="fas fa-thumbs-up"></i><span style="margin-left: 2px;">{{qa.agree}}</span>
|
|
|
</button>
|
|
|
- <button class="rating-btn" @click="rateQA(qa, 'negative')"><!-- :class="{ active: qa.rating === 'negative' }" -->
|
|
|
+ <button class="rating-btn" :class="{ active: qa.myDisagree === 1}" @click="rateQA(qa, 'negative')">
|
|
|
<i class="fas fa-thumbs-down"></i><span style="margin-left: 2px;">{{qa.disagree}}</span>
|
|
|
</button>
|
|
|
</div>
|
|
|
@@ -937,8 +937,12 @@ const chatParams=ref({
|
|
|
pageIndex: 1,
|
|
|
pageSize: 10,
|
|
|
keyword:'',
|
|
|
+ query:'',
|
|
|
})
|
|
|
-const getChatMessages = () => {
|
|
|
+const getChatMessages = (query) => {
|
|
|
+ if(query){
|
|
|
+ chatParams.value.query = query=='positive'?'agree':query=='negative'?'disagree':''
|
|
|
+ }
|
|
|
chatParams.value.keyword = searchQuery.value
|
|
|
chatMessages(chatParams.value).then(res => {
|
|
|
tabs.value[2].count = qaRecordsTotal.value = res.result.total
|
|
|
@@ -1169,18 +1173,6 @@ const aiOptimize = (type) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-const filteredQA = computed(() => {
|
|
|
- let result = qaRecords.value
|
|
|
- if (qaFilter.value !== 'all') {
|
|
|
- result = result.filter(qa => qa.sourceType === qaFilter.value)
|
|
|
- }
|
|
|
- if (qaRating.value !== 'all') {
|
|
|
- result = result.filter(qa => qa.rating === qaRating.value)
|
|
|
- }
|
|
|
- return result
|
|
|
-})
|
|
|
-
|
|
|
const formatNumber = (num) => num.toLocaleString()
|
|
|
|
|
|
const optimizeAnswer = (item) => {
|
|
|
@@ -1190,17 +1182,13 @@ const optimizeAnswer = (item) => {
|
|
|
const rateQA = (qa, rating) => {
|
|
|
qa.rating = rating
|
|
|
let params = {
|
|
|
- agree:rating=='positive'?'1':'0',
|
|
|
- disagree:rating=='positive'?'0':'1',
|
|
|
+ agree:rating=='positive'&&qa.myAgree==0?'1':'0',
|
|
|
+ disagree:rating=='negative'&&qa.myDisagree==0?'1':'0',
|
|
|
aiMessageId:qa.id
|
|
|
}
|
|
|
messageReview(params).then(res => {
|
|
|
if(res.success){
|
|
|
- if(rating=='positive'){
|
|
|
- qa.agree++
|
|
|
- }else{
|
|
|
- qa.disagree++
|
|
|
- }
|
|
|
+ getChatMessages()
|
|
|
showToastMessage('感谢您的反馈', 'success')
|
|
|
}else{
|
|
|
return ElMessage.error('请求超时,请稍后再试')
|
|
|
@@ -1208,6 +1196,10 @@ const rateQA = (qa, rating) => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+const getRating = () => {
|
|
|
+ getChatMessages(qaRating.value)
|
|
|
+}
|
|
|
+
|
|
|
const toggleSetting = (key) => {
|
|
|
showToastMessage('设置已更新', 'success')
|
|
|
}
|