您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import type { FC } from 'react'
  2. import React from 'react'
  3. import type { ToolNodeType } from './types'
  4. import type { NodeProps } from '@/app/components/workflow/types'
  5. import { FormTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations'
  6. const Node: FC<NodeProps<ToolNodeType>> = ({
  7. data,
  8. }) => {
  9. const { tool_configurations, paramSchemas } = data
  10. const toolConfigs = Object.keys(tool_configurations || {})
  11. if (!toolConfigs.length)
  12. return null
  13. return (
  14. <div className='mb-1 px-3 py-1'>
  15. <div className='space-y-0.5'>
  16. {toolConfigs.map((key, index) => (
  17. <div key={index} className='flex h-6 items-center justify-between space-x-1 rounded-md bg-workflow-block-parma-bg px-1 text-xs font-normal text-text-secondary'>
  18. <div title={key} className='max-w-[100px] shrink-0 truncate text-xs font-medium uppercase text-text-tertiary'>
  19. {key}
  20. </div>
  21. {typeof tool_configurations[key] === 'string' && (
  22. <div title={tool_configurations[key]} className='w-0 shrink-0 grow truncate text-right text-xs font-normal text-text-secondary'>
  23. {paramSchemas?.find(i => i.name === key)?.type === FormTypeEnum.secretInput ? '********' : tool_configurations[key]}
  24. </div>
  25. )}
  26. {typeof tool_configurations[key] === 'number' && (
  27. <div title={tool_configurations[key].toString()} className='w-0 shrink-0 grow truncate text-right text-xs font-normal text-text-secondary'>
  28. {tool_configurations[key]}
  29. </div>
  30. )}
  31. {typeof tool_configurations[key] !== 'string' && tool_configurations[key]?.type === FormTypeEnum.modelSelector && (
  32. <div title={tool_configurations[key].model} className='w-0 shrink-0 grow truncate text-right text-xs font-normal text-text-secondary'>
  33. {tool_configurations[key].model}
  34. </div>
  35. )}
  36. {/* {typeof tool_configurations[key] !== 'string' && tool_configurations[key]?.type === FormTypeEnum.appSelector && (
  37. <div title={tool_configurations[key].app_id} className='grow w-0 shrink-0 truncate text-right text-xs font-normal text-gray-700'>
  38. {tool_configurations[key].app_id}
  39. </div>
  40. )} */}
  41. </div>
  42. ))}
  43. </div>
  44. </div>
  45. )
  46. }
  47. export default React.memo(Node)