From 82e92b7a08e36aa3126abf2dd6b967aef96c1473 Mon Sep 17 00:00:00 2001 From: TianYun Date: Mon, 15 Jun 2026 10:26:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=A5=E6=9F=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/nodes/SmartTextNode.tsx | 18 ++++------- src/utils/nodeHandles.ts | 41 -------------------------- 2 files changed, 6 insertions(+), 53 deletions(-) diff --git a/src/components/nodes/SmartTextNode.tsx b/src/components/nodes/SmartTextNode.tsx index 381d8cc7..1b7dba48 100644 --- a/src/components/nodes/SmartTextNode.tsx +++ b/src/components/nodes/SmartTextNode.tsx @@ -13,7 +13,7 @@ import { LLM_MODELS } from "@/lib/llmModels"; import { useWorkflowStore } from "@/store/workflowStore"; import { SmartTextNodeData } from "@/types"; import { formatUserFacingError } from "@/utils/userFacingErrors"; -import { getSmartTextInputHandles, SINGLE_INPUT_HANDLE_ID, SINGLE_OUTPUT_HANDLE_ID, type NodeInputHandleDescriptor } from "@/utils/nodeHandles"; +import { SINGLE_INPUT_HANDLE_ID, SINGLE_OUTPUT_HANDLE_ID } from "@/utils/nodeHandles"; import { deriveSmartTextMode } from "@/utils/smartTextMode"; import { editorHtmlToMarkdown, insertEditorDivider, markdownToEditorHtml } from "@/utils/markdownEditor"; import { readTextDocumentFile } from "@/utils/textDocumentImport"; @@ -30,8 +30,7 @@ function getSmartTextManualTitle(id: string, data: SmartTextNodeData, textInputL return match ? `${textInputLabel} ${match[1]}` : textInputLabel; } -function SmartTextInputHandles({ handles, selected }: { handles: NodeInputHandleDescriptor[]; selected?: boolean }) { - void handles; +function SmartTextInputHandles({ selected }: { selected?: boolean }) { const showLabels = useShowHandleLabels(selected); return ( @@ -212,12 +211,10 @@ function SmartTextNeutralView({ id, data, selected, - inputHandles, }: { id: string; data: SmartTextNodeData; selected?: boolean; - inputHandles: NodeInputHandleDescriptor[]; }) { const { t } = useI18n(); const updateNodeData = useWorkflowStore((state) => state.updateNodeData); @@ -244,7 +241,7 @@ function SmartTextNeutralView({ minHeight={SMART_TEXT_MIN_DIMENSIONS.height} fullBleed > - +
@@ -481,12 +478,10 @@ function SmartTextLlmView({ id, data, selected, - inputHandles, }: { id: string; data: SmartTextNodeData; selected?: boolean; - inputHandles: NodeInputHandleDescriptor[]; }) { const { t } = useI18n(); const updateNodeData = useWorkflowStore((state) => state.updateNodeData); @@ -504,7 +499,7 @@ function SmartTextLlmView({ minHeight={SMART_TEXT_MIN_DIMENSIONS.height} fullBleed > - + {data.status === "loading" ? (
) { const edges = useWorkflowStore((state) => state.edges); const mode = deriveSmartTextMode(id, data, edges); - const inputHandles = getSmartTextInputHandles({ id, type: "smartText", data }, edges); if (mode === "manualText") { return ; } if (mode === "llmGenerate") { - return ; + return ; } - return ; + return ; } diff --git a/src/utils/nodeHandles.ts b/src/utils/nodeHandles.ts index 4871fcce..0b650d6e 100644 --- a/src/utils/nodeHandles.ts +++ b/src/utils/nodeHandles.ts @@ -30,13 +30,6 @@ export type NodeConnectionCapability = { } | null; }; -export type NodeInputHandleDescriptor = { - id: string; - type: "image" | "video" | "audio" | "text"; - schemaName?: string; - topPercent: number; -}; - type CapabilityNode = { id: string; type?: string; @@ -242,37 +235,3 @@ export function getNodeHandleCapability(node: CapabilityNode, edges: WorkflowEdg return getStaticNodeHandles(node.type || ""); } - -export function getSmartImageInputHandles(node: CapabilityNode, edges: WorkflowEdge[]): NodeInputHandleDescriptor[] { - return getSmartMediaInputHandles(node, edges, ["image", "text"], [35, 65]); -} - -export function getSmartVideoInputHandles(node: CapabilityNode, edges: WorkflowEdge[]): NodeInputHandleDescriptor[] { - return getSmartMediaInputHandles(node, edges, ["image", "video", "text"], [25, 50, 75]); -} - -export function getSmartAudioInputHandles(node: CapabilityNode, edges: WorkflowEdge[]): NodeInputHandleDescriptor[] { - return getSmartMediaInputHandles(node, edges, ["text"], [50]); -} - -export function getSmartTextInputHandles(node: CapabilityNode, edges: WorkflowEdge[]): NodeInputHandleDescriptor[] { - return getSmartMediaInputHandles(node, edges, ["image", "video", "text"], [28, 50, 72]); -} - -function getSmartMediaInputHandles( - node: CapabilityNode, - edges: WorkflowEdge[], - defaultTypes: Array<"image" | "video" | "audio" | "text">, - defaultTopPercents: number[] -): NodeInputHandleDescriptor[] { - const capability = getNodeHandleCapability(node, edges); - if (capability.inputs.length === 0) return []; - - return defaultTypes - .filter((type) => capability.inputs.includes(type)) - .map((type, index) => ({ - id: type, - type, - topPercent: defaultTopPercents[index] ?? ((index + 1) / (defaultTypes.length + 1)) * 100, - })); -}