diff --git a/dashboard/src/i18n/locales/en-US/features/persona.json b/dashboard/src/i18n/locales/en-US/features/persona.json index 44736f449..3ae3f1af0 100644 --- a/dashboard/src/i18n/locales/en-US/features/persona.json +++ b/dashboard/src/i18n/locales/en-US/features/persona.json @@ -80,7 +80,8 @@ "saveError": "Save failed", "deleteConfirm": "Are you sure you want to delete persona \"{id}\"? This action cannot be undone.", "deleteSuccess": "Deleted successfully", - "deleteError": "Delete failed" + "deleteError": "Delete failed", + "importExists": "Persona with ID {id} already exists." }, "persona": { "personasTitle": "Personas", @@ -94,7 +95,8 @@ "moveSuccess": "Persona moved successfully", "moveError": "Failed to move persona", "exportSuccess": "Exported successfully(excluding skills and tools)", - "importSuccess": "Imported successfully" + "importSuccess": "Imported successfully", + "importError": "Failed to import persona" } }, "folder": { diff --git a/dashboard/src/i18n/locales/zh-CN/features/persona.json b/dashboard/src/i18n/locales/zh-CN/features/persona.json index 652aff833..76004f538 100644 --- a/dashboard/src/i18n/locales/zh-CN/features/persona.json +++ b/dashboard/src/i18n/locales/zh-CN/features/persona.json @@ -80,7 +80,8 @@ "saveError": "保存失败", "deleteConfirm": "确定要删除人格 \"{id}\" 吗?此操作不可撤销。", "deleteSuccess": "删除成功", - "deleteError": "删除失败" + "deleteError": "删除失败", + "importExists": "人格 ID {id} 已存在" }, "persona": { "personasTitle": "人格", @@ -94,7 +95,8 @@ "moveSuccess": "人格移动成功", "moveError": "移动人格失败", "exportSuccess": "导出成功(不包含 Skills 和工具)", - "importSuccess": "导入成功" + "importSuccess": "导入成功", + "importError": "导入失败" } }, "folder": { diff --git a/dashboard/src/views/persona/PersonaManager.vue b/dashboard/src/views/persona/PersonaManager.vue index 29d83e633..132069a1c 100644 --- a/dashboard/src/views/persona/PersonaManager.vue +++ b/dashboard/src/views/persona/PersonaManager.vue @@ -569,6 +569,12 @@ export default defineComponent({ throw new Error(this.tm('persona.messages.importMissingFields')); } + // 检查ID是否已存在 + const existingPersonas = this.currentPersonas.map(p => p.persona_id); + if (existingPersonas.includes(importData.persona_id)) { + throw new Error(this.tm('messages.importExists', { id: importData.persona_id })); + } + // 执行导入 await this.importPersona(importData); this.showSuccess(this.tm('persona.messages.importSuccess'));