mirror of
				https://github.com/langgenius/dify.git
				synced 2025-10-31 02:42:59 +00:00 
			
		
		
		
	 7753ba2d37
			
		
	
	
		7753ba2d37
		
			
		
	
	
	
	
		
			
			Co-authored-by: Joel <iamjoel007@gmail.com> Co-authored-by: Yeuoly <admin@srmxy.cn> Co-authored-by: JzoNg <jzongcode@gmail.com> Co-authored-by: StyleZhang <jasonapring2015@outlook.com> Co-authored-by: jyong <jyong@dify.ai> Co-authored-by: nite-knite <nkCoding@gmail.com> Co-authored-by: jyong <718720800@qq.com>
		
			
				
	
	
		
			36 lines
		
	
	
		
			989 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			989 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import type { FC } from 'react'
 | |
| import React from 'react'
 | |
| import type { LLMNodeType } from './types'
 | |
| import {
 | |
|   useTextGenerationCurrentProviderAndModelAndModelList,
 | |
| } from '@/app/components/header/account-setting/model-provider-page/hooks'
 | |
| import ModelSelector from '@/app/components/header/account-setting/model-provider-page/model-selector'
 | |
| import type { NodeProps } from '@/app/components/workflow/types'
 | |
| 
 | |
| const Node: FC<NodeProps<LLMNodeType>> = ({
 | |
|   data,
 | |
| }) => {
 | |
|   const { provider, name: modelId } = data.model || {}
 | |
|   const {
 | |
|     textGenerationModelList,
 | |
|   } = useTextGenerationCurrentProviderAndModelAndModelList()
 | |
|   const hasSetModel = provider && modelId
 | |
| 
 | |
|   if (!hasSetModel)
 | |
|     return null
 | |
| 
 | |
|   return (
 | |
|     <div className='mb-1 px-3 py-1'>
 | |
|       {hasSetModel && (
 | |
|         <ModelSelector
 | |
|           defaultModel={{ provider, model: modelId }}
 | |
|           modelList={textGenerationModelList}
 | |
|           readonly
 | |
|         />
 | |
|       )}
 | |
|     </div>
 | |
|   )
 | |
| }
 | |
| 
 | |
| export default React.memo(Node)
 |