diff --git a/dashboard/src/i18n/locales/en-US/features/persona.json b/dashboard/src/i18n/locales/en-US/features/persona.json index d3e0f5998..4410ae0a2 100644 --- a/dashboard/src/i18n/locales/en-US/features/persona.json +++ b/dashboard/src/i18n/locales/en-US/features/persona.json @@ -88,11 +88,16 @@ "toolsCount": "tools", "skillsCount": "skills", "contextMenu": { - "moveTo": "Move to..." + "moveTo": "Move to...", + "export": "Export" }, "messages": { "moveSuccess": "Persona moved successfully", - "moveError": "Failed to move persona" + "moveError": "Failed to move persona", + "exportSuccess": "Exported successfully", + "exportError": "Export failed", + "importSuccess": "Imported successfully", + "importError": "Import failed" } }, "folder": { diff --git a/dashboard/src/i18n/locales/zh-CN/features/persona.json b/dashboard/src/i18n/locales/zh-CN/features/persona.json index d168f24df..13640f824 100644 --- a/dashboard/src/i18n/locales/zh-CN/features/persona.json +++ b/dashboard/src/i18n/locales/zh-CN/features/persona.json @@ -88,11 +88,16 @@ "toolsCount": "个工具", "skillsCount": "个 Skills", "contextMenu": { - "moveTo": "移动到..." + "moveTo": "移动到...", + "export": "导出" }, "messages": { "moveSuccess": "人格移动成功", - "moveError": "移动人格失败" + "moveError": "移动人格失败", + "exportSuccess": "导出成功", + "exportError": "导出失败", + "importSuccess": "导入成功", + "importError": "导入失败" } }, "folder": { diff --git a/dashboard/src/stores/personaStore.ts b/dashboard/src/stores/personaStore.ts index aa60339f8..4c4387154 100644 --- a/dashboard/src/stores/personaStore.ts +++ b/dashboard/src/stores/personaStore.ts @@ -330,5 +330,29 @@ export const usePersonaStore = defineStore({ }; return findNode(this.folderTree); }, + + /** + * 导入人格数据 + */ + async importPersona(data: Partial): Promise { + const response = await axios.post('/api/persona/create', { + persona_id: data.persona_id, + system_prompt: data.system_prompt, + begin_dialogs: data.begin_dialogs, + tools: data.tools, + skills: data.skills, + folder_id: data.folder_id ?? this.currentFolderId, + sort_order: data.sort_order ?? 0, + }); + + if (response.data.status !== 'ok') { + throw new Error(response.data.message || '导入人格失败'); + } + + // 刷新当前文件夹内容 + await this.refreshCurrentFolder(); + + return response.data.data.persona; + }, } }); diff --git a/dashboard/src/views/persona/PersonaCard.vue b/dashboard/src/views/persona/PersonaCard.vue index 135514bbf..25b6cd94c 100644 --- a/dashboard/src/views/persona/PersonaCard.vue +++ b/dashboard/src/views/persona/PersonaCard.vue @@ -14,12 +14,18 @@ {{ tm('buttons.edit') }} - + {{ tm('persona.contextMenu.moveTo') }} + + + {{ tm('persona.contextMenu.export') }} +