fix: types

This commit is contained in:
zxhlyh
2025-09-29 20:53:23 +08:00
parent 5e3e6b0bd8
commit 8106df1d7d
30 changed files with 77 additions and 77 deletions

View File

@ -39,11 +39,11 @@ const Add = ({
const { nodesReadOnly } = useNodesReadOnly()
const { availableNextBlocks } = useAvailableBlocks(nodeData.type, nodeData.isInIteration || nodeData.isInLoop)
const handleSelect = useCallback<OnSelectBlock>((type, toolDefaultValue) => {
const handleSelect = useCallback<OnSelectBlock>((type, pluginDefaultValue) => {
handleNodeAdd(
{
nodeType: type,
toolDefaultValue,
pluginDefaultValue,
},
{
prevNodeId: nodeId,

View File

@ -38,8 +38,8 @@ const ChangeItem = ({
availableNextBlocks,
} = useAvailableBlocks(data.type, data.isInIteration || data.isInLoop)
const handleSelect = useCallback<OnSelectBlock>((type, toolDefaultValue) => {
handleNodeChange(nodeId, type, sourceHandle, toolDefaultValue)
const handleSelect = useCallback<OnSelectBlock>((type, pluginDefaultValue) => {
handleNodeChange(nodeId, type, sourceHandle, pluginDefaultValue)
}, [nodeId, sourceHandle, handleNodeChange])
const renderTrigger = useCallback(() => {

View File

@ -16,7 +16,7 @@ import {
} from '../../../types'
import type { Node } from '../../../types'
import BlockSelector from '../../../block-selector'
import type { ToolDefaultValue } from '../../../block-selector/types'
import type { PluginDefaultValue } from '../../../block-selector/types'
import {
useAvailableBlocks,
useIsChatMode,
@ -57,11 +57,11 @@ export const NodeTargetHandle = memo(({
if (!connected)
setOpen(v => !v)
}, [connected])
const handleSelect = useCallback((type: BlockEnum, toolDefaultValue?: ToolDefaultValue) => {
const handleSelect = useCallback((type: BlockEnum, pluginDefaultValue?: PluginDefaultValue) => {
handleNodeAdd(
{
nodeType: type,
toolDefaultValue,
pluginDefaultValue,
},
{
nextNodeId: id,
@ -143,11 +143,11 @@ export const NodeSourceHandle = memo(({
e.stopPropagation()
setOpen(v => !v)
}, [])
const handleSelect = useCallback((type: BlockEnum, toolDefaultValue?: ToolDefaultValue) => {
const handleSelect = useCallback((type: BlockEnum, pluginDefaultValue?: PluginDefaultValue) => {
handleNodeAdd(
{
nodeType: type,
toolDefaultValue,
pluginDefaultValue,
},
{
prevNodeId: id,

View File

@ -43,8 +43,8 @@ const ChangeBlock = ({
return availableNextBlocks
}, [availablePrevBlocks, availableNextBlocks])
const handleSelect = useCallback<OnSelectBlock>((type, toolDefaultValue) => {
handleNodeChange(nodeId, type, sourceHandle, toolDefaultValue)
const handleSelect = useCallback<OnSelectBlock>((type, pluginDefaultValue) => {
handleNodeChange(nodeId, type, sourceHandle, pluginDefaultValue)
}, [handleNodeChange, nodeId, sourceHandle])
const renderTrigger = useCallback(() => {

View File

@ -11,7 +11,7 @@ export const useReplaceDataSourceNode = (id: string) => {
const handleReplaceNode = useCallback<OnSelectBlock>((
type,
toolDefaultValue,
pluginDefaultValue,
) => {
const {
getNodes,
@ -28,7 +28,7 @@ export const useReplaceDataSourceNode = (id: string) => {
const { newNode } = generateNewNode({
data: {
...(defaultValue as any),
...toolDefaultValue,
...pluginDefaultValue,
},
position: {
x: emptyNode.position.x,

View File

@ -33,11 +33,11 @@ const AddBlock = ({
const { handleNodeAdd } = useNodesInteractions()
const { availableNextBlocks } = useAvailableBlocks(BlockEnum.Start, true)
const handleSelect = useCallback<OnSelectBlock>((type, toolDefaultValue) => {
const handleSelect = useCallback<OnSelectBlock>((type, pluginDefaultValue) => {
handleNodeAdd(
{
nodeType: type,
toolDefaultValue,
pluginDefaultValue,
},
{
prevNodeId: iterationNodeData.start_node_id,

View File

@ -34,11 +34,11 @@ const AddBlock = ({
const { handleNodeAdd } = useNodesInteractions()
const { availableNextBlocks } = useAvailableBlocks(BlockEnum.Start, true)
const handleSelect = useCallback<OnSelectBlock>((type, toolDefaultValue) => {
const handleSelect = useCallback<OnSelectBlock>((type, pluginDefaultValue) => {
handleNodeAdd(
{
nodeType: type,
toolDefaultValue,
pluginDefaultValue,
},
{
prevNodeId: loopNodeData.start_node_id,

View File

@ -25,11 +25,11 @@ const InsertBlock = ({
const handleOpenChange = useCallback((v: boolean) => {
setOpen(v)
}, [])
const handleInsert = useCallback<OnSelectBlock>((nodeType, toolDefaultValue) => {
const handleInsert = useCallback<OnSelectBlock>((nodeType, pluginDefaultValue) => {
handleNodeAdd(
{
nodeType,
toolDefaultValue,
pluginDefaultValue,
},
{
nextNodeId: startNodeId,

View File

@ -9,7 +9,7 @@ import BlockSelector from '../../../../block-selector'
import type { Param, ParamType } from '../../types'
import cn from '@/utils/classnames'
import { useStore } from '@/app/components/workflow/store'
import type { ToolDefaultValue } from '@/app/components/workflow/block-selector/types'
import type { PluginDefaultValue } from '@/app/components/workflow/block-selector/types'
import type { ToolParameter } from '@/app/components/tools/types'
import { CollectionType } from '@/app/components/tools/types'
import type { BlockEnum } from '@/app/components/workflow/types'
@ -43,7 +43,9 @@ const ImportFromTool: FC<Props> = ({
const customTools = useStore(s => s.customTools)
const workflowTools = useStore(s => s.workflowTools)
const handleSelectTool = useCallback((_type: BlockEnum, toolInfo?: ToolDefaultValue) => {
const handleSelectTool = useCallback((_type: BlockEnum, toolInfo?: PluginDefaultValue) => {
if (!toolInfo || !('tool_name' in toolInfo))
return
const { provider_id, provider_type, tool_name: tool_name } = toolInfo!
const currentTools = (() => {
switch (provider_type) {