抽出策划视图共用的 Design 模式判据与回调兜底
- apps/ai-game-creator-shell/src/view/project-development/planning/PlanningChatView.tsx 新增 designMode、designActionsBusy 与三个 Design 回调兜底常量 - DesignAgentPhaseStatus(顶部)与 DesignAgentPendingActions(底部)原先各自重复 designView||onDesignApprove、controlBusy||planGddDecisionBusy 和 ?? (()=>undefined),现在共用同一份取值
This commit is contained in:
+16
-10
@@ -206,6 +206,12 @@ export function PlanningChatView({
|
||||
needsUserInput ||
|
||||
Boolean(designView?.session.pendingApproval) ||
|
||||
Boolean(designView?.session.pendingClarification);
|
||||
// 顶部状态条与底部待办区渲染的是同一份 Design Agent 状态,判据与回调兜底必须同源。
|
||||
const designMode = Boolean(designView || onDesignApprove);
|
||||
const designActionsBusy = controlBusy || planGddDecisionBusy;
|
||||
const handleDesignApprove = onDesignApprove ?? (() => undefined);
|
||||
const handleDesignClarify = onDesignClarify ?? (() => undefined);
|
||||
const handleDesignRetry = onDesignRetry ?? (() => undefined);
|
||||
|
||||
const renderMessage = (message: ChatMessage, index: number) => (
|
||||
<div
|
||||
@@ -239,14 +245,14 @@ export function PlanningChatView({
|
||||
return (
|
||||
<section className="project-chat-surface" aria-label="立项策划对话">
|
||||
<div className="project-chat-conversation">
|
||||
{designView || onDesignApprove ? (
|
||||
{designMode ? (
|
||||
<DesignAgentPhaseStatus
|
||||
view={designView}
|
||||
busy={controlBusy || planGddDecisionBusy}
|
||||
busy={designActionsBusy}
|
||||
error={planGddError}
|
||||
onApprove={onDesignApprove ?? (() => undefined)}
|
||||
onClarify={onDesignClarify ?? (() => undefined)}
|
||||
onRetry={onDesignRetry ?? (() => undefined)}
|
||||
onApprove={handleDesignApprove}
|
||||
onClarify={handleDesignClarify}
|
||||
onRetry={handleDesignRetry}
|
||||
/>
|
||||
) : (
|
||||
<PlanGddSurface
|
||||
@@ -378,14 +384,14 @@ export function PlanningChatView({
|
||||
</button>
|
||||
</div>
|
||||
) : null}
|
||||
{designView || onDesignApprove ? (
|
||||
{designMode ? (
|
||||
<DesignAgentPendingActions
|
||||
view={designView}
|
||||
busy={controlBusy || planGddDecisionBusy}
|
||||
busy={designActionsBusy}
|
||||
error={planGddError}
|
||||
onApprove={onDesignApprove ?? (() => undefined)}
|
||||
onClarify={onDesignClarify ?? (() => undefined)}
|
||||
onRetry={onDesignRetry ?? (() => undefined)}
|
||||
onApprove={handleDesignApprove}
|
||||
onClarify={handleDesignClarify}
|
||||
onRetry={handleDesignRetry}
|
||||
/>
|
||||
) : null}
|
||||
<form className="project-chat-composer" onSubmit={onSubmit}>
|
||||
|
||||
Reference in New Issue
Block a user