From ec3d25c55bb4afd0706b510fc2cad8e19f4318f9 Mon Sep 17 00:00:00 2001 From: Sjshi763 Date: Sat, 17 Jan 2026 19:33:32 +0800 Subject: [PATCH] =?UTF-8?q?PersonaForm.vue=20-=20savePersona=20=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E6=B7=BB=E5=8A=A0=E4=BA=86=E7=99=BD=E5=90=8D=E5=8D=95?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/shared/PersonaForm.vue | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/dashboard/src/components/shared/PersonaForm.vue b/dashboard/src/components/shared/PersonaForm.vue index 48f1a0d0e..bfd5caf1b 100644 --- a/dashboard/src/components/shared/PersonaForm.vue +++ b/dashboard/src/components/shared/PersonaForm.vue @@ -378,16 +378,26 @@ export default { } this.saving = true; - try { - const url = this.editingPersona ? '/api/persona/update' : '/api/persona/create'; - const response = await axios.post(url, this.personaForm); - - if (response.data.status === 'ok') { - this.$emit('saved', response.data.message || this.tm('messages.saveSuccess')); - this.closeDialog(); - } else { - this.$emit('error', response.data.message || this.tm('messages.saveError')); + try { + const url = this.editingPersona ? '/api/persona/update' : '/api/persona/create'; + + // 白名单过滤字段 + const allowedFields = ['persona_id', 'system_prompt', 'begin_dialogs', 'tools']; + const filteredData = {}; + allowedFields.forEach(field => { + if (this.personaForm.hasOwnProperty(field)) { + filteredData[field] = this.personaForm[field]; } + }); + + const response = await axios.post(url, filteredData); + + if (response.data.status === 'ok') { + this.$emit('saved', response.data.message || this.tm('messages.saveSuccess')); + this.closeDialog(); + } else { + this.$emit('error', response.data.message || this.tm('messages.saveError')); + } } catch (error) { this.$emit('error', error.response?.data?.message || this.tm('messages.saveError')); } @@ -533,4 +543,4 @@ export default { .v-virtual-scroll { padding-bottom: 16px; } - \ No newline at end of file +