From b726620b4dbce9a199022d58ca7237056f26251b Mon Sep 17 00:00:00 2001 From: ddCat <2695092045@qq.com> Date: Fri, 14 Aug 2026 12:44:58 +0800 Subject: [PATCH] =?UTF-8?q?fix(ci):=20=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=20-=20=E4=BF=AE=E5=A4=8D=E7=94=BB=E5=B8=83=E5=8F=98=E6=9B=B4?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=9A=84=20Prettier=20=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs #220 --- .../canvas/canvas-video-segment-dialog.tsx | 15 +++--- web/src/components/model-picker.tsx | 5 +- web/src/lib/model-selection.ts | 27 ++++++----- web/src/pages/canvas/project.tsx | 47 ++++++++++++------- 4 files changed, 57 insertions(+), 37 deletions(-) diff --git a/web/src/components/canvas/canvas-video-segment-dialog.tsx b/web/src/components/canvas/canvas-video-segment-dialog.tsx index 9d2c03774..f39f0e478 100644 --- a/web/src/components/canvas/canvas-video-segment-dialog.tsx +++ b/web/src/components/canvas/canvas-video-segment-dialog.tsx @@ -111,12 +111,15 @@ export function CanvasVideoSegmentDialog({ node, nodes, connections, open, mode, const durationSec = durationMs > 0 ? durationMs / 1000 : 0; const hasTimelineVideoClips = Boolean(timeline?.clips.some((clip) => clip.kind === "video")); const hasPrompt = Boolean(prompt.trim()); - const modelRequirements = useMemo(() => ({ - capability: "video", - input: { textCount: hasPrompt ? 1 : 0, imageCount: 0, videoCount: 1, audioCount: 0, characterCount: 0 }, - videoOperation: operation, - videoSeconds: config.videoSeconds, - }), [config.videoSeconds, hasPrompt, operation]); + const modelRequirements = useMemo( + () => ({ + capability: "video", + input: { textCount: hasPrompt ? 1 : 0, imageCount: 0, videoCount: 1, audioCount: 0, characterCount: 0 }, + videoOperation: operation, + videoSeconds: config.videoSeconds, + }), + [config.videoSeconds, hasPrompt, operation], + ); const resolvedModel = resolveCompatibleModel(config, model, modelRequirements) || model; const videoProfile = useMemo(() => (resolvedModel ? modelCapabilityConfigFor(config, resolvedModel).video : undefined), [config, resolvedModel]); const defaultModel = config.videoModel || config.model || ""; diff --git a/web/src/components/model-picker.tsx b/web/src/components/model-picker.tsx index 0ed3119b5..a16517f97 100644 --- a/web/src/components/model-picker.tsx +++ b/web/src/components/model-picker.tsx @@ -45,7 +45,10 @@ export function ModelPicker({ config, value, onChange, capability, className, fu key: channel.id, label: channel.name || "未命名渠道", scope: channel.scope === "system" ? "系统渠道" : "自定义渠道", - models: groupModelsByDisplayName(config, options.filter((model) => resolveModelChannel(config, model).id === channel.id)), + models: groupModelsByDisplayName( + config, + options.filter((model) => resolveModelChannel(config, model).id === channel.id), + ), })) .filter((group) => group.models.length); const groupedModels = new Set(channelGroups.flatMap((group) => group.models.flatMap((modelGroup) => modelGroup.models))); diff --git a/web/src/lib/model-selection.ts b/web/src/lib/model-selection.ts index 50ceac81e..7ea92ebaf 100644 --- a/web/src/lib/model-selection.ts +++ b/web/src/lib/model-selection.ts @@ -113,18 +113,21 @@ export function modelGroupReferenceLimits(config: AiConfig, selected: string, ca if (!groupModels.length) return undefined; const compatibleModels = requirements ? groupModels.filter((model) => !modelCompatibilityError(config, model, requirements)) : groupModels; const models = compatibleModels.length ? compatibleModels : groupModels; - return models.reduce((limits, model) => { - const profile = modelCapabilityConfigFor(config, model); - if (capability === "image") { - return { ...limits, maxImages: Math.max(limits.maxImages, profile.image!.references.maxImages) }; - } - const references = profile.video!.references; - return { - maxImages: Math.max(limits.maxImages, references.maxImages), - maxVideos: Math.max(limits.maxVideos, references.maxVideos), - maxAudios: Math.max(limits.maxAudios, references.maxAudios), - }; - }, { maxImages: 0, maxVideos: 0, maxAudios: 0 }); + return models.reduce( + (limits, model) => { + const profile = modelCapabilityConfigFor(config, model); + if (capability === "image") { + return { ...limits, maxImages: Math.max(limits.maxImages, profile.image!.references.maxImages) }; + } + const references = profile.video!.references; + return { + maxImages: Math.max(limits.maxImages, references.maxImages), + maxVideos: Math.max(limits.maxVideos, references.maxVideos), + maxAudios: Math.max(limits.maxAudios, references.maxAudios), + }; + }, + { maxImages: 0, maxVideos: 0, maxAudios: 0 }, + ); } export function inferVideoOperation(input: ModelInputSummary) { diff --git a/web/src/pages/canvas/project.tsx b/web/src/pages/canvas/project.tsx index f32cc16df..a6e722cec 100644 --- a/web/src/pages/canvas/project.tsx +++ b/web/src/pages/canvas/project.tsx @@ -705,24 +705,35 @@ function InfiniteCanvasPage() { onNodesDeleted: handleNodesDeleted, }); - const { cancelPendingConnectionCreate, closeConnectionCreateMenu, connectionTargetAnchorRatio, connectionTargetNodeId, connectingParams, createConnectedNode, getConnectionCreateDisabledReason, handleConnectStart, mouseWorld, pendingConnectionCreate, setConnecting } = - useCanvasConnectionController({ - projectId, - config: effectiveConfig, - defaultDrawingEngine, - nodesRef, - connectionsRef, - viewportRef, - scriptScrollTopById, - screenToCanvas, - setNodes, - setConnections, - setSelectedNodeIds, - setSelectedConnectionId, - setContextMenu, - setDialogNodeId, - setDrawingNodeId, - }); + const { + cancelPendingConnectionCreate, + closeConnectionCreateMenu, + connectionTargetAnchorRatio, + connectionTargetNodeId, + connectingParams, + createConnectedNode, + getConnectionCreateDisabledReason, + handleConnectStart, + mouseWorld, + pendingConnectionCreate, + setConnecting, + } = useCanvasConnectionController({ + projectId, + config: effectiveConfig, + defaultDrawingEngine, + nodesRef, + connectionsRef, + viewportRef, + scriptScrollTopById, + screenToCanvas, + setNodes, + setConnections, + setSelectedNodeIds, + setSelectedConnectionId, + setContextMenu, + setDialogNodeId, + setDrawingNodeId, + }); const handleCanvasSelectionStart = useCallback(() => { setContextMenu(null);