File size: 1,546 Bytes
36277c7 4ce05b9 36277c7 4ce05b9 36277c7 11e2b39 36277c7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | import { exportDsh } from "../../export/dsh.js";
interface ExportOpts {
from: string;
out: string;
withAttachments?: boolean;
noMaterials?: boolean;
noConversations?: boolean;
}
export async function exportData(opts: ExportOpts): Promise<void> {
if (opts.from !== "dsh") {
console.log(`暂不支持从 "${opts.from}" 导出。当前支持:dsh`);
return;
}
console.log("正在导出 DSH 完整资料(人物设定 + 文件资料 + 对话记录)...\n");
const result = exportDsh({
outDir: opts.out,
withAttachments: opts.withAttachments === true,
withMaterials: opts.noMaterials !== true,
withConversations: opts.noConversations !== true,
});
console.log(` ✅ 人设:${result.personas} 个角色 → persona.md`);
if (result.materialsDirs.length > 0) {
console.log(` ✅ 文件:${result.materialsDirs.length} 个目录,${(result.materialsBytes / 1024 / 1024).toFixed(1)} MB`);
for (const d of result.materialsDirs) console.log(` ${d}`);
}
if (result.conversationFiles > 0) {
console.log(` ✅ 对话记录:${result.conversationFiles} 个会话,${result.conversationLines} 条消息 → conversations/`);
}
if (result.conversationFailures > 0) {
console.log(` ⚠ ${result.conversationFailures} 个会话文件无法读取(已跳过,不影响其他数据)`);
}
console.log(`\n导出完成:${result.outDir}`);
console.log("把这个目录放进任何 AI Agent 的项目里,它就能读取你的人物设定、资料和对话。");
}
|