fix: preserve rpg custom world detail profiles
This commit is contained in:
@@ -5,6 +5,7 @@ import type { CustomWorldAgentSessionSnapshot } from '../../../packages/shared/s
|
||||
import type { CustomWorldRuntimeLaunchOptions } from '../platform-entry/platformEntryTypes';
|
||||
import { rpgCreationPreviewAdapter } from '../../services/rpg-creation/rpgCreationPreviewAdapter';
|
||||
import type { CustomWorldProfile } from '../../types';
|
||||
import { chooseMoreCompleteCustomWorldProfile } from './rpgProfileCompleteness';
|
||||
|
||||
type UseRpgCreationEnterWorldParams = {
|
||||
isAgentDraftResultView: boolean;
|
||||
@@ -82,9 +83,10 @@ export function useRpgCreationEnterWorld(
|
||||
|
||||
if (currentAgentSessionStage === 'published') {
|
||||
const latestView = await syncAgentCreationResultView(activeAgentSessionId);
|
||||
const publishedProfile =
|
||||
rpgCreationPreviewAdapter.buildPreviewFromResultView(latestView) ??
|
||||
generatedCustomWorldProfile;
|
||||
const publishedProfile = chooseMoreCompleteCustomWorldProfile(
|
||||
generatedCustomWorldProfile,
|
||||
rpgCreationPreviewAdapter.buildPreviewFromResultView(latestView),
|
||||
);
|
||||
// 中文注释:已发布会话的“进入世界”只读取后端结果页真相,
|
||||
// 不能再同步草稿或重复发送 publish_world,否则会被发布阶段门槛拒绝。
|
||||
setGeneratedCustomWorldProfile(publishedProfile);
|
||||
@@ -110,17 +112,18 @@ export function useRpgCreationEnterWorld(
|
||||
|
||||
if (canEnterPublishedWorld) {
|
||||
const latestView = await syncAgentCreationResultView(activeAgentSessionId);
|
||||
return (
|
||||
rpgCreationPreviewAdapter.buildPreviewFromResultView(latestView) ??
|
||||
latestProfile
|
||||
return chooseMoreCompleteCustomWorldProfile(
|
||||
latestProfile,
|
||||
rpgCreationPreviewAdapter.buildPreviewFromResultView(latestView),
|
||||
);
|
||||
}
|
||||
|
||||
await executePublishWorld();
|
||||
const latestView = await syncAgentCreationResultView(activeAgentSessionId);
|
||||
const publishedProfile =
|
||||
rpgCreationPreviewAdapter.buildPreviewFromResultView(latestView) ??
|
||||
latestProfile;
|
||||
const publishedProfile = chooseMoreCompleteCustomWorldProfile(
|
||||
latestProfile,
|
||||
rpgCreationPreviewAdapter.buildPreviewFromResultView(latestView),
|
||||
);
|
||||
|
||||
setGeneratedCustomWorldProfile(publishedProfile);
|
||||
return publishedProfile;
|
||||
|
||||
Reference in New Issue
Block a user