CN-1400 fix: 调整知识库智能学习启停功能

This commit is contained in:
chenjinsong
2023-10-23 18:42:32 +08:00
parent d0aa64fb9c
commit 643ada9172
3 changed files with 13 additions and 10 deletions

View File

@@ -391,17 +391,18 @@ export default {
switchLearning () {
const hint = this.aiTaggingList.find(d => d.knowledgeId === this.switchKnowledgeId)
const toStatus = hint.status === 0 ? 1 : 0
axios.patch(api.knowledgeBaseEnable, { list: [{ knowledgeId: this.switchKnowledgeId, status: toStatus }] }).then(res => {
const url = toStatus === 0 ? api.knowledgeBaseLearningStop : api.knowledgeBaseLearningStart
axios.post(`${url}?knowledgeId=${hint.knowledgeId}`).then(res => {
if (res.status === 200) {
hint.status = toStatus
this.$message.success(this.$t('tip.success'))
} else {
console.error(res.message)
this.errorMsgHandler(res)
this.$message.error(this.errorMsgHandler(res))
}
}).catch(e => {
console.error(e)
this.errorMsgHandler(e)
this.$message.error(this.errorMsgHandler(e))
}).finally(() => {
this.showConfirmSwitch = false
})