|
@@ -27,7 +27,7 @@
|
|
<SvgIcon name="czr_tip" color="#FF5454" class="mr-1" />
|
|
<SvgIcon name="czr_tip" color="#FF5454" class="mr-1" />
|
|
有未发布的修改
|
|
有未发布的修改
|
|
</div>
|
|
</div>
|
|
- <CzrButton type="primary" title="发布" />
|
|
|
|
|
|
+ <CzrButton type="primary" title="发布" @click="onPublish" />
|
|
<el-popover
|
|
<el-popover
|
|
:show-arrow="false"
|
|
:show-arrow="false"
|
|
:width="180"
|
|
:width="180"
|
|
@@ -63,7 +63,7 @@
|
|
</div>
|
|
</div>
|
|
</el-popover>
|
|
</el-popover>
|
|
</div>
|
|
</div>
|
|
- <CzrForm class="form">
|
|
|
|
|
|
+ <CzrForm class="form" ref="ref_form">
|
|
<div class="grid h-full flex-1 grid-cols-2 gap-4">
|
|
<div class="grid h-full flex-1 grid-cols-2 gap-4">
|
|
<div class="col-span-1 flex flex-col rounded-lg bg-[#ffffff]">
|
|
<div class="col-span-1 flex flex-col rounded-lg bg-[#ffffff]">
|
|
<div
|
|
<div
|
|
@@ -96,6 +96,7 @@
|
|
placeholder="点击选择模型"
|
|
placeholder="点击选择模型"
|
|
readonly
|
|
readonly
|
|
@click="onModel"
|
|
@click="onModel"
|
|
|
|
+ default-error-msg="请选择模型"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
<div class="__czr-title_2 mt-4">
|
|
<div class="__czr-title_2 mt-4">
|
|
@@ -172,6 +173,7 @@
|
|
v-model:param="state.form.prologue"
|
|
v-model:param="state.form.prologue"
|
|
link="rich"
|
|
link="rich"
|
|
:height="300"
|
|
:height="300"
|
|
|
|
+ default-error-msg="请输入开场白"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
<div class="__czr-title_2 mt-4">
|
|
<div class="__czr-title_2 mt-4">
|
|
@@ -318,14 +320,14 @@
|
|
问题建议
|
|
问题建议
|
|
<div class="ml-auto">
|
|
<div class="ml-auto">
|
|
<el-checkbox-group
|
|
<el-checkbox-group
|
|
- v-model="state.form.adviseType"
|
|
|
|
|
|
+ v-model="state.form.advise.types"
|
|
size="small"
|
|
size="small"
|
|
>
|
|
>
|
|
<el-checkbox-button value="open">
|
|
<el-checkbox-button value="open">
|
|
开启
|
|
开启
|
|
</el-checkbox-button>
|
|
</el-checkbox-button>
|
|
- <template v-if="state.form.adviseType.includes('open')">
|
|
|
|
- <el-checkbox-button value="cus">
|
|
|
|
|
|
+ <template v-if="state.form.advise.types.includes('open')">
|
|
|
|
+ <el-checkbox-button value="tips">
|
|
自定义提示词
|
|
自定义提示词
|
|
</el-checkbox-button>
|
|
</el-checkbox-button>
|
|
<el-checkbox-button value="knowledge">
|
|
<el-checkbox-button value="knowledge">
|
|
@@ -335,17 +337,100 @@
|
|
</el-checkbox-group>
|
|
</el-checkbox-group>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- <div class="mt-4">
|
|
|
|
- <CzrFormColumn
|
|
|
|
- class="__czr-table-form-column"
|
|
|
|
- required
|
|
|
|
- label="模型选择"
|
|
|
|
- :span="24"
|
|
|
|
- v-model:param="state.form.adviseModel"
|
|
|
|
- link="select"
|
|
|
|
- :options="[]"
|
|
|
|
- />
|
|
|
|
- </div>
|
|
|
|
|
|
+ <template v-if="state.form.advise.types.includes('open')">
|
|
|
|
+ <div class="mt-4">
|
|
|
|
+ <CzrFormColumn
|
|
|
|
+ class="__czr-table-form-column"
|
|
|
|
+ required
|
|
|
|
+ label="模型选择"
|
|
|
|
+ :span="24"
|
|
|
|
+ v-model:param="state.form.advise.model.name"
|
|
|
|
+ placeholder="点击选择模型"
|
|
|
|
+ readonly
|
|
|
|
+ @click="onAdviseModel"
|
|
|
|
+ default-error-msg="请选择问题建议模型"
|
|
|
|
+ />
|
|
|
|
+ <div
|
|
|
|
+ class="mt-2 flex h-10 items-center gap-1 rounded-sm bg-[#FFFAEA] px-3.5 text-sm text-[#6F7889]"
|
|
|
|
+ >
|
|
|
|
+ <SvgIcon
|
|
|
|
+ name="czr_tip"
|
|
|
|
+ color="var(--czr-warning-color)"
|
|
|
|
+ />
|
|
|
|
+ 应用每次回复后,根据对话内容提出最多3条问题建议
|
|
|
|
+ </div>
|
|
|
|
+ <template v-if="state.form.advise.types.includes('tips')">
|
|
|
|
+ <div class="mt-2">
|
|
|
|
+ <CzrFormColumn
|
|
|
|
+ class="__czr-table-form-column"
|
|
|
|
+ label-width="0px"
|
|
|
|
+ :span="24"
|
|
|
|
+ v-model:param="state.form.advise.tips"
|
|
|
|
+ type="textarea"
|
|
|
|
+ :rows="4"
|
|
|
|
+ placeholder="问题应该与你最后一轮的回复紧密相关,可以引发进一步的讨论。 问题不要与上文已经提问或者回答过的内容重复。 每句话只包含一个问题,但也可以不是问句而是一句指令。 推荐你有能力回答的问题。"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </div>
|
|
|
|
+ <template
|
|
|
|
+ v-if="state.form.advise.types.includes('knowledge')"
|
|
|
|
+ >
|
|
|
|
+ <div class="__czr-title_2 mt-4">
|
|
|
|
+ 问题建议知识库
|
|
|
|
+ <template v-if="state.form.advise.knowledges.length > 0">
|
|
|
|
+ ({{ state.form.advise.knowledges.length }})
|
|
|
|
+ </template>
|
|
|
|
+ <CzrButton
|
|
|
|
+ type="normal"
|
|
|
|
+ title="新增"
|
|
|
|
+ class="ml-auto"
|
|
|
|
+ @click="onAddAdviseKnowledge"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ <template v-if="state.form.advise.knowledges.length > 0">
|
|
|
|
+ <div
|
|
|
|
+ class="mt-2 flex max-h-42 flex-col gap-2 overflow-y-auto pr-2"
|
|
|
|
+ >
|
|
|
|
+ <template
|
|
|
|
+ v-for="(item, index) in state.form.advise.knowledges"
|
|
|
|
+ >
|
|
|
|
+ <div class="flex items-center gap-1.5">
|
|
|
|
+ <div
|
|
|
|
+ class="flex h-10 flex-1 items-center overflow-hidden rounded-sm bg-[#F6F8FC] px-2.5"
|
|
|
|
+ >
|
|
|
|
+ <img
|
|
|
|
+ src="@/assets/images/knowledge/knowledge-item-icon-2.png"
|
|
|
|
+ class="mr-4 h-6 w-6"
|
|
|
|
+ />
|
|
|
|
+ <div
|
|
|
|
+ class="flex-1 text-sm font-bold text-[#2E3238]"
|
|
|
|
+ v-title
|
|
|
|
+ >
|
|
|
|
+ {{ item.name }}
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <SvgIcon
|
|
|
|
+ class="__hover"
|
|
|
|
+ name="czr_del"
|
|
|
|
+ color="var(--czr-error-color)"
|
|
|
|
+ @click="
|
|
|
|
+ state.form.advise.knowledges.splice(index, 1)
|
|
|
|
+ "
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-else>
|
|
|
|
+ <div
|
|
|
|
+ class="mt-2 flex h-8 items-center justify-center rounded-sm bg-[#F6F8FC] text-xs text-[#A7ADB9]"
|
|
|
|
+ >
|
|
|
|
+ 暂未添加问题建议知识库
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </template>
|
|
|
|
+ </template>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</CzrForm>
|
|
</CzrForm>
|
|
@@ -385,6 +470,7 @@ import knowledgeSelect from './knowledge-select.vue'
|
|
import modelSelect from './model-select.vue'
|
|
import modelSelect from './model-select.vue'
|
|
import { isValue } from '@/utils/czr-util'
|
|
import { isValue } from '@/utils/czr-util'
|
|
import Sortable from 'sortablejs'
|
|
import Sortable from 'sortablejs'
|
|
|
|
+import CzrForm from '@/components/czr-ui/CzrForm.vue'
|
|
|
|
|
|
const DictionaryStore = useDictionaryStore()
|
|
const DictionaryStore = useDictionaryStore()
|
|
const route = useRoute()
|
|
const route = useRoute()
|
|
@@ -394,6 +480,7 @@ const props = defineProps({})
|
|
const { proxy }: any = getCurrentInstance()
|
|
const { proxy }: any = getCurrentInstance()
|
|
const state: any = reactive({
|
|
const state: any = reactive({
|
|
ID: route.params.id,
|
|
ID: route.params.id,
|
|
|
|
+ autoSave: '',
|
|
form: {
|
|
form: {
|
|
tips: '',
|
|
tips: '',
|
|
model: {},
|
|
model: {},
|
|
@@ -410,7 +497,12 @@ const state: any = reactive({
|
|
prologueType: 'three',
|
|
prologueType: 'three',
|
|
method: 1,
|
|
method: 1,
|
|
voicePackage: '',
|
|
voicePackage: '',
|
|
- adviseType: [],
|
|
|
|
|
|
+ advise: {
|
|
|
|
+ types: ['open', 'tips', 'knowledge'],
|
|
|
|
+ model: {},
|
|
|
|
+ tips: '',
|
|
|
|
+ knowledges: [],
|
|
|
|
+ },
|
|
},
|
|
},
|
|
knowledgeSelect: {
|
|
knowledgeSelect: {
|
|
show: false,
|
|
show: false,
|
|
@@ -425,6 +517,7 @@ const state: any = reactive({
|
|
},
|
|
},
|
|
dragRefresh: true,
|
|
dragRefresh: true,
|
|
})
|
|
})
|
|
|
|
+const ref_form = ref()
|
|
const ref_prologue = ref()
|
|
const ref_prologue = ref()
|
|
const ref_prologueBody = ref()
|
|
const ref_prologueBody = ref()
|
|
const initDetail = () => {
|
|
const initDetail = () => {
|
|
@@ -476,6 +569,13 @@ const onAddKnowledge = () => {
|
|
}
|
|
}
|
|
state.knowledgeSelect.show = true
|
|
state.knowledgeSelect.show = true
|
|
}
|
|
}
|
|
|
|
+const onAddAdviseKnowledge = () => {
|
|
|
|
+ state.knowledgeSelect.transfer = {
|
|
|
|
+ ids: state.form.advise.knowledges.map((v) => v.id),
|
|
|
|
+ type: 'advise',
|
|
|
|
+ }
|
|
|
|
+ state.knowledgeSelect.show = true
|
|
|
|
+}
|
|
const onPrologue = (row) => {
|
|
const onPrologue = (row) => {
|
|
if (row) {
|
|
if (row) {
|
|
row.__value = row.value + ''
|
|
row.__value = row.value + ''
|
|
@@ -512,6 +612,11 @@ const getKnowledge = (arr) => {
|
|
state.form.knowledges.push(...arr)
|
|
state.form.knowledges.push(...arr)
|
|
}
|
|
}
|
|
break
|
|
break
|
|
|
|
+ case 'advise':
|
|
|
|
+ {
|
|
|
|
+ state.form.advise.knowledges.push(...arr)
|
|
|
|
+ }
|
|
|
|
+ break
|
|
}
|
|
}
|
|
}
|
|
}
|
|
const getModel = (val) => {
|
|
const getModel = (val) => {
|
|
@@ -521,6 +626,11 @@ const getModel = (val) => {
|
|
state.form.model = val
|
|
state.form.model = val
|
|
}
|
|
}
|
|
break
|
|
break
|
|
|
|
+ case 'advise':
|
|
|
|
+ {
|
|
|
|
+ state.form.advise.model = val
|
|
|
|
+ }
|
|
|
|
+ break
|
|
}
|
|
}
|
|
}
|
|
}
|
|
const onModel = () => {
|
|
const onModel = () => {
|
|
@@ -530,6 +640,32 @@ const onModel = () => {
|
|
}
|
|
}
|
|
state.modelSelect.show = true
|
|
state.modelSelect.show = true
|
|
}
|
|
}
|
|
|
|
+const onAdviseModel = () => {
|
|
|
|
+ state.modelSelect.transfer = {
|
|
|
|
+ type: 'advise',
|
|
|
|
+ id: state.form.advise.model.id,
|
|
|
|
+ }
|
|
|
|
+ state.modelSelect.show = true
|
|
|
|
+}
|
|
|
|
+const onPublish = () => {
|
|
|
|
+ ref_form.value
|
|
|
|
+ .submit()
|
|
|
|
+ .then(() => {
|
|
|
|
+ if (state.form.advise.types.includes('knowledge')) {
|
|
|
|
+ if (state.form.advise.knowledges.length === 0) {
|
|
|
|
+ ElMessage.warning('请添加问题建议知识库!')
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ .catch((e) => {
|
|
|
|
+ ElMessage({
|
|
|
|
+ message: e[0].message,
|
|
|
|
+ grouping: true,
|
|
|
|
+ type: 'warning',
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+}
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
initDictionary()
|
|
initDictionary()
|
|
initDetail()
|
|
initDetail()
|