refactor: 收口视觉小说详情 session 映射

This commit is contained in:
2026-06-04 05:09:49 +08:00
parent 0dc326b79e
commit 20a21ee78b
6 changed files with 183 additions and 24 deletions

View File

@@ -3,6 +3,10 @@ import type { PuzzleAgentSessionSnapshot } from '../../../packages/shared/src/co
import type { PuzzleWorkSummary } from '../../../packages/shared/src/contracts/puzzleWorkSummary';
import type { SquareHoleSessionSnapshot } from '../../../packages/shared/src/contracts/squareHoleAgent';
import type { SquareHoleWorkProfile } from '../../../packages/shared/src/contracts/squareHoleWorks';
import type {
VisualNovelAgentSessionSnapshot,
VisualNovelWorkDetail,
} from '../../../packages/shared/src/contracts/visualNovel';
import type {
WoodenFishSessionSnapshotResponse,
WoodenFishWorkProfileResponse,
@@ -88,6 +92,22 @@ export function buildSquareHoleProfileFromSession(
};
}
export function buildVisualNovelSessionFromWorkDetail(
work: VisualNovelWorkDetail,
): VisualNovelAgentSessionSnapshot {
return {
sessionId: normalizeCreationUrlValue(work.sourceSessionId) ?? work.workId,
ownerUserId: work.summary.ownerUserId,
sourceMode: work.draft.sourceMode,
status: 'ready',
messages: [],
draft: work.draft,
pendingAction: null,
createdAt: work.createdAt,
updatedAt: work.summary.updatedAt,
};
}
export function buildJumpHopPendingSession(
item: JumpHopWorkSummaryResponse,
): JumpHopSessionSnapshotResponse {