|
|
@@ -255,10 +255,10 @@
|
|
|
<div class="qa-footer">
|
|
|
<div class="qa-time">{{ qa.time }}</div>
|
|
|
<div class="qa-rating">
|
|
|
- <button class="rating-btn" :class="{ active: qa.rating === 'positive' }" @click="rateQA(qa, 'positive')">
|
|
|
+ <button class="rating-btn" @click="rateQA(qa, 'positive')"><!-- :class="{ active: qa.rating === 'positive' }" -->
|
|
|
<i class="fas fa-thumbs-up"></i><span style="margin-left: 2px;">{{qa.agree}}</span>
|
|
|
</button>
|
|
|
- <button class="rating-btn" :class="{ active: qa.rating === 'negative' }" @click="rateQA(qa, 'negative')">
|
|
|
+ <button class="rating-btn" @click="rateQA(qa, 'negative')"><!-- :class="{ active: qa.rating === 'negative' }" -->
|
|
|
<i class="fas fa-thumbs-down"></i><span style="margin-left: 2px;">{{qa.disagree}}</span>
|
|
|
</button>
|
|
|
</div>
|
|
|
@@ -676,7 +676,7 @@
|
|
|
|
|
|
<script setup>
|
|
|
import { ref, computed } from 'vue'
|
|
|
-import { knowledgeDatasets,knowledgeDocuments,createKnowledge,createChunk,editChunk,chatMessages,baseTraining,creatTraining,baseStatistics,getAllChunks,getChunks,getAllDocumnets,delDocuments,delChunk,getDocumentDetail,blocking,downloadDocument } from '../api/knowledge'
|
|
|
+import { knowledgeDatasets,knowledgeDocuments,createKnowledge,createChunk,editChunk,chatMessages,baseTraining,creatTraining,baseStatistics,getAllChunks,getChunks,getAllDocumnets,delDocuments,delChunk,getDocumentDetail,blocking,downloadDocument,messageReview } from '../api/knowledge'
|
|
|
import { formatTimeAgo } from '@/utils/time'
|
|
|
import { ElMessage } from 'element-plus'
|
|
|
|
|
|
@@ -1189,7 +1189,23 @@ const optimizeAnswer = (item) => {
|
|
|
|
|
|
const rateQA = (qa, rating) => {
|
|
|
qa.rating = rating
|
|
|
- showToastMessage('感谢您的反馈', 'success')
|
|
|
+ let params = {
|
|
|
+ agree:rating=='positive'?'1':'0',
|
|
|
+ disagree:rating=='positive'?'0':'1',
|
|
|
+ aiMessageId:qa.id
|
|
|
+ }
|
|
|
+ messageReview(params).then(res => {
|
|
|
+ if(res.success){
|
|
|
+ if(rating=='positive'){
|
|
|
+ qa.agree++
|
|
|
+ }else{
|
|
|
+ qa.disagree++
|
|
|
+ }
|
|
|
+ showToastMessage('感谢您的反馈', 'success')
|
|
|
+ }else{
|
|
|
+ return ElMessage.error('请求超时,请稍后再试')
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
const toggleSetting = (key) => {
|