优化了”配置智能体“

This commit is contained in:
CGD
2025-03-25 00:01:13 +08:00
parent a3b3079b63
commit e9348f5512
2 changed files with 24 additions and 25 deletions
+2 -3
View File
@@ -221,7 +221,7 @@ export default {
}); });
}).send(); }).send();
}, },
// 智能体配置 // 配置智能体
updateAgentConfig(agentId, configData, callback) { updateAgentConfig(agentId, configData, callback) {
RequestService.sendRequest() RequestService.sendRequest()
.url(`${getServiceUrl()}/api/v1/user/agent/${agentId}`) .url(`${getServiceUrl()}/api/v1/user/agent/${agentId}`)
@@ -231,8 +231,7 @@ export default {
RequestService.clearRequestTime(); RequestService.clearRequestTime();
callback(res); callback(res);
}) })
.fail((err) => { .fail(() => {
console.error('保存配置失败:', err);
RequestService.reAjaxFun(() => { RequestService.reAjaxFun(() => {
this.updateAgentConfig(agentId, configData, callback); this.updateAgentConfig(agentId, configData, callback);
}); });
+22 -22
View File
@@ -51,10 +51,10 @@
<div class="textarea-box"> <div class="textarea-box">
<el-input type="textarea" rows="5" resize="none" placeholder="请输入内容" <el-input type="textarea" rows="5" resize="none" placeholder="请输入内容"
v-model="form.langCode" maxlength="1000"/> v-model="form.langCode" maxlength="1000"/>
<div class="prompt-bottom"> <div class="prompt-bottom" @click="clearMemory">
<div style="display: flex;gap: 8px;align-items: center;"> <div style="display: flex;gap: 8px;align-items: center;">
<div style="color: #979db1;font-size: 11px;">当前记忆每次对话后重新生成</div> <div style="color: #979db1;font-size: 11px;">当前记忆每次对话后重新生成</div>
<div class="clear-btn" @click="clearMemory"> <div class="clear-btn">
<i class="el-icon-delete-solid" style="font-size: 11px;"/> <i class="el-icon-delete-solid" style="font-size: 11px;"/>
清除 清除
</div> </div>
@@ -139,28 +139,28 @@ export default {
methods: { methods: {
saveConfig() { saveConfig() {
const configData = { const configData = {
agentCode: this.form.agentCode, agentCode: this.form.agentCode,
agentName: this.form.agentName, agentName: this.form.agentName,
asrModelId: this.form.model.asrModelId, asrModelId: this.form.model.asrModelId,
vadModelId: this.form.model.vadModelId, vadModelId: this.form.model.vadModelId,
llmModelId: this.form.model.llmModelId, llmModelId: this.form.model.llmModelId,
ttsModelId: this.form.model.ttsModelId, ttsModelId: this.form.model.ttsModelId,
ttsVoiceId: this.form.ttsVoiceId, ttsVoiceId: this.form.ttsVoiceId,
memModelId: this.form.model.memModelId, memModelId: this.form.model.memModelId,
intentModelId: this.form.model.intentModelId, intentModelId: this.form.model.intentModelId,
systemPrompt: this.form.systemPrompt, systemPrompt: this.form.systemPrompt,
langCode: this.form.langCode, langCode: this.form.langCode,
language: this.form.language, language: this.form.language,
sort: this.form.sort sort: this.form.sort
}; };
import('@/apis/module/user').then(({ default: userApi }) => { import('@/apis/module/user').then(({ default: userApi }) => {
userApi.updateAgentConfig(this.$route.query.agentId, configData, ({data}) => { userApi.updateAgentConfig(this.$route.query.agentId, configData, ({data}) => {
if (data.code === 0) { if (data.code === 0) {
this.$message.success('配置保存成功'); this.$message.success('配置保存成功');
} else { } else {
this.$message.error(data.msg || '配置保存失败'); this.$message.error(data.msg || '配置保存失败');
} }
}); });
}); });
}, },
resetConfig() { resetConfig() {