|  | @@ -7,8 +7,7 @@ import ConfigPrompt from '../../config-prompt'
 | 
	
		
			
				|  |  |  import { languageMap } from '../../../../workflow/nodes/_base/components/editor/code-editor/index'
 | 
	
		
			
				|  |  |  import { generateRuleCode } from '@/service/debug'
 | 
	
		
			
				|  |  |  import type { CodeGenRes } from '@/service/debug'
 | 
	
		
			
				|  |  | -import { ModelModeType } from '@/types/app'
 | 
	
		
			
				|  |  | -import type { AppType, Model } from '@/types/app'
 | 
	
		
			
				|  |  | +import { type AppType, type Model, ModelModeType } from '@/types/app'
 | 
	
		
			
				|  |  |  import Modal from '@/app/components/base/modal'
 | 
	
		
			
				|  |  |  import Button from '@/app/components/base/button'
 | 
	
		
			
				|  |  |  import { Generator } from '@/app/components/base/icons/src/vender/other'
 | 
	
	
		
			
				|  | @@ -16,6 +15,10 @@ import Toast from '@/app/components/base/toast'
 | 
	
		
			
				|  |  |  import Loading from '@/app/components/base/loading'
 | 
	
		
			
				|  |  |  import Confirm from '@/app/components/base/confirm'
 | 
	
		
			
				|  |  |  import type { CodeLanguage } from '@/app/components/workflow/nodes/code/types'
 | 
	
		
			
				|  |  | +import { useModelListAndDefaultModelAndCurrentProviderAndModel } from '@/app/components/header/account-setting/model-provider-page/hooks'
 | 
	
		
			
				|  |  | +import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations'
 | 
	
		
			
				|  |  | +import ModelIcon from '@/app/components/header/account-setting/model-provider-page/model-icon'
 | 
	
		
			
				|  |  | +import ModelName from '@/app/components/header/account-setting/model-provider-page/model-name'
 | 
	
		
			
				|  |  |  export type IGetCodeGeneratorResProps = {
 | 
	
		
			
				|  |  |    mode: AppType
 | 
	
		
			
				|  |  |    isShow: boolean
 | 
	
	
		
			
				|  | @@ -31,9 +34,12 @@ export const GetCodeGeneratorResModal: FC<IGetCodeGeneratorResProps> = (
 | 
	
		
			
				|  |  |      codeLanguages,
 | 
	
		
			
				|  |  |      onClose,
 | 
	
		
			
				|  |  |      onFinished,
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |  ) => {
 | 
	
		
			
				|  |  | +  const {
 | 
	
		
			
				|  |  | +    currentProvider,
 | 
	
		
			
				|  |  | +    currentModel,
 | 
	
		
			
				|  |  | +  } = useModelListAndDefaultModelAndCurrentProviderAndModel(ModelTypeEnum.textGeneration)
 | 
	
		
			
				|  |  |    const { t } = useTranslation()
 | 
	
		
			
				|  |  |    const [instruction, setInstruction] = React.useState<string>('')
 | 
	
		
			
				|  |  |    const [isLoading, { setTrue: setLoadingTrue, setFalse: setLoadingFalse }] = useBoolean(false)
 | 
	
	
		
			
				|  | @@ -51,9 +57,10 @@ export const GetCodeGeneratorResModal: FC<IGetCodeGeneratorResProps> = (
 | 
	
		
			
				|  |  |      return true
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |    const model: Model = {
 | 
	
		
			
				|  |  | -    provider: 'openai',
 | 
	
		
			
				|  |  | -    name: 'gpt-4o-mini',
 | 
	
		
			
				|  |  | +    provider: currentProvider?.provider || '',
 | 
	
		
			
				|  |  | +    name: currentModel?.model || '',
 | 
	
		
			
				|  |  |      mode: ModelModeType.chat,
 | 
	
		
			
				|  |  | +    // This is a fixed parameter
 | 
	
		
			
				|  |  |      completion_params: {
 | 
	
		
			
				|  |  |        temperature: 0.7,
 | 
	
		
			
				|  |  |        max_tokens: 0,
 | 
	
	
		
			
				|  | @@ -112,6 +119,19 @@ export const GetCodeGeneratorResModal: FC<IGetCodeGeneratorResProps> = (
 | 
	
		
			
				|  |  |              <div className={'leading-[28px] text-lg font-bold'}>{t('appDebug.codegen.title')}</div>
 | 
	
		
			
				|  |  |              <div className='mt-1 text-[13px] font-normal text-gray-500'>{t('appDebug.codegen.description')}</div>
 | 
	
		
			
				|  |  |            </div>
 | 
	
		
			
				|  |  | +          <div className='flex items-center'>
 | 
	
		
			
				|  |  | +            <ModelIcon
 | 
	
		
			
				|  |  | +              className='shrink-0 mr-1.5'
 | 
	
		
			
				|  |  | +              provider={currentProvider}
 | 
	
		
			
				|  |  | +              modelName={currentModel?.model}
 | 
	
		
			
				|  |  | +            />
 | 
	
		
			
				|  |  | +            <ModelName
 | 
	
		
			
				|  |  | +              className='grow'
 | 
	
		
			
				|  |  | +              modelItem={currentModel!}
 | 
	
		
			
				|  |  | +              showMode
 | 
	
		
			
				|  |  | +              showFeatures
 | 
	
		
			
				|  |  | +            />
 | 
	
		
			
				|  |  | +          </div>
 | 
	
		
			
				|  |  |            <div className='mt-6'>
 | 
	
		
			
				|  |  |              <div className='text-[0px]'>
 | 
	
		
			
				|  |  |                <div className='mb-2 leading-5 text-sm font-medium text-gray-900'>{t('appDebug.codegen.instruction')}</div>
 |