From 4d7bec0dd77b49d08ca25dbdb76b5bdd3b315dc8 Mon Sep 17 00:00:00 2001 From: Stringadmin Date: Tue, 9 Jun 2026 12:07:08 +0800 Subject: [PATCH] chore: trim large-page lint warnings --- src/features/canvas/CanvasPage.tsx | 46 ++--------------------- src/features/workbench/WorkbenchPage.tsx | 48 +++--------------------- 2 files changed, 8 insertions(+), 86 deletions(-) diff --git a/src/features/canvas/CanvasPage.tsx b/src/features/canvas/CanvasPage.tsx index 0e699ba..c424ba6 100644 --- a/src/features/canvas/CanvasPage.tsx +++ b/src/features/canvas/CanvasPage.tsx @@ -12,15 +12,11 @@ FileImageOutlined, FileTextOutlined, FolderOpenOutlined, - MutedOutlined, - PauseCircleOutlined, PictureOutlined, - PlayCircleOutlined, ReloadOutlined, SaveOutlined, SearchOutlined, SendOutlined, - SoundOutlined, ThunderboltOutlined, UploadOutlined, VideoCameraOutlined, @@ -37,10 +33,7 @@ import { communityClient } from "../../api/communityClient"; import { modelCapabilitiesClient } from "../../api/modelCapabilitiesClient"; import type { CreatePreviewTaskInput } from "../../api/webGenerationGateway"; import WorkspacePageShell from "../../components/WorkspacePageShell"; -import type { - WebCanvasWorkflow, - WebCanvasWorkflowNodePackage, -} from "../../types"; +import type { WebCanvasWorkflow } from "../../types"; import type { AssetLibraryCategory } from "../assets/localAssetStore"; import { buildCanvasCommunityCaseInput, @@ -64,7 +57,6 @@ import { ENTERPRISE_VIDEO_MODEL_OPTIONS } from "../../utils/enterpriseVideoPolic import { filterImageModelOptionsForSession } from "../../utils/imageModelVisibility"; import { translateTaskError } from "../../utils/translateTaskError"; import type { - CanvasAlignGuide, CanvasAssetSaveSource, CanvasCopiedNode, CanvasConnectorDrag, @@ -72,37 +64,25 @@ import type { CanvasFloatingMenuPosition, CanvasImageFocusDrag, CanvasImageFocusSelection, - CanvasImageGenerationState, CanvasImageNode, - CanvasImageNodeDrag, CanvasImageReferenceItem, CanvasManualLink, CanvasNodeBounds, CanvasNodeKind, CanvasNodePackage, - CanvasNodePackageDrag, CanvasNodePort, - CanvasNodeResizeDrag, CanvasNodeSize, CanvasOption, CanvasPageProps, - CanvasPanDrag, CanvasPoint, CanvasProjectSaveState, CanvasSelectedNode, - CanvasSelectionDrag, CanvasStyleCase, CanvasStylePickerTab, - CanvasStyleReference, - CanvasTextGenerationState, CanvasPromptMentionOption, CanvasPromptMentionState, CanvasTextNode, - CanvasTextNodeDrag, - CanvasVideoGenerationState, - CanvasVideoMode, CanvasVideoNode, - CanvasVideoNodeDrag, CanvasViewport, } from "./canvasTypes"; import { @@ -110,7 +90,6 @@ import { canvasAutoSaveDebounceMs, canvasAutoSaveIdleTimeoutMs, canvasNodeClickMoveThreshold, - canvasNodeDefaultSizes, canvasStylePickerCategories, canvasStylePickerTabs, connectorAnchorOutset, @@ -120,22 +99,17 @@ import { defaultImageModel, defaultTextModelId, defaultVideoModel, - image4kCapableModels, imageFocusRatioOptions, imageModelOptions as fallbackCanvasImageModelOptions, imageRatioOptions, - textModelOptions, videoDurationOptions, videoRatioOptions, } from "./canvasConstants"; import { applyImageFocusRatioFromTopLeft, blobToDataUrl, - buildCanvasStyleKeywords, buildCopyTitle, clampCanvasPercent, - buildReversePromptFromAsset, - canvasGenerationProgressStyle, clampCanvasNodeSize, clampCanvasViewportZoom, communityCaseToCanvasStyleCase, @@ -150,15 +124,8 @@ import { getDefaultImageQuality, getDefaultVideoQuality, getImageQualityOptions, - getOptionLabel, getVideoQualityOptions, - getWorkflowImageNodeFileName, - getWorkflowImageNodePrompt, - getWorkflowNodeFocusSelection, - getWorkflowNodeMetadataString, - getWorkflowNodeStyleReference, hasCanvasOptionValue, - moveCanvasNodesForPackageDrag, normalizeCanvasGenerationProgress, normalizeCanvasLinkPorts, normalizeCanvasSelectionRect, @@ -166,10 +133,6 @@ import { positionFloatingMenu, resolveImageQuality, resolveVideoQuality, - resolveWorkflowImageModel, - resolveWorkflowRatio, - resolveWorkflowVideoMode, - resolveWorkflowVideoModel, waitForImageTaskResult, waitForVideoTaskResult, } from "./canvasUtils"; @@ -181,11 +144,9 @@ import { createVideoNodesFromWorkflow, createWorkflowPackagesFromCanvasPackages, formatCanvasProjectUpdatedAt, - formatCanvasVideoTime, resolveAssetCategory, } from "./canvasWorkflowDeserialize"; import { CanvasNodeToolbar, CanvasNodeVideoPlayer, CanvasSelectChip } from "./canvasComponents"; -import type { CanvasNodeToolbarAction } from "./canvasComponents"; import { CanvasMarkingPopover } from "./CanvasMarkingPopover"; import { CanvasPromptMentionTextarea, CanvasTextPromptComposer } from "./CanvasTextPromptComposer"; import { CanvasMultiGridPanel, CanvasUpscalePanel, CanvasInpaintPanel } from "./canvasToolPanels"; @@ -396,7 +357,6 @@ function CanvasPage({ const canvasUploadInputRef = useRef(null); const imageNodeInputRef = useRef(null); const canvasRef = useRef(null); - const canvasReferenceUploadPromisesRef = useRef(new Map>()); const canvasDragCounterRef = useRef(0); const [isCanvasDragging, setIsCanvasDragging] = useState(false); const suppressNextPaneClickRef = useRef(false); @@ -412,7 +372,7 @@ function CanvasPage({ const imageNodeIdRef = useRef(1); const videoNodeIdRef = useRef(1); - const { pushSnapshot, undo, redo, canUndo, canRedo } = useCanvasHistory(); + const { pushSnapshot, undo, redo } = useCanvasHistory(); const { textGenerationState, imageGenerationState, videoGenerationState, generationToast, setGenerationToast, @@ -1892,7 +1852,7 @@ function CanvasPage({ if (videoNode.videoMode === "img2video" && referenceUrls.length === 0) { throw new Error("图生视频需要先连接至少一个可用的图片节点"); } - let requestModel = resolveVideoRequestModel({ model, referenceUrls }); + const requestModel = resolveVideoRequestModel({ model, referenceUrls }); task = await onCreateTask({ title: videoNode.title || "视频节点生成", type: "video", diff --git a/src/features/workbench/WorkbenchPage.tsx b/src/features/workbench/WorkbenchPage.tsx index 65cbfb4..a7c5967 100644 --- a/src/features/workbench/WorkbenchPage.tsx +++ b/src/features/workbench/WorkbenchPage.tsx @@ -2,24 +2,18 @@ import { AppstoreOutlined, ArrowDownOutlined, ArrowUpOutlined, - CaretRightOutlined, ClockCircleOutlined, CloseOutlined, CopyOutlined, DeleteOutlined, - DownloadOutlined, - FullscreenOutlined, LoadingOutlined, MessageOutlined, - MutedOutlined, PictureOutlined, - PauseOutlined, PlusOutlined, ReloadOutlined, SendOutlined, SettingOutlined, StopOutlined, - ThunderboltOutlined, VideoCameraOutlined, } from "@ant-design/icons"; import { @@ -35,10 +29,10 @@ import { type SyntheticEvent, } from "react"; import "../../styles/pages/workbench.css"; -import type { WebGenerationPreviewTask, WebUserSession } from "../../types"; +import type { WebUserSession } from "../../types"; import { aiGenerationClient } from "../../api/aiGenerationClient"; import { claimGenerationSlot, getActiveGenerationTaskCount, getEffectiveGenerationLimit, getGenerationUserKey, releaseGenerationSlot } from "../../api/generationConcurrency"; -import { preUploadReference, resolvePreUploadedUrl } from "../../api/referenceUploadService"; +import { preUploadReference } from "../../api/referenceUploadService"; import { assetClient } from "../../api/assetClient"; import { communityClient } from "../../api/communityClient"; import { loadRechargeModal, type RechargeModalComponent } from "../../components/RechargeModal/loadRechargeModal"; @@ -46,7 +40,6 @@ import { useGenerationTasks } from "../../hooks/useGenerationTasks"; import { conversationClient, type ConversationSummary } from "../../api/conversationClient"; import { modelCapabilitiesClient } from "../../api/modelCapabilitiesClient"; -import { buildApiUrl, buildAuthHeaders } from "../../api/serverConnection"; import type { CreatePreviewTaskInput } from "../../api/webGenerationGateway"; import type { WebProjectSummary } from "../../types"; import { @@ -62,8 +55,6 @@ import { MarkdownMessage, ResultCard, } from "./components/WorkbenchChatCards"; -import { renderMarkdownBlocks } from "./markdownRenderer"; -import { downloadResultAsset } from "./workbenchDownload"; import { translateTaskError } from "../../utils/translateTaskError"; import { buildLocalTimeoutMessage, @@ -80,7 +71,6 @@ import { isPixverseModel } from "../../utils/pixverseRouting"; import { resolveVideoRequestModel } from "../../utils/resolveVideoModel"; import { calculateEnterpriseVideoCredits, ENTERPRISE_DEFAULT_VIDEO_MODEL } from "../../utils/enterpriseVideoPolicy"; import { - getImageQualityOptions, getImageQualityOptionsForContext, getDefaultImageQuality, getDefaultImageQualityForContext, @@ -90,8 +80,6 @@ import { } from "../../utils/modelOptions"; import { filterImageModelOptionsForSession } from "../../utils/imageModelVisibility"; import { persistWorkbenchResultAsset, type PersistedWorkbenchResultAsset } from "./workbenchResultPersistence"; -import { SmoothedProgressBar } from "./SmoothedProgressBar"; -import { useSmoothedProgress } from "../../hooks/useSmoothedProgress"; import { type WorkbenchMode, type ToolbarMenuId, @@ -99,8 +87,6 @@ import { type WorkbenchOption, type WorkbenchFieldGroup, type ReferenceItem, - type PromptMentionItem, - type PromptMentionTokenRange, type ChatAttachment, type ChatMessage, type DeleteDialogState, @@ -117,33 +103,18 @@ import { GRID_SUPPORTED_MODELS, VIDEO_FRAME_OPTIONS, VIDEO_DURATION_OPTIONS, - MESSAGE_STORAGE_KEY, - ACTIVE_CONVERSATION_STORAGE_KEY, - PROMPT_HISTORY_STORAGE_KEY, - TASK_KEEPALIVE_STORAGE_KEY, - WORKBENCH_TASK_STALE_MS, WORKBENCH_TASK_MAX_POLL_FAILURES, - REFERENCE_IMAGE_COMPRESS_THRESHOLD, - REFERENCE_IMAGE_MAX_DIMENSION, - REFERENCE_IMAGE_INITIAL_QUALITY, - REFERENCE_IMAGE_MIN_QUALITY, - CHAT_MODEL, CHAT_NATURAL_SYSTEM_PROMPT, CHAT_TURN_STYLE_REMINDER, - NON_CONVERSATIONAL_ASSISTANT_TEXT, getCachedRole, - getSessionUserId, - userKey, createId, formatWorkbenchTimestamp, - parseWorkbenchTimestampValue, buildChatAttachments, buildNaturalChatHistoryMessages, getErrorText, isAuthFailure, isInsufficientBalance, isInsufficientBalanceMessage, - isTransientMessage, getPersistableMessages, shouldPersistPatch, buildAssistantResult, @@ -156,25 +127,18 @@ import { persistMessages, clearWorkbenchLocalState, persistPromptHistory, - buildRecoverableTaskFromMessage, readStoredKeepaliveTasks, persistKeepaliveTasks, } from "./workbenchStorage"; import { - getRatioOptionClassName, - getSettingsGridColumnsClassName, getReferenceAccept, getReferenceUploadLabel, getReferenceLimit, getReferenceKindLabel, - getReferenceEmptyCopy, hexToRgbTriplet, inferReferenceKind, disposeReferencePreview, - fileToDataUrl, - bytesToHex, buildReferenceFingerprint, - canCompressReferenceImage, compressReferenceImageIfNeeded, buildReferenceToken, resolveReferenceUrls, @@ -188,7 +152,6 @@ import { import { findPromptMentionRangeInside, findPromptMentionRangeOverlap, - ReferenceInlinePreview, ReferencePreview, PromptPreviewLayer, } from "./WorkbenchPromptPreview"; @@ -495,7 +458,6 @@ function WorkbenchPage({ const workbenchAccent = "#00ff88"; const hasConversationRecords = activeConversationId !== null || messages.length > 0; const hasActivatedWorkspace = !effectiveOnboarding && (workspaceStarted || isGenerating || hasConversationRecords); - const referenceCount = referenceItems.length; const activeVideoModelValue = toHappyHorseDisplayModel(videoModel); const activeModelValue = activeMode === "image" ? imageModel : activeMode === "video" ? activeVideoModelValue : chatModel; @@ -1007,7 +969,7 @@ function WorkbenchPage({ const patchConversationMessage = useCallback( async (conversationId: number, messageId: string, patch: Partial) => { - let sourceMessages = + const sourceMessages = activeConversationIdRef.current === conversationId ? messagesRef.current : conversationMessagesCacheRef.current.get(conversationId); @@ -2236,7 +2198,7 @@ function WorkbenchPage({ taskId = result.taskId; genTracker.submitTask({ title: trimmedPrompt.slice(0, 60), type: "image", status: "running", progress: 5, prompt: trimmedPrompt, sourceView: "workbench", taskId }); } else { - let requestModel = resolveVideoRequestModel({ + const requestModel = resolveVideoRequestModel({ model: taskInput.params?.model || ENTERPRISE_DEFAULT_VIDEO_MODEL, referenceUrls: refUrls, }); @@ -3031,7 +2993,7 @@ function WorkbenchPage({ ); - const renderComposerToolbar = (disabled = false, showStop = false) => ( + const renderComposerToolbar = (disabled = false, _showStop = false) => (