feat: unify creation entry templates

This commit is contained in:
2026-06-03 10:24:03 +08:00
parent b0865cfa19
commit 3f742fbaca
25 changed files with 820 additions and 346 deletions

View File

@@ -222,7 +222,11 @@ import {
type MiniGameDraftGenerationState,
} from '../../services/miniGameDraftGenerationProgress';
import { getPlatformProfileDashboard } from '../../services/platform-entry/platformProfileClient';
import { getUnifiedCreationSpec } from '../unified-creation/unifiedCreationSpecs';
import { UnifiedCreationPage } from '../unified-creation/UnifiedCreationPage';
import {
getUnifiedCreationSpec,
type UnifiedCreationPlayId,
} from '../unified-creation/unifiedCreationSpecs';
import {
buildBabyObjectMatchPublicWorkCode,
buildBarkBattlePublicWorkCode,
@@ -3825,6 +3829,11 @@ export function PlatformEntryFlowShellImpl({
const entries = creationEntryConfig?.creationTypes ?? [];
return new Map(entries.map((entry) => [entry.id, entry]));
}, [creationEntryConfig]);
const getUnifiedSpec = useCallback(
(playId: UnifiedCreationPlayId) =>
getUnifiedCreationSpec(playId, unifiedCreationConfigById.get(playId)),
[unifiedCreationConfigById],
);
const isBigFishCreationVisible = isPlatformCreationTypeVisible(
creationEntryTypes,
'big-fish',
@@ -16614,30 +16623,42 @@ export function PlatformEntryFlowShellImpl({
<LazyPanelFallback label="正在加载 Agent 共创工作区..." />
}
>
{sessionController.agentSession ? (
<CustomWorldAgentWorkspace
session={sessionController.agentSession}
activeOperation={sessionController.agentOperation}
streamingReplyText={sessionController.streamingAgentReplyText}
isStreamingReply={sessionController.isStreamingAgentReply}
onBack={leaveAgentWorkspace}
onSubmitMessage={(payload) => {
void sessionController.submitAgentMessage(payload);
}}
onExecuteAction={(payload) => {
void sessionController.executeAgentAction(payload);
}}
/>
) : (
<div className="flex h-full items-center justify-center">
<div className="platform-subpanel rounded-2xl px-5 py-4 text-sm text-[var(--platform-text-base)]">
{sessionController.isLoadingAgentSession
? '正在准备 Agent 共创工作区...'
: sessionController.agentWorkspaceRestoreError ||
'正在恢复创作工作区...'}
<UnifiedCreationPage
spec={getUnifiedSpec('rpg')}
onBack={leaveAgentWorkspace}
isBackDisabled={
sessionController.isStreamingAgentReply ||
Boolean(sessionController.agentOperation)
}
>
{sessionController.agentSession ? (
<CustomWorldAgentWorkspace
session={sessionController.agentSession}
activeOperation={sessionController.agentOperation}
streamingReplyText={
sessionController.streamingAgentReplyText
}
isStreamingReply={sessionController.isStreamingAgentReply}
onBack={leaveAgentWorkspace}
showBackButton={false}
onSubmitMessage={(payload) => {
void sessionController.submitAgentMessage(payload);
}}
onExecuteAction={(payload) => {
void sessionController.executeAgentAction(payload);
}}
/>
) : (
<div className="flex h-full items-center justify-center">
<div className="platform-subpanel rounded-2xl px-5 py-4 text-sm text-[var(--platform-text-base)]">
{sessionController.isLoadingAgentSession
? '正在准备 Agent 共创工作区...'
: sessionController.agentWorkspaceRestoreError ||
'正在恢复创作工作区...'}
</div>
</div>
</div>
)}
)}
</UnifiedCreationPage>
</Suspense>
</motion.div>
)}
@@ -16655,20 +16676,27 @@ export function PlatformEntryFlowShellImpl({
<LazyPanelFallback label="正在加载大鱼吃小鱼共创工作区..." />
}
>
<BigFishAgentWorkspace
session={bigFishSession}
streamingReplyText={streamingBigFishReplyText}
isStreamingReply={isStreamingBigFishReply}
isBusy={isBigFishBusy || isStreamingBigFishReply}
error={bigFishError}
<UnifiedCreationPage
spec={getUnifiedSpec('big-fish')}
onBack={leaveBigFishFlow}
onSubmitMessage={(payload) => {
void submitBigFishMessage(payload);
}}
onExecuteAction={(payload) => {
void executeBigFishAction(payload);
}}
/>
isBackDisabled={isBigFishBusy || isStreamingBigFishReply}
>
<BigFishAgentWorkspace
session={bigFishSession}
streamingReplyText={streamingBigFishReplyText}
isStreamingReply={isStreamingBigFishReply}
isBusy={isBigFishBusy || isStreamingBigFishReply}
error={bigFishError}
onBack={leaveBigFishFlow}
showBackButton={false}
onSubmitMessage={(payload) => {
void submitBigFishMessage(payload);
}}
onExecuteAction={(payload) => {
void executeBigFishAction(payload);
}}
/>
</UnifiedCreationPage>
</Suspense>
</motion.div>
)}
@@ -16807,10 +16835,7 @@ export function PlatformEntryFlowShellImpl({
>
<UnifiedCreationWorkspace
playId="match3d"
spec={getUnifiedCreationSpec(
'match3d',
unifiedCreationConfigById.get('match3d'),
)}
spec={getUnifiedSpec('match3d')}
session={match3dSession}
isBusy={isStreamingMatch3DReply}
error={match3dError}
@@ -17058,15 +17083,23 @@ export function PlatformEntryFlowShellImpl({
<Suspense
fallback={<LazyPanelFallback label="正在加载宝贝识物创作..." />}
>
<BabyObjectMatchWorkspace
isBusy={isBabyObjectMatchBusy}
error={babyObjectMatchError}
<UnifiedCreationPage
spec={getUnifiedSpec('baby-object-match')}
onBack={leaveBabyObjectMatchFlow}
initialPayload={babyObjectMatchFormPayload}
onCreateDraft={(payload) => {
void createBabyObjectMatchDraftFromForm(payload);
}}
/>
isBackDisabled={isBabyObjectMatchBusy}
>
<BabyObjectMatchWorkspace
isBusy={isBabyObjectMatchBusy}
error={babyObjectMatchError}
onBack={leaveBabyObjectMatchFlow}
showBackButton={false}
title={null}
initialPayload={babyObjectMatchFormPayload}
onCreateDraft={(payload) => {
void createBabyObjectMatchDraftFromForm(payload);
}}
/>
</UnifiedCreationPage>
</Suspense>
</motion.div>
)}
@@ -17219,14 +17252,22 @@ export function PlatformEntryFlowShellImpl({
<Suspense
fallback={<LazyPanelFallback label="正在加载汪汪声浪创作..." />}
>
<BarkBattleConfigEditor
isBusy={isBarkBattleBusy}
error={barkBattleError}
<UnifiedCreationPage
spec={getUnifiedSpec('bark-battle')}
onBack={leaveBarkBattleFlow}
onPreview={(payload) => {
void createBarkBattleGeneratingDraft(payload);
}}
/>
isBackDisabled={isBarkBattleBusy}
>
<BarkBattleConfigEditor
isBusy={isBarkBattleBusy}
error={barkBattleError}
onBack={leaveBarkBattleFlow}
showBackButton={false}
title={null}
onPreview={(payload) => {
void createBarkBattleGeneratingDraft(payload);
}}
/>
</UnifiedCreationPage>
</Suspense>
</motion.div>
)}
@@ -17244,20 +17285,27 @@ export function PlatformEntryFlowShellImpl({
<LazyPanelFallback label="正在加载方洞挑战共创工作区..." />
}
>
<SquareHoleAgentWorkspace
session={squareHoleSession}
streamingReplyText={streamingSquareHoleReplyText}
isStreamingReply={isStreamingSquareHoleReply}
isBusy={isSquareHoleBusy || isStreamingSquareHoleReply}
error={squareHoleError}
<UnifiedCreationPage
spec={getUnifiedSpec('square-hole')}
onBack={leaveSquareHoleFlow}
onSubmitMessage={(payload) => {
void submitSquareHoleMessage(payload);
}}
onExecuteAction={(payload) => {
void executeSquareHoleAction(payload);
}}
/>
isBackDisabled={isSquareHoleBusy || isStreamingSquareHoleReply}
>
<SquareHoleAgentWorkspace
session={squareHoleSession}
streamingReplyText={streamingSquareHoleReplyText}
isStreamingReply={isStreamingSquareHoleReply}
isBusy={isSquareHoleBusy || isStreamingSquareHoleReply}
error={squareHoleError}
onBack={leaveSquareHoleFlow}
showBackButton={false}
onSubmitMessage={(payload) => {
void submitSquareHoleMessage(payload);
}}
onExecuteAction={(payload) => {
void executeSquareHoleAction(payload);
}}
/>
</UnifiedCreationPage>
</Suspense>
</motion.div>
)}
@@ -17462,10 +17510,7 @@ export function PlatformEntryFlowShellImpl({
>
<UnifiedCreationWorkspace
playId="jump-hop"
spec={getUnifiedCreationSpec(
'jump-hop',
unifiedCreationConfigById.get('jump-hop'),
)}
spec={getUnifiedSpec('jump-hop')}
isBusy={isJumpHopBusy}
error={jumpHopError}
onBack={leaveJumpHopFlow}
@@ -17605,10 +17650,7 @@ export function PlatformEntryFlowShellImpl({
>
<UnifiedCreationWorkspace
playId="wooden-fish"
spec={getUnifiedCreationSpec(
'wooden-fish',
unifiedCreationConfigById.get('wooden-fish'),
)}
spec={getUnifiedSpec('wooden-fish')}
isBusy={isWoodenFishBusy}
error={woodenFishError}
onBack={leaveWoodenFishFlow}
@@ -17724,23 +17766,30 @@ export function PlatformEntryFlowShellImpl({
<Suspense
fallback={<LazyPanelFallback label="正在加载智能创作..." />}
>
<CreativeAgentWorkspace
session={creativeAgentSession}
isBusy={isCreativeAgentBusy || isPuzzleBusy}
isStreaming={isCreativeAgentStreaming}
error={creativeAgentError}
eventLog={creativeAgentEvents}
<UnifiedCreationPage
spec={getUnifiedSpec('creative-agent')}
onBack={leaveCreativeAgentWorkspace}
onSubmitMessage={(payload) => {
void submitCreativeAgentMessage(payload);
}}
onConfirmTemplate={(selection) => {
void confirmCreativeTemplateSelection(selection);
}}
onOpenTarget={() => {
void openCreativeAgentTarget();
}}
/>
isBackDisabled={isCreativeAgentBusy || isPuzzleBusy}
>
<CreativeAgentWorkspace
session={creativeAgentSession}
isBusy={isCreativeAgentBusy || isPuzzleBusy}
isStreaming={isCreativeAgentStreaming}
error={creativeAgentError}
eventLog={creativeAgentEvents}
onBack={leaveCreativeAgentWorkspace}
showBackButton={false}
onSubmitMessage={(payload) => {
void submitCreativeAgentMessage(payload);
}}
onConfirmTemplate={(selection) => {
void confirmCreativeTemplateSelection(selection);
}}
onOpenTarget={() => {
void openCreativeAgentTarget();
}}
/>
</UnifiedCreationPage>
</Suspense>
</motion.div>
)}
@@ -17758,10 +17807,7 @@ export function PlatformEntryFlowShellImpl({
>
<UnifiedCreationWorkspace
playId="puzzle"
spec={getUnifiedCreationSpec(
'puzzle',
unifiedCreationConfigById.get('puzzle'),
)}
spec={getUnifiedSpec('puzzle')}
session={puzzleSession}
isBusy={isStreamingPuzzleReply}
error={puzzleError}
@@ -17895,16 +17941,24 @@ export function PlatformEntryFlowShellImpl({
<Suspense
fallback={<LazyPanelFallback label="正在加载视觉小说创作..." />}
>
<VisualNovelAgentWorkspace
session={visualNovelSession}
isBusy={isVisualNovelBusy || isVisualNovelStreamingReply}
error={visualNovelError}
<UnifiedCreationPage
spec={getUnifiedSpec('visual-novel')}
onBack={leaveVisualNovelFlow}
initialFormPayload={visualNovelFormDraftPayload}
onCreateFromForm={(payload) => {
void createVisualNovelDraftFromForm(payload);
}}
/>
isBackDisabled={isVisualNovelBusy || isVisualNovelStreamingReply}
>
<VisualNovelAgentWorkspace
session={visualNovelSession}
isBusy={isVisualNovelBusy || isVisualNovelStreamingReply}
error={visualNovelError}
onBack={leaveVisualNovelFlow}
showBackButton={false}
title={null}
initialFormPayload={visualNovelFormDraftPayload}
onCreateFromForm={(payload) => {
void createVisualNovelDraftFromForm(payload);
}}
/>
</UnifiedCreationPage>
</Suspense>
</motion.div>
)}