| | |
| | | renderTrigger?: (v: TriggerProps) => ReactNode |
| | | readonly?: boolean |
| | | isInWorkflow?: boolean |
| | | scope?: string |
| | | } |
| | | const stopParameterRule: ModelParameterRule = { |
| | | default: [], |
| | |
| | | }, |
| | | } |
| | | |
| | | const PROVIDER_WITH_PRESET_TONE = ['langgenius/openai/openai', 'langgenius/azure_openai/azure_openai'] |
| | | const PROVIDER_WITH_PRESET_TONE = ['openai', 'azure_openai'] |
| | | const ModelParameterModal: FC<ModelParameterModalProps> = ({ |
| | | popupClassName, |
| | | portalToFollowElemContentClassName, |
| | |
| | | ) |
| | | } |
| | | </PortalToFollowElemTrigger> |
| | | <PortalToFollowElemContent className={cn('z-[60]', portalToFollowElemContentClassName)}> |
| | | <div className={cn(popupClassName, 'w-[389px] rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg shadow-lg')}> |
| | | <div className={cn('max-h-[420px] overflow-y-auto p-4 pt-3')}> |
| | | <div className='relative'> |
| | | <div className={cn('system-sm-semibold mb-1 flex h-6 items-center text-text-secondary')}> |
| | | <PortalToFollowElemContent className={cn(portalToFollowElemContentClassName, 'z-[60]')}> |
| | | <div className={cn(popupClassName, 'w-[496px] rounded-xl border border-gray-100 bg-white shadow-xl')}> |
| | | <div className={cn( |
| | | 'max-h-[480px] overflow-y-auto', |
| | | !isInWorkflow && 'px-10 pt-6 pb-8', |
| | | isInWorkflow && 'p-4')}> |
| | | <div className='flex items-center justify-between h-8'> |
| | | <div className={cn('font-semibold text-gray-900 shrink-0', isInWorkflow && 'text-[13px]')}> |
| | | {t('common.modelProvider.model').toLocaleUpperCase()} |
| | | </div> |
| | | <ModelSelector |
| | | defaultModel={(provider || modelId) ? { provider, model: modelId } : undefined} |
| | | modelList={activeTextGenerationModelList} |
| | | onSelect={handleChangeModel} |
| | | triggerClassName='max-w-[295px]' |
| | | /> |
| | | </div> |
| | | { |
| | | !!parameterRules.length && ( |
| | | <div className='my-3 h-[1px] bg-divider-subtle' /> |
| | | <div className='my-5 h-[1px] bg-gray-100' /> |
| | | ) |
| | | } |
| | | { |
| | |
| | | } |
| | | { |
| | | !isLoading && !!parameterRules.length && ( |
| | | <div className='mb-2 flex items-center justify-between'> |
| | | <div className={cn('system-sm-semibold flex h-6 items-center text-text-secondary')}>{t('common.modelProvider.parameters')}</div> |
| | | <div className='flex items-center justify-between mb-4'> |
| | | <div className={cn('font-semibold text-gray-900', isInWorkflow && 'text-[13px]')}>{t('common.modelProvider.parameters')}</div> |
| | | { |
| | | PROVIDER_WITH_PRESET_TONE.includes(provider) && ( |
| | | <PresetsParameter onSelect={handleSelectPresetParameter} /> |
| | |
| | | ].map(parameter => ( |
| | | <ParameterItem |
| | | key={`${modelId}-${parameter.name}`} |
| | | className='mb-4' |
| | | parameterRule={parameter} |
| | | value={completionParams?.[parameter.name]} |
| | | onChange={v => handleParamChange(parameter.name, v)} |
| | |
| | | </div> |
| | | {!hideDebugWithMultipleModel && ( |
| | | <div |
| | | className='bg-components-section-burn system-sm-regular flex h-[50px] cursor-pointer items-center justify-between rounded-b-xl border-t border-t-divider-subtle px-4 text-text-accent' |
| | | className='flex items-center justify-between px-6 h-[50px] bg-gray-50 border-t border-t-gray-100 text-xs font-medium text-primary-600 cursor-pointer rounded-b-xl' |
| | | onClick={() => onDebugWithMultipleModelChange?.()} |
| | | > |
| | | { |
| | |
| | | ? t('appDebug.debugAsSingleModel') |
| | | : t('appDebug.debugAsMultipleModel') |
| | | } |
| | | <ArrowNarrowLeft className='h-3 w-3 rotate-180' /> |
| | | <ArrowNarrowLeft className='w-3 h-3 rotate-180' /> |
| | | </div> |
| | | )} |
| | | </div> |