|
@@ -413,24 +413,6 @@
|
|
|
<button class="modal-close" @click="showAddModal = false"><i class="fas fa-times"></i></button>
|
|
<button class="modal-close" @click="showAddModal = false"><i class="fas fa-times"></i></button>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="modal-body">
|
|
<div class="modal-body">
|
|
|
- <div class="form-group">
|
|
|
|
|
- <div style="display: flex;align-items: center;margin-bottom: 6px;justify-content: space-between;">
|
|
|
|
|
- <label class="form-label">内容 <span class="required">*</span></label><button class="btn btn-primary" @click="aiOptimize('content')" style="margin-left: 10px;padding: 4px 8px;border-radius: 4px;" :disabled="aiContentLoading"><i class="fas fa-sync" :class="{'icon-spin': aiContentLoading}"></i> AI优化</button>
|
|
|
|
|
- </div>
|
|
|
|
|
- <textarea class="form-textarea" v-model="newKnowledge.content" rows="4" placeholder="输入详细内容" :disabled="aiContentLoading"></textarea>
|
|
|
|
|
- </div>
|
|
|
|
|
- <!-- <div class="form-group">
|
|
|
|
|
- <div style="display: flex;align-items: center;margin-bottom: 6px;justify-content: space-between;">
|
|
|
|
|
- <label class="form-label">问题/关键词 <span class="required">*</span></label><button class="btn btn-primary" @click="aiOptimize('content')" style="margin-left: 10px;padding: 4px 8px;border-radius: 4px;" :disabled="aiContentLoading"><i class="fas fa-sync" :class="{'icon-spin': aiContentLoading}"></i> AI优化</button>
|
|
|
|
|
- </div>
|
|
|
|
|
- <textarea class="form-textarea" v-model="newKnowledge.content" rows="2" placeholder="例如:MOQ最小起订量是多少?" :disabled="aiContentLoading"></textarea>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div class="form-group" v-if="chunkType=='add'||doc_form=='qa_model'">
|
|
|
|
|
- <div style="display: flex;align-items: center;margin-bottom: 6px;justify-content: space-between;">
|
|
|
|
|
- <label class="form-label">答案/内容 <span class="required">*</span></label><button class="btn btn-primary" @click="aiOptimize('answer')" style="margin-left: 10px;padding: 4px 8px;border-radius: 4px;" :disabled="aiAnswerLoading"><i class="fas fa-sync" :class="{'icon-spin': aiAnswerLoading}"></i> AI优化</button>
|
|
|
|
|
- </div>
|
|
|
|
|
- <textarea class="form-textarea" v-model="newKnowledge.answer" rows="4" placeholder="输入详细答案..." :disabled="aiAnswerLoading"></textarea>
|
|
|
|
|
- </div> -->
|
|
|
|
|
<div class="form-group">
|
|
<div class="form-group">
|
|
|
<label class="form-label">知识分类 <span class="required">*</span></label>
|
|
<label class="form-label">知识分类 <span class="required">*</span></label>
|
|
|
<select class="form-select" v-model="newKnowledge.dataset_id" @change='getDocument' :disabled='chunkType=="edit"'>
|
|
<select class="form-select" v-model="newKnowledge.dataset_id" @change='getDocument' :disabled='chunkType=="edit"'>
|
|
@@ -440,10 +422,30 @@
|
|
|
</div>
|
|
</div>
|
|
|
<div class="form-group">
|
|
<div class="form-group">
|
|
|
<label class="form-label">知识文档 <span class="required">*</span></label>
|
|
<label class="form-label">知识文档 <span class="required">*</span></label>
|
|
|
- <select class="form-select" v-model="newKnowledge.document_id" :disabled='chunkType=="edit"'>
|
|
|
|
|
|
|
+ <select class="form-select" v-model="newKnowledge.document_id" @change='getDocumentSelect' :disabled='chunkType=="edit"'>
|
|
|
<option value="">选择文档</option>
|
|
<option value="">选择文档</option>
|
|
|
<option v-for="cat in documentList" :key="cat.id" :value="cat.id">{{ cat.name }}</option>
|
|
<option v-for="cat in documentList" :key="cat.id" :value="cat.id">{{ cat.name }}</option>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="form-group" v-if="doc_form=='text_model'">
|
|
|
|
|
+ <div style="display: flex;align-items: center;margin-bottom: 6px;justify-content: space-between;">
|
|
|
|
|
+ <label class="form-label">内容 <span class="required">*</span></label><button class="btn btn-primary" @click="aiOptimize('content')" style="margin-left: 10px;padding: 4px 8px;border-radius: 4px;" :disabled="aiContentLoading"><i class="fas fa-sync" :class="{'icon-spin': aiContentLoading}"></i> AI优化</button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <textarea class="form-textarea" v-model="newKnowledge.content" rows="4" placeholder="输入详细内容" :disabled="aiContentLoading"></textarea>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div v-if="doc_form=='qa_model'">
|
|
|
|
|
+ <div class="form-group">
|
|
|
|
|
+ <div style="display: flex;align-items: center;margin-bottom: 6px;justify-content: space-between;">
|
|
|
|
|
+ <label class="form-label">问题/关键词 <span class="required">*</span></label><button class="btn btn-primary" @click="aiOptimize('content')" style="margin-left: 10px;padding: 4px 8px;border-radius: 4px;" :disabled="aiContentLoading"><i class="fas fa-sync" :class="{'icon-spin': aiContentLoading}"></i> AI优化</button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <textarea class="form-textarea" v-model="newKnowledge.content" rows="2" placeholder="例如:MOQ最小起订量是多少?" :disabled="aiContentLoading"></textarea>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="form-group">
|
|
|
|
|
+ <div style="display: flex;align-items: center;margin-bottom: 6px;justify-content: space-between;">
|
|
|
|
|
+ <label class="form-label">答案/内容 <span class="required">*</span></label><button class="btn btn-primary" @click="aiOptimize('answer')" style="margin-left: 10px;padding: 4px 8px;border-radius: 4px;" :disabled="aiAnswerLoading"><i class="fas fa-sync" :class="{'icon-spin': aiAnswerLoading}"></i> AI优化</button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <textarea class="form-textarea" v-model="newKnowledge.answer" rows="4" placeholder="输入详细答案..." :disabled="aiAnswerLoading"></textarea>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
<!-- <div class="form-group">
|
|
<!-- <div class="form-group">
|
|
|
<label class="form-label">关键词标签</label>
|
|
<label class="form-label">关键词标签</label>
|
|
@@ -874,7 +876,7 @@ const getCategoryList = async (id,type) => {
|
|
|
documentList.value = res.result.data
|
|
documentList.value = res.result.data
|
|
|
if(chunkType.value == 'edit'){
|
|
if(chunkType.value == 'edit'){
|
|
|
dialogVisible.value = false
|
|
dialogVisible.value = false
|
|
|
-
|
|
|
|
|
|
|
+ doc_form.value = res.result.data[0].doc_form
|
|
|
}
|
|
}
|
|
|
}else{
|
|
}else{
|
|
|
knowledgeList.value = res.result.data
|
|
knowledgeList.value = res.result.data
|
|
@@ -1120,6 +1122,11 @@ const getDocument = () =>{
|
|
|
getCategoryList(newKnowledge.value.dataset_id,'add')
|
|
getCategoryList(newKnowledge.value.dataset_id,'add')
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const getDocumentSelect = () =>{
|
|
|
|
|
+ const row = documentList.value.find(item => item.id === newKnowledge.value.document_id)
|
|
|
|
|
+ doc_form.value = row.doc_form
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const addKnowledgeDocument = ()=> {
|
|
const addKnowledgeDocument = ()=> {
|
|
|
newKnowledge.value.content = ''
|
|
newKnowledge.value.content = ''
|
|
|
newKnowledge.value.answer=''
|
|
newKnowledge.value.answer=''
|
|
@@ -1132,14 +1139,14 @@ const addKnowledgeDocument = ()=> {
|
|
|
}
|
|
}
|
|
|
const addKnowledge = () => {
|
|
const addKnowledge = () => {
|
|
|
|
|
|
|
|
- // if(((chunkType.value=='add'||doc_form.value=='qa_model')&&!newKnowledge.value.answer)||!newKnowledge.value.content||!newKnowledge.value.dataset_id||!newKnowledge.value.document_id){
|
|
|
|
|
- // ElMessage.error('请填入必填项')
|
|
|
|
|
- // return false
|
|
|
|
|
- // }
|
|
|
|
|
- if(!newKnowledge.value.content||!newKnowledge.value.dataset_id||!newKnowledge.value.document_id){
|
|
|
|
|
|
|
+ if((doc_form.value=='qa_model'&&!newKnowledge.value.answer)||!newKnowledge.value.content||!newKnowledge.value.dataset_id||!newKnowledge.value.document_id){
|
|
|
ElMessage.error('请填入必填项')
|
|
ElMessage.error('请填入必填项')
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
|
|
|
+ // if(!newKnowledge.value.content||!newKnowledge.value.dataset_id||!newKnowledge.value.document_id){
|
|
|
|
|
+ // ElMessage.error('请填入必填项')
|
|
|
|
|
+ // return false
|
|
|
|
|
+ // }
|
|
|
if (knowledgeModelLoading.value) return
|
|
if (knowledgeModelLoading.value) return
|
|
|
knowledgeModelLoading.value= true
|
|
knowledgeModelLoading.value= true
|
|
|
if(chunkType.value =='add'){
|
|
if(chunkType.value =='add'){
|