fix: sync canvas placeholder with chat loading

This commit is contained in:
134 2026-06-22 11:02:41 +08:00
parent ef89ab1aeb
commit 072fac14cc

View File

@ -8371,8 +8371,35 @@ export function CanvasChatPanel({
streamImageGenerationState?.sameModelRunningCount;
const loadingConcurrencyLimit = streamImageGenerationState?.concurrencyLimit;
const loadingEstimatedWaitMs = streamImageGenerationState?.estimatedWaitMs;
const canvasGenerationPlaceholderState =
useMemo<ImageGenerationStatusStreamPayload | null>(() => {
if (!shouldShowImageLoading) return null;
if (streamImageGenerationState) return streamImageGenerationState;
return {
phase: loadingPhase,
providerType: loadingProviderType,
modelName: loadingModelName,
imageCount: loadingImageCount,
queuePosition: loadingQueuePosition,
sameModelRunningCount: loadingSameModelRunningCount,
concurrencyLimit: loadingConcurrencyLimit,
estimatedWaitMs: loadingEstimatedWaitMs,
};
}, [
loadingConcurrencyLimit,
loadingEstimatedWaitMs,
loadingImageCount,
loadingModelName,
loadingPhase,
loadingProviderType,
loadingQueuePosition,
loadingSameModelRunningCount,
shouldShowImageLoading,
streamImageGenerationState,
]);
useEffect(() => {
const streamState = streamImageGenerationStateByChatId[activeChatId] || null;
const streamState = canvasGenerationPlaceholderState;
const placeholderId = canvasGenerationPlaceholderByChatIdRef.current[activeChatId];
if (!streamState) {
@ -8504,10 +8531,10 @@ export function CanvasChatPanel({
currentModel?.displayName,
currentModel?.providerType,
imageParams,
canvasGenerationPlaceholderState,
focusCanvasOnNode,
removeCanvasGenerationPlaceholders,
selectNodes,
streamImageGenerationStateByChatId,
updateNode,
]);
const renderableVisibleMessages = useMemo(() => {