|
@@ -34,6 +34,7 @@
|
|
|
v-model="form.concurrentNum"
|
|
v-model="form.concurrentNum"
|
|
|
placeholder="请输入并发数"
|
|
placeholder="请输入并发数"
|
|
|
@input="handleConcurrentNumInput"
|
|
@input="handleConcurrentNumInput"
|
|
|
|
|
+ :disabled="true"
|
|
|
/>
|
|
/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
|
@@ -50,6 +51,7 @@
|
|
|
v-if="field.type === 'input'"
|
|
v-if="field.type === 'input'"
|
|
|
v-model="form.accountJson[field.name]"
|
|
v-model="form.accountJson[field.name]"
|
|
|
:placeholder="'请输入' + field.label"
|
|
:placeholder="'请输入' + field.label"
|
|
|
|
|
+ :disabled="!!field.disableProp"
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
|
<!-- 文本域 -->
|
|
<!-- 文本域 -->
|
|
@@ -59,6 +61,7 @@
|
|
|
type="textarea"
|
|
type="textarea"
|
|
|
:rows="field.rows || 3"
|
|
:rows="field.rows || 3"
|
|
|
:placeholder="'请输入' + field.label"
|
|
:placeholder="'请输入' + field.label"
|
|
|
|
|
+ :disabled="!!field.disableProp"
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
|
<!-- 下拉框 -->
|
|
<!-- 下拉框 -->
|
|
@@ -70,6 +73,7 @@
|
|
|
@change="(val) => handleSelectChange(field.name, val)"
|
|
@change="(val) => handleSelectChange(field.name, val)"
|
|
|
filterable
|
|
filterable
|
|
|
clearable
|
|
clearable
|
|
|
|
|
+ :disabled="!!field.disableProp"
|
|
|
>
|
|
>
|
|
|
<el-option
|
|
<el-option
|
|
|
v-for="option in field.options"
|
|
v-for="option in field.options"
|
|
@@ -86,6 +90,7 @@
|
|
|
type="textarea"
|
|
type="textarea"
|
|
|
:rows="30"
|
|
:rows="30"
|
|
|
:placeholder="'请输入' + field.label"
|
|
:placeholder="'请输入' + field.label"
|
|
|
|
|
+ :disabled="!!field.disableProp"
|
|
|
/>
|
|
/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
|
@@ -197,7 +202,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
-import { add, update } from '@/api/company/aiModel' // 假设有 update 接口
|
|
|
|
|
|
|
+import { add, update, getCidConfig } from '@/api/company/aiModel' // 假设有 update 接口
|
|
|
import { all } from '@/api/company/aiCall'
|
|
import { all } from '@/api/company/aiCall'
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
@@ -234,28 +239,69 @@ export default {
|
|
|
// 动态字段配置
|
|
// 动态字段配置
|
|
|
dynamicFields: [],
|
|
dynamicFields: [],
|
|
|
// 是否显示客户意向提示词
|
|
// 是否显示客户意向提示词
|
|
|
- showIntentionTips: false
|
|
|
|
|
|
|
+ showIntentionTips: false,
|
|
|
|
|
+ cidConf:{}
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
|
// 表单验证规则
|
|
// 表单验证规则
|
|
|
rules() {
|
|
rules() {
|
|
|
- return {
|
|
|
|
|
|
|
+ const baseRules = {
|
|
|
name: [
|
|
name: [
|
|
|
- { required: true, message: '请输入账户名称', trigger: 'blur' }
|
|
|
|
|
|
|
+ { required: true, message: '请输入模型名称', trigger: 'blur' }
|
|
|
],
|
|
],
|
|
|
providerClassName: [
|
|
providerClassName: [
|
|
|
{ required: true, message: '请选择实现类', trigger: 'change' }
|
|
{ required: true, message: '请选择实现类', trigger: 'change' }
|
|
|
],
|
|
],
|
|
|
concurrentNum: [
|
|
concurrentNum: [
|
|
|
- { required: true, message: '请输入并发数', trigger: 'blur' },
|
|
|
|
|
|
|
+ { required: true, message: '请输入模型并发数', trigger: 'blur' },
|
|
|
{ pattern: /^\d+$/, message: '请输入数字', trigger: 'blur' },
|
|
{ pattern: /^\d+$/, message: '请输入数字', trigger: 'blur' },
|
|
|
{ validator: this.validateConcurrentNum, trigger: 'blur' }
|
|
{ validator: this.validateConcurrentNum, trigger: 'blur' }
|
|
|
],
|
|
],
|
|
|
transferManualDigit: [
|
|
transferManualDigit: [
|
|
|
{ pattern: /^[0-9]?$/, message: '请输入单个数字0-9', trigger: 'blur' }
|
|
{ pattern: /^[0-9]?$/, message: '请输入单个数字0-9', trigger: 'blur' }
|
|
|
|
|
+ ],
|
|
|
|
|
+ interruptFlag: [
|
|
|
|
|
+ { required: true, message: '请选择打断开关', trigger: 'change' }
|
|
|
|
|
+ ]
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 动态字段验证规则
|
|
|
|
|
+ this.dynamicFields.forEach(field => {
|
|
|
|
|
+ if (field.required) {
|
|
|
|
|
+ const prop = 'accountJson.' + field.name
|
|
|
|
|
+ const isSelect = field.type === 'select'
|
|
|
|
|
+ baseRules[prop] = [
|
|
|
|
|
+ {
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ message: isSelect ? `请选择${field.label}` : `请输入${field.label}`,
|
|
|
|
|
+ trigger: isSelect ? 'change' : 'blur'
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ // Coze OAuth 相关字段验证
|
|
|
|
|
+ if (this.form.accountJson.tokenType === 'oauth') {
|
|
|
|
|
+ baseRules['accountJson.oauthClientId'] = [
|
|
|
|
|
+ { required: true, message: '请输入Client ID', trigger: 'blur' }
|
|
|
|
|
+ ]
|
|
|
|
|
+ baseRules['accountJson.oauthPrivateKey'] = [
|
|
|
|
|
+ { required: true, message: '请输入Private Key', trigger: 'blur' }
|
|
|
|
|
+ ]
|
|
|
|
|
+ baseRules['accountJson.oauthPublicKeyId'] = [
|
|
|
|
|
+ { required: true, message: '请输入Public Key ID', trigger: 'blur' }
|
|
|
|
|
+ ]
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // Coze PAT Token 验证
|
|
|
|
|
+ if (this.form.accountJson.tokenType === 'pat') {
|
|
|
|
|
+ baseRules['accountJson.patToken'] = [
|
|
|
|
|
+ { required: true, message: '请输入PAT Token', trigger: 'blur' }
|
|
|
]
|
|
]
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ return baseRules
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
watch: {
|
|
watch: {
|
|
@@ -283,9 +329,16 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
|
- this.loadKbCatOptions()
|
|
|
|
|
|
|
+ this.loadKbCatOptions();
|
|
|
|
|
+ this.initCidConfData();
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ initCidConfData(){
|
|
|
|
|
+ getCidConfig().then(res=>{
|
|
|
|
|
+ console.log(JSON.parse(res.data));
|
|
|
|
|
+ this.cidConf = JSON.parse(res.data);
|
|
|
|
|
+ }).catch(res=>{})
|
|
|
|
|
+ },
|
|
|
// 初始化表单数据
|
|
// 初始化表单数据
|
|
|
initFormData(data) {
|
|
initFormData(data) {
|
|
|
this.form.id = data.id
|
|
this.form.id = data.id
|
|
@@ -297,7 +350,6 @@ export default {
|
|
|
this.form.interruptIgnoreKeywords = data.interruptIgnoreKeywords || ''
|
|
this.form.interruptIgnoreKeywords = data.interruptIgnoreKeywords || ''
|
|
|
this.form.transferManualDigit = data.transferManualDigit || ''
|
|
this.form.transferManualDigit = data.transferManualDigit || ''
|
|
|
this.form.intentionTips = data.intentionTips || ''
|
|
this.form.intentionTips = data.intentionTips || ''
|
|
|
-
|
|
|
|
|
// 解析accountJson
|
|
// 解析accountJson
|
|
|
try {
|
|
try {
|
|
|
this.form.accountJson = data.accountJson ?
|
|
this.form.accountJson = data.accountJson ?
|
|
@@ -310,7 +362,7 @@ export default {
|
|
|
|
|
|
|
|
// 根据providerClassName更新动态字段
|
|
// 根据providerClassName更新动态字段
|
|
|
if (this.form.providerClassName) {
|
|
if (this.form.providerClassName) {
|
|
|
- this.updateDynamicFields(this.form.providerClassName)
|
|
|
|
|
|
|
+ this.updateDynamicFields(this.form.providerClassName,true)
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
|
|
@@ -349,7 +401,7 @@ export default {
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
// 更新动态字段
|
|
// 更新动态字段
|
|
|
- updateDynamicFields(providerClassName) {
|
|
|
|
|
|
|
+ updateDynamicFields(providerClassName,isUpdate) {
|
|
|
this.dynamicFields = []
|
|
this.dynamicFields = []
|
|
|
this.showIntentionTips = false
|
|
this.showIntentionTips = false
|
|
|
|
|
|
|
@@ -358,9 +410,9 @@ export default {
|
|
|
|
|
|
|
|
if (['DeepSeekChat', 'ChatGpt4o', 'JiutianChat'].includes(providerClassName)) {
|
|
if (['DeepSeekChat', 'ChatGpt4o', 'JiutianChat'].includes(providerClassName)) {
|
|
|
this.dynamicFields = [
|
|
this.dynamicFields = [
|
|
|
- { name: 'serverUrl', label: '服务地址', type: 'input', required: true },
|
|
|
|
|
- { name: 'apiKey', label: 'apiKey', type: 'input', required: true },
|
|
|
|
|
- { name: 'modelName', label: '模型名称', type: 'input', required: true },
|
|
|
|
|
|
|
+ { name: 'serverUrl', label: '服务地址', type: 'input', required: true, disableProp:true },
|
|
|
|
|
+ { name: 'apiKey', label: 'apiKey', type: 'input', required: true, disableProp:true },
|
|
|
|
|
+ { name: 'modelName', label: '模型名称', type: 'input', required: true, disableProp:true },
|
|
|
{ name: 'llmTips', label: '大模型提示词', type: 'large-textarea', required: true },
|
|
{ name: 'llmTips', label: '大模型提示词', type: 'large-textarea', required: true },
|
|
|
{ name: 'faqContext', label: 'FAQ上下文', type: 'large-textarea', required: true },
|
|
{ name: 'faqContext', label: 'FAQ上下文', type: 'large-textarea', required: true },
|
|
|
{ name: 'kbCatId', label: '知识库分类', type: 'select', required: false, options: this.kbCatOptions },
|
|
{ name: 'kbCatId', label: '知识库分类', type: 'select', required: false, options: this.kbCatOptions },
|
|
@@ -448,6 +500,26 @@ export default {
|
|
|
this.form.accountJson = {
|
|
this.form.accountJson = {
|
|
|
...newAccountJson,
|
|
...newAccountJson,
|
|
|
...this.form.accountJson
|
|
...this.form.accountJson
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //默认跟上配置值
|
|
|
|
|
+ if('DeepSeekChat' === providerClassName && !!this.cidConf && !!!isUpdate){
|
|
|
|
|
+ this.$set(this.form.accountJson,"serverUrl",this.cidConf.serverAddress);
|
|
|
|
|
+ this.$set(this.form.accountJson,"apiKey",this.cidConf.apiKey);
|
|
|
|
|
+ this.$set(this.form.accountJson,"modelName",this.cidConf.modelName);
|
|
|
|
|
+ this.$set(this.form,"concurrentNum",this.cidConf.concurrency);
|
|
|
|
|
+ this.dynamicFields = [
|
|
|
|
|
+ { name: 'serverUrl', label: '服务地址', type: 'input', required: true, disableProp:true },
|
|
|
|
|
+ { name: 'apiKey', label: 'apiKey', type: 'input', required: true, disableProp:true },
|
|
|
|
|
+ { name: 'modelName', label: '模型名称', type: 'input', required: true, disableProp:true },
|
|
|
|
|
+ { name: 'llmTips', label: '大模型提示词', type: 'large-textarea', required: true },
|
|
|
|
|
+ { name: 'faqContext', label: 'FAQ上下文', type: 'large-textarea', required: true },
|
|
|
|
|
+ { name: 'kbCatId', label: '知识库分类', type: 'select', required: false, options: this.kbCatOptions },
|
|
|
|
|
+ { name: 'transferToAgentTips', label: '转人工提示词', type: 'textarea', rows: 3, required: true },
|
|
|
|
|
+ { name: 'hangupTips', label: '挂机提示', type: 'textarea', rows: 3, required: true },
|
|
|
|
|
+ { name: 'customerNoVoiceTips', label: '客户不说话提示', type: 'textarea', rows: 3, required: true },
|
|
|
|
|
+ { name: 'openingRemarks', label: '开场白', type: 'textarea', rows: 3, required: true }
|
|
|
|
|
+ ]
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
|