This commit is contained in:
2026-04-21 18:27:46 +08:00
parent 04bff9617d
commit 4372ab5be1
358 changed files with 30788 additions and 14737 deletions

View File

@@ -4,8 +4,9 @@ import path from 'node:path';
import sharp from 'sharp';
import { createDatabase } from '../db.js';
import { RuntimeRepository } from '../repositories/runtimeRepository.js';
import { loadConfig } from '../config.js';
import { RpgAgentSessionRepository } from '../repositories/RpgAgentSessionRepository.js';
import { RpgWorldProfileRepository } from '../repositories/RpgWorldProfileRepository.js';
import { CustomWorldAgentSessionStore } from '../services/customWorldAgentSessionStore.js';
type RecordValue = Record<string, unknown>;
@@ -80,15 +81,18 @@ async function main() {
const db = await createDatabase(config);
try {
const runtimeRepository = new RuntimeRepository(db);
const sessionStore = new CustomWorldAgentSessionStore(runtimeRepository);
const rpgAgentSessionRepository = new RpgAgentSessionRepository(db);
const rpgWorldProfileRepository = new RpgWorldProfileRepository(db);
const sessionStore = new CustomWorldAgentSessionStore(
rpgAgentSessionRepository,
);
const session = await sessionStore.getSnapshot(userId, sessionId);
if (!session || !isRecord(session.draftProfile)) {
throw new Error('未找到目标世界草稿 session无法同步历史保存档案。');
}
const savedProfileEntry = (
await runtimeRepository.listCustomWorldProfiles(userId)
await rpgWorldProfileRepository.listOwnProfiles(userId)
).find((entry) => entry.profileId === profileId);
if (!savedProfileEntry) {
throw new Error('未找到目标 saved profile无法同步历史保存档案。');
@@ -200,7 +204,7 @@ async function main() {
nextProfile.landmarks = landmarks;
nextProfile.sceneChapterBlueprints = sceneChapterBlueprints;
const updatedEntry = await runtimeRepository.upsertCustomWorldProfile(
const updatedEntry = await rpgWorldProfileRepository.upsertOwnProfile(
userId,
profileId,
nextProfile,