mirror of https://github.com/langgenius/dify.git
fix: enforce no-leaked-conditional-rendering as error and fix violations (#31262)
Co-authored-by: Stephen Zhou <38493346+hyoban@users.noreply.github.com>
This commit is contained in:
parent
8f949d503a
commit
8056768106
|
|
@ -71,7 +71,7 @@ const DatasetInfo: FC<DatasetInfoProps> = ({
|
||||||
</div>
|
</div>
|
||||||
<div className="system-2xs-medium-uppercase text-text-tertiary">
|
<div className="system-2xs-medium-uppercase text-text-tertiary">
|
||||||
{isExternalProvider && t('externalTag', { ns: 'dataset' })}
|
{isExternalProvider && t('externalTag', { ns: 'dataset' })}
|
||||||
{!isExternalProvider && isPipelinePublished && dataset.doc_form && dataset.indexing_technique && (
|
{!!(!isExternalProvider && isPipelinePublished && dataset.doc_form && dataset.indexing_technique) && (
|
||||||
<div className="flex items-center gap-x-2">
|
<div className="flex items-center gap-x-2">
|
||||||
<span>{t(`chunkingMode.${DOC_FORM_TEXT[dataset.doc_form]}`, { ns: 'dataset' })}</span>
|
<span>{t(`chunkingMode.${DOC_FORM_TEXT[dataset.doc_form]}`, { ns: 'dataset' })}</span>
|
||||||
<span>{formatIndexingTechniqueAndMethod(dataset.indexing_technique, dataset.retrieval_model_dict?.search_method)}</span>
|
<span>{formatIndexingTechniqueAndMethod(dataset.indexing_technique, dataset.retrieval_model_dict?.search_method)}</span>
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ const DatasetSidebarDropdown = ({
|
||||||
</div>
|
</div>
|
||||||
<div className="system-2xs-medium-uppercase text-text-tertiary">
|
<div className="system-2xs-medium-uppercase text-text-tertiary">
|
||||||
{isExternalProvider && t('externalTag', { ns: 'dataset' })}
|
{isExternalProvider && t('externalTag', { ns: 'dataset' })}
|
||||||
{!isExternalProvider && dataset.doc_form && dataset.indexing_technique && (
|
{!!(!isExternalProvider && dataset.doc_form && dataset.indexing_technique) && (
|
||||||
<div className="flex items-center gap-x-2">
|
<div className="flex items-center gap-x-2">
|
||||||
<span>{t(`chunkingMode.${DOC_FORM_TEXT[dataset.doc_form]}`, { ns: 'dataset' })}</span>
|
<span>{t(`chunkingMode.${DOC_FORM_TEXT[dataset.doc_form]}`, { ns: 'dataset' })}</span>
|
||||||
<span>{formatIndexingTechniqueAndMethod(dataset.indexing_technique, dataset.retrieval_model_dict?.search_method)}</span>
|
<span>{formatIndexingTechniqueAndMethod(dataset.indexing_technique, dataset.retrieval_model_dict?.search_method)}</span>
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ const EditAnnotationModal: FC<Props> = ({
|
||||||
<MessageCheckRemove />
|
<MessageCheckRemove />
|
||||||
<div>{t('editModal.removeThisCache', { ns: 'appAnnotation' })}</div>
|
<div>{t('editModal.removeThisCache', { ns: 'appAnnotation' })}</div>
|
||||||
</div>
|
</div>
|
||||||
{createdAt && (
|
{!!createdAt && (
|
||||||
<div>
|
<div>
|
||||||
{t('editModal.createdAt', { ns: 'appAnnotation' })}
|
{t('editModal.createdAt', { ns: 'appAnnotation' })}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,16 +28,16 @@ const FeaturePanel: FC<IFeaturePanelProps> = ({
|
||||||
<div className={cn('px-3 pt-2', hasHeaderBottomBorder && 'border-b border-divider-subtle')} data-testid="feature-panel-header">
|
<div className={cn('px-3 pt-2', hasHeaderBottomBorder && 'border-b border-divider-subtle')} data-testid="feature-panel-header">
|
||||||
<div className="flex h-8 items-center justify-between">
|
<div className="flex h-8 items-center justify-between">
|
||||||
<div className="flex shrink-0 items-center space-x-1">
|
<div className="flex shrink-0 items-center space-x-1">
|
||||||
{headerIcon && <div className="flex h-6 w-6 items-center justify-center">{headerIcon}</div>}
|
{!!headerIcon && <div className="flex h-6 w-6 items-center justify-center">{headerIcon}</div>}
|
||||||
<div className="system-sm-semibold text-text-secondary">{title}</div>
|
<div className="system-sm-semibold text-text-secondary">{title}</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
{headerRight && <div>{headerRight}</div>}
|
{!!headerRight && <div>{headerRight}</div>}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/* Body */}
|
{/* Body */}
|
||||||
{children && (
|
{!!children && (
|
||||||
<div className={cn(!noBodySpacing && 'mt-1 px-3')} data-testid="feature-panel-body">
|
<div className={cn(!noBodySpacing && 'mt-1 px-3')} data-testid="feature-panel-body">
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ const Item: FC<ItemProps> = ({
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
</div>
|
</div>
|
||||||
{
|
{
|
||||||
config.indexing_technique && (
|
!!config.indexing_technique && (
|
||||||
<Badge
|
<Badge
|
||||||
className="shrink-0 group-hover:hidden"
|
className="shrink-0 group-hover:hidden"
|
||||||
text={formatIndexingTechniqueAndMethod(config.indexing_technique, config.retrieval_model_dict?.search_method)}
|
text={formatIndexingTechniqueAndMethod(config.indexing_technique, config.retrieval_model_dict?.search_method)}
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ const SelectDataSet: FC<ISelectDataSetProps> = ({
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{
|
{
|
||||||
item.indexing_technique && (
|
!!item.indexing_technique && (
|
||||||
<Badge
|
<Badge
|
||||||
className="shrink-0"
|
className="shrink-0"
|
||||||
text={formatIndexingTechniqueAndMethod(item.indexing_technique, item.retrieval_model_dict?.search_method)}
|
text={formatIndexingTechniqueAndMethod(item.indexing_technique, item.retrieval_model_dict?.search_method)}
|
||||||
|
|
|
||||||
|
|
@ -247,7 +247,7 @@ const SettingsModal: FC<SettingsModalProps> = ({
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{currentDataset && currentDataset.indexing_technique && (
|
{!!(currentDataset && currentDataset.indexing_technique) && (
|
||||||
<div className={cn(rowClass)}>
|
<div className={cn(rowClass)}>
|
||||||
<div className={labelClass}>
|
<div className={labelClass}>
|
||||||
<div className="system-sm-semibold text-text-secondary">{t('form.indexMethod', { ns: 'datasetSettings' })}</div>
|
<div className="system-sm-semibold text-text-secondary">{t('form.indexMethod', { ns: 'datasetSettings' })}</div>
|
||||||
|
|
|
||||||
|
|
@ -465,8 +465,8 @@ vi.mock('@/app/components/base/chat/chat', () => ({
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
{questionIcon && <div data-testid="question-icon">{questionIcon}</div>}
|
{!!questionIcon && <div data-testid="question-icon">{questionIcon}</div>}
|
||||||
{answerIcon && <div data-testid="answer-icon">{answerIcon}</div>}
|
{!!answerIcon && <div data-testid="answer-icon">{answerIcon}</div>}
|
||||||
<textarea
|
<textarea
|
||||||
data-testid="chat-input"
|
data-testid="chat-input"
|
||||||
placeholder="Type a message"
|
placeholder="Type a message"
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ const ToolCallItem: FC<Props> = ({ toolCall, isLLM = false, isFinal, tokens, obs
|
||||||
{toolName}
|
{toolName}
|
||||||
</div>
|
</div>
|
||||||
<div className="shrink-0 text-xs leading-[18px] text-text-tertiary">
|
<div className="shrink-0 text-xs leading-[18px] text-text-tertiary">
|
||||||
{toolCall.time_cost && (
|
{!!toolCall.time_cost && (
|
||||||
<span>{getTime(toolCall.time_cost || 0)}</span>
|
<span>{getTime(toolCall.time_cost || 0)}</span>
|
||||||
)}
|
)}
|
||||||
{isLLM && (
|
{isLLM && (
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,7 @@ const Answer: FC<AnswerProps> = ({
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
item.siblingCount && item.siblingCount > 1 && item.siblingIndex !== undefined && (
|
!!(item.siblingCount && item.siblingCount > 1 && item.siblingIndex !== undefined) && (
|
||||||
<ContentSwitch
|
<ContentSwitch
|
||||||
count={item.siblingCount}
|
count={item.siblingCount}
|
||||||
currentIndex={item.siblingIndex}
|
currentIndex={item.siblingIndex}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ const More: FC<MoreProps> = ({
|
||||||
>
|
>
|
||||||
{`${t('detail.tokenCost', { ns: 'appLog' })} ${formatNumber(more.tokens)}`}
|
{`${t('detail.tokenCost', { ns: 'appLog' })} ${formatNumber(more.tokens)}`}
|
||||||
</div>
|
</div>
|
||||||
{more.tokens_per_second && (
|
{!!more.tokens_per_second && (
|
||||||
<div
|
<div
|
||||||
className="mr-2 max-w-[25%] shrink-0 truncate"
|
className="mr-2 max-w-[25%] shrink-0 truncate"
|
||||||
title={`${more.tokens_per_second} tokens/s`}
|
title={`${more.tokens_per_second} tokens/s`}
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ const Popup: FC<PopupProps> = ({
|
||||||
icon={<BezierCurve03 className="mr-1 h-3 w-3" />}
|
icon={<BezierCurve03 className="mr-1 h-3 w-3" />}
|
||||||
/>
|
/>
|
||||||
{
|
{
|
||||||
source.score && (
|
!!source.score && (
|
||||||
<ProgressTooltip data={Number(source.score.toFixed(2))} />
|
<ProgressTooltip data={Number(source.score.toFixed(2))} />
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ const UploaderButton: FC<UploaderButtonProps> = ({
|
||||||
<PortalToFollowElemContent className="z-50">
|
<PortalToFollowElemContent className="z-50">
|
||||||
<div className="w-[260px] rounded-lg border-[0.5px] border-gray-200 bg-white p-2 shadow-lg">
|
<div className="w-[260px] rounded-lg border-[0.5px] border-gray-200 bg-white p-2 shadow-lg">
|
||||||
<ImageLinkInput onUpload={handleUpload} disabled={disabled} />
|
<ImageLinkInput onUpload={handleUpload} disabled={disabled} />
|
||||||
{hasUploadFromLocal && (
|
{!!hasUploadFromLocal && (
|
||||||
<>
|
<>
|
||||||
<div className="mt-2 flex items-center px-2 text-xs font-medium text-gray-400">
|
<div className="mt-2 flex items-center px-2 text-xs font-medium text-gray-400">
|
||||||
<div className="mr-3 h-px w-[93px] bg-gradient-to-l from-[#F3F4F6]" />
|
<div className="mr-3 h-px w-[93px] bg-gradient-to-l from-[#F3F4F6]" />
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(({
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
{showClearIcon && value && !disabled && !destructive && (
|
{!!(showClearIcon && value && !disabled && !destructive) && (
|
||||||
<div
|
<div
|
||||||
className={cn('group absolute right-2 top-1/2 -translate-y-1/2 cursor-pointer p-[1px]')}
|
className={cn('group absolute right-2 top-1/2 -translate-y-1/2 cursor-pointer p-[1px]')}
|
||||||
onClick={onClear}
|
onClick={onClear}
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ export default function Modal({
|
||||||
<div className={cn('flex min-h-full items-center justify-center p-4 text-center', containerClassName)}>
|
<div className={cn('flex min-h-full items-center justify-center p-4 text-center', containerClassName)}>
|
||||||
<TransitionChild>
|
<TransitionChild>
|
||||||
<DialogPanel className={cn('relative w-full max-w-[480px] rounded-2xl bg-components-panel-bg p-6 text-left align-middle shadow-xl transition-all', overflowVisible ? 'overflow-visible' : 'overflow-hidden', 'duration-100 ease-in data-[closed]:scale-95 data-[closed]:opacity-0', 'data-[enter]:scale-100 data-[enter]:opacity-100', 'data-[enter]:scale-95 data-[leave]:opacity-0', className)}>
|
<DialogPanel className={cn('relative w-full max-w-[480px] rounded-2xl bg-components-panel-bg p-6 text-left align-middle shadow-xl transition-all', overflowVisible ? 'overflow-visible' : 'overflow-hidden', 'duration-100 ease-in data-[closed]:scale-95 data-[closed]:opacity-0', 'data-[enter]:scale-100 data-[enter]:opacity-100', 'data-[enter]:scale-95 data-[leave]:opacity-0', className)}>
|
||||||
{title && (
|
{!!title && (
|
||||||
<DialogTitle
|
<DialogTitle
|
||||||
as="h3"
|
as="h3"
|
||||||
className="title-2xl-semi-bold text-text-primary"
|
className="title-2xl-semi-bold text-text-primary"
|
||||||
|
|
@ -60,7 +60,7 @@ export default function Modal({
|
||||||
{title}
|
{title}
|
||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
)}
|
)}
|
||||||
{description && (
|
{!!description && (
|
||||||
<div className="body-md-regular mt-2 text-text-secondary">
|
<div className="body-md-regular mt-2 text-text-secondary">
|
||||||
{description}
|
{description}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ const Modal = ({
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{
|
{
|
||||||
children && (
|
!!children && (
|
||||||
<div className="min-h-0 flex-1 overflow-y-auto px-6 py-3">{children}</div>
|
<div className="min-h-0 flex-1 overflow-y-auto px-6 py-3">{children}</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -125,7 +125,7 @@ const Modal = ({
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{bottomSlot && (
|
{!!bottomSlot && (
|
||||||
<div className="shrink-0">
|
<div className="shrink-0">
|
||||||
{bottomSlot}
|
{bottomSlot}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ const RadioCard: FC<Props> = ({
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{((isChosen && chosenConfig) || noRadio) && (
|
{!!((isChosen && chosenConfig) || noRadio) && (
|
||||||
<div className="mt-2 flex gap-x-2">
|
<div className="mt-2 flex gap-x-2">
|
||||||
<div className="size-8 shrink-0"></div>
|
<div className="size-8 shrink-0"></div>
|
||||||
<div className={cn(chosenConfigWrapClassName, 'grow')}>
|
<div className={cn(chosenConfigWrapClassName, 'grow')}>
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ export default function Radio({
|
||||||
)}
|
)}
|
||||||
onClick={() => handleChange(value)}
|
onClick={() => handleChange(value)}
|
||||||
>
|
>
|
||||||
{children && (
|
{!!children && (
|
||||||
<label
|
<label
|
||||||
className={
|
className={
|
||||||
cn(labelClassName, 'cursor-pointer text-sm')
|
cn(labelClassName, 'cursor-pointer text-sm')
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ export const SegmentedControl = <T extends string | number | symbol>({
|
||||||
{text && (
|
{text && (
|
||||||
<div className={cn('inline-flex items-center gap-x-1', ItemTextWrapperVariants({ size }))}>
|
<div className={cn('inline-flex items-center gap-x-1', ItemTextWrapperVariants({ size }))}>
|
||||||
<span>{text}</span>
|
<span>{text}</span>
|
||||||
{count && size === 'large' && (
|
{!!(count && size === 'large') && (
|
||||||
<div className="system-2xs-medium-uppercase inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-[5px] border border-divider-deep bg-components-badge-bg-dimm px-[5px] text-text-tertiary">
|
<div className="system-2xs-medium-uppercase inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-[5px] border border-divider-deep bg-components-badge-bg-dimm px-[5px] text-text-tertiary">
|
||||||
{count}
|
{count}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -379,7 +379,7 @@ const PortalSelect: FC<PortalSelectProps> = ({
|
||||||
{selectedItem?.name ?? localPlaceholder}
|
{selectedItem?.name ?? localPlaceholder}
|
||||||
</span>
|
</span>
|
||||||
<div className="mx-0.5">
|
<div className="mx-0.5">
|
||||||
{installedValue && selectedItem && selectedItem.value !== installedValue && (
|
{!!(installedValue && selectedItem && selectedItem.value !== installedValue) && (
|
||||||
<Badge>
|
<Badge>
|
||||||
{installedValue}
|
{installedValue}
|
||||||
{' '}
|
{' '}
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ const Toast = ({
|
||||||
<div className="system-sm-semibold text-text-primary [word-break:break-word]">{message}</div>
|
<div className="system-sm-semibold text-text-primary [word-break:break-word]">{message}</div>
|
||||||
{customComponent}
|
{customComponent}
|
||||||
</div>
|
</div>
|
||||||
{children && (
|
{!!children && (
|
||||||
<div className="system-xs-regular text-text-secondary">
|
<div className="system-xs-regular text-text-secondary">
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,11 @@ export const ToolTipContent: FC<ToolTipContentProps> = ({
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<div className="w-[180px]">
|
<div className="w-[180px]">
|
||||||
{title && (
|
{!!title && (
|
||||||
<div className="mb-1.5 font-semibold text-text-secondary">{title}</div>
|
<div className="mb-1.5 font-semibold text-text-secondary">{title}</div>
|
||||||
)}
|
)}
|
||||||
<div className="mb-1.5 text-text-tertiary">{children}</div>
|
<div className="mb-1.5 text-text-tertiary">{children}</div>
|
||||||
{action && <div className="cursor-pointer text-text-accent">{action}</div>}
|
{!!action && <div className="cursor-pointer text-text-accent">{action}</div>}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ const Tooltip: FC<TooltipProps> = ({
|
||||||
<PortalToFollowElemContent
|
<PortalToFollowElemContent
|
||||||
className={cn('z-[9999]', portalContentClassName || '')}
|
className={cn('z-[9999]', portalContentClassName || '')}
|
||||||
>
|
>
|
||||||
{popupContent && (
|
{!!popupContent && (
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
!noDecoration && 'system-xs-regular relative max-w-[300px] break-words rounded-md bg-components-panel-bg px-3 py-2 text-left text-text-tertiary shadow-lg',
|
!noDecoration && 'system-xs-regular relative max-w-[300px] break-words rounded-md bg-components-panel-bg px-3 py-2 text-left text-text-tertiary shadow-lg',
|
||||||
|
|
|
||||||
|
|
@ -87,10 +87,10 @@ export const OptionCard: FC<OptionCardProps> = (
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
/>
|
/>
|
||||||
{/** Body */}
|
{/** Body */}
|
||||||
{isActive && (children || actions) && (
|
{!!(isActive && (children || actions)) && (
|
||||||
<div className="rounded-b-xl bg-components-panel-bg px-4 py-3">
|
<div className="rounded-b-xl bg-components-panel-bg px-4 py-3">
|
||||||
{children}
|
{children}
|
||||||
{actions && (
|
{!!actions && (
|
||||||
<div className="mt-4 flex gap-2">
|
<div className="mt-4 flex gap-2">
|
||||||
{actions}
|
{actions}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -508,7 +508,7 @@ const DocumentList: FC<IDocumentListProps> = ({
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{/* Show Pagination only if the total is more than the limit */}
|
{/* Show Pagination only if the total is more than the limit */}
|
||||||
{pagination.total && (
|
{!!pagination.total && (
|
||||||
<Pagination
|
<Pagination
|
||||||
{...pagination}
|
{...pagination}
|
||||||
className="w-full shrink-0"
|
className="w-full shrink-0"
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ vi.mock('@/app/components/datasets/documents/detail/metadata', () => ({
|
||||||
<div data-testid="field-info" data-label={label}>
|
<div data-testid="field-info" data-label={label}>
|
||||||
<span data-testid="field-label">{label}</span>
|
<span data-testid="field-label">{label}</span>
|
||||||
<span data-testid="field-value">{displayedValue}</span>
|
<span data-testid="field-value">{displayedValue}</span>
|
||||||
{valueIcon && <span data-testid="field-icon">{valueIcon}</span>}
|
{!!valueIcon && <span data-testid="field-icon">{valueIcon}</span>}
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
}))
|
}))
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ const DocModeInfo = ({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="system-2xs-medium-uppercase flex items-center gap-x-3 text-text-tertiary">
|
<div className="system-2xs-medium-uppercase flex items-center gap-x-3 text-text-tertiary">
|
||||||
{dataset.doc_form && (
|
{!!dataset.doc_form && (
|
||||||
<span
|
<span
|
||||||
className="min-w-0 max-w-full truncate"
|
className="min-w-0 max-w-full truncate"
|
||||||
title={t(`chunkingMode.${DOC_FORM_TEXT[dataset.doc_form]}`, { ns: 'dataset' })}
|
title={t(`chunkingMode.${DOC_FORM_TEXT[dataset.doc_form]}`, { ns: 'dataset' })}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ vi.mock('../../../base/modal-like-wrap', () => ({
|
||||||
default: ({ children, title, onClose, onConfirm, beforeHeader }: ModalLikeWrapProps) => (
|
default: ({ children, title, onClose, onConfirm, beforeHeader }: ModalLikeWrapProps) => (
|
||||||
<div data-testid="modal-wrap">
|
<div data-testid="modal-wrap">
|
||||||
<div data-testid="modal-title">{title}</div>
|
<div data-testid="modal-title">{title}</div>
|
||||||
{beforeHeader && <div data-testid="before-header">{beforeHeader}</div>}
|
{!!beforeHeader && <div data-testid="before-header">{beforeHeader}</div>}
|
||||||
<div data-testid="modal-content">{children}</div>
|
<div data-testid="modal-content">{children}</div>
|
||||||
<button data-testid="close-btn" onClick={onClose}>Close</button>
|
<button data-testid="close-btn" onClick={onClose}>Close</button>
|
||||||
<button data-testid="confirm-btn" onClick={onConfirm}>Confirm</button>
|
<button data-testid="confirm-btn" onClick={onConfirm}>Confirm</button>
|
||||||
|
|
|
||||||
|
|
@ -265,7 +265,7 @@ const Form = () => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{
|
{
|
||||||
currentDataset?.doc_form && (
|
!!currentDataset?.doc_form && (
|
||||||
<>
|
<>
|
||||||
<Divider
|
<Divider
|
||||||
type="horizontal"
|
type="horizontal"
|
||||||
|
|
@ -298,13 +298,13 @@ const Form = () => {
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
{(isShowIndexMethod || indexMethod === 'high_quality') && (
|
{!!(isShowIndexMethod || indexMethod === 'high_quality') && (
|
||||||
<Divider
|
<Divider
|
||||||
type="horizontal"
|
type="horizontal"
|
||||||
className="my-1 h-px bg-divider-subtle"
|
className="my-1 h-px bg-divider-subtle"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{isShowIndexMethod && (
|
{!!isShowIndexMethod && (
|
||||||
<div className={rowClass}>
|
<div className={rowClass}>
|
||||||
<div className={labelClass}>
|
<div className={labelClass}>
|
||||||
<div className="system-sm-semibold text-text-secondary">{t('form.indexMethod', { ns: 'datasetSettings' })}</div>
|
<div className="system-sm-semibold text-text-secondary">{t('form.indexMethod', { ns: 'datasetSettings' })}</div>
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ const OptionCard = <T,>({
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
icon && (
|
!!icon && (
|
||||||
<div className={cn(
|
<div className={cn(
|
||||||
'flex size-6 shrink-0 items-center justify-center text-text-tertiary',
|
'flex size-6 shrink-0 items-center justify-center text-text-tertiary',
|
||||||
isActive && iconActiveColor,
|
isActive && iconActiveColor,
|
||||||
|
|
@ -110,7 +110,7 @@ const OptionCard = <T,>({
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{
|
{
|
||||||
children && showChildren && (
|
!!(children && showChildren) && (
|
||||||
<div className="relative rounded-b-xl bg-components-panel-bg p-4">
|
<div className="relative rounded-b-xl bg-components-panel-bg p-4">
|
||||||
<ArrowShape className="absolute left-[14px] top-[-11px] size-4 text-components-panel-bg" />
|
<ArrowShape className="absolute left-[14px] top-[-11px] size-4 text-components-panel-bg" />
|
||||||
{children}
|
{children}
|
||||||
|
|
|
||||||
|
|
@ -48,21 +48,21 @@ const ModelName: FC<ModelNameProps> = ({
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-0.5">
|
<div className="flex items-center gap-0.5">
|
||||||
{
|
{
|
||||||
showModelType && modelItem.model_type && (
|
!!(showModelType && modelItem.model_type) && (
|
||||||
<ModelBadge className={modelTypeClassName}>
|
<ModelBadge className={modelTypeClassName}>
|
||||||
{modelTypeFormat(modelItem.model_type)}
|
{modelTypeFormat(modelItem.model_type)}
|
||||||
</ModelBadge>
|
</ModelBadge>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
modelItem.model_properties.mode && showMode && (
|
!!(modelItem.model_properties.mode && showMode) && (
|
||||||
<ModelBadge className={modeClassName}>
|
<ModelBadge className={modeClassName}>
|
||||||
{(modelItem.model_properties.mode as string).toLocaleUpperCase()}
|
{(modelItem.model_properties.mode as string).toLocaleUpperCase()}
|
||||||
</ModelBadge>
|
</ModelBadge>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
showContextSize && modelItem.model_properties.context_size && (
|
!!(showContextSize && modelItem.model_properties.context_size) && (
|
||||||
<ModelBadge>
|
<ModelBadge>
|
||||||
{sizeFormat(modelItem.model_properties.context_size as number)}
|
{sizeFormat(modelItem.model_properties.context_size as number)}
|
||||||
</ModelBadge>
|
</ModelBadge>
|
||||||
|
|
|
||||||
|
|
@ -96,17 +96,17 @@ const PopupItem: FC<PopupItemProps> = ({
|
||||||
<div className='text-text-tertiary system-xs-regular'>{currentProvider?.description?.[language] || currentProvider?.description?.en_US}</div>
|
<div className='text-text-tertiary system-xs-regular'>{currentProvider?.description?.[language] || currentProvider?.description?.en_US}</div>
|
||||||
)} */}
|
)} */}
|
||||||
<div className="flex flex-wrap gap-1">
|
<div className="flex flex-wrap gap-1">
|
||||||
{modelItem.model_type && (
|
{!!modelItem.model_type && (
|
||||||
<ModelBadge>
|
<ModelBadge>
|
||||||
{modelTypeFormat(modelItem.model_type)}
|
{modelTypeFormat(modelItem.model_type)}
|
||||||
</ModelBadge>
|
</ModelBadge>
|
||||||
)}
|
)}
|
||||||
{modelItem.model_properties.mode && (
|
{!!modelItem.model_properties.mode && (
|
||||||
<ModelBadge>
|
<ModelBadge>
|
||||||
{(modelItem.model_properties.mode as string).toLocaleUpperCase()}
|
{(modelItem.model_properties.mode as string).toLocaleUpperCase()}
|
||||||
</ModelBadge>
|
</ModelBadge>
|
||||||
)}
|
)}
|
||||||
{modelItem.model_properties.context_size && (
|
{!!modelItem.model_properties.context_size && (
|
||||||
<ModelBadge>
|
<ModelBadge>
|
||||||
{sizeFormat(modelItem.model_properties.context_size as number)}
|
{sizeFormat(modelItem.model_properties.context_size as number)}
|
||||||
</ModelBadge>
|
</ModelBadge>
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ vi.mock('@/app/components/base/app-icon', () => ({
|
||||||
data-size={size}
|
data-size={size}
|
||||||
data-icon-type={iconType}
|
data-icon-type={iconType}
|
||||||
>
|
>
|
||||||
{innerIcon && <div data-testid="inner-icon">{innerIcon}</div>}
|
{!!innerIcon && <div data-testid="inner-icon">{innerIcon}</div>}
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
}))
|
}))
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ const Card = ({
|
||||||
text={getLocalizedText(brief)}
|
text={getLocalizedText(brief)}
|
||||||
descriptionLineRows={descriptionLineRows}
|
descriptionLineRows={descriptionLineRows}
|
||||||
/>
|
/>
|
||||||
{footer && <div>{footer}</div>}
|
{!!footer && <div>{footer}</div>}
|
||||||
</div>
|
</div>
|
||||||
{limitedInstall
|
{limitedInstall
|
||||||
&& (
|
&& (
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ vi.mock('../../../card', () => ({
|
||||||
default: ({ payload, titleLeft }: { payload: Plugin, titleLeft?: React.ReactNode }) => (
|
default: ({ payload, titleLeft }: { payload: Plugin, titleLeft?: React.ReactNode }) => (
|
||||||
<div data-testid="plugin-card">
|
<div data-testid="plugin-card">
|
||||||
<span data-testid="card-name">{payload.name}</span>
|
<span data-testid="card-name">{payload.name}</span>
|
||||||
{titleLeft && <span data-testid="title-left">{titleLeft}</span>}
|
{!!titleLeft && <span data-testid="title-left">{titleLeft}</span>}
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
}))
|
}))
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ vi.mock('../../../card', () => ({
|
||||||
<div data-testid="plugin-card">
|
<div data-testid="plugin-card">
|
||||||
<span data-testid="card-payload-name">{payload?.name}</span>
|
<span data-testid="card-payload-name">{payload?.name}</span>
|
||||||
<span data-testid="card-limited-install">{limitedInstall ? 'true' : 'false'}</span>
|
<span data-testid="card-limited-install">{limitedInstall ? 'true' : 'false'}</span>
|
||||||
{titleLeft && <div data-testid="card-title-left">{titleLeft}</div>}
|
{!!titleLeft && <div data-testid="card-title-left">{titleLeft}</div>}
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
}))
|
}))
|
||||||
|
|
|
||||||
|
|
@ -279,7 +279,7 @@ vi.mock('@/app/components/plugins/card', () => ({
|
||||||
default: ({ payload, footer }: { payload: Plugin, footer?: React.ReactNode }) => (
|
default: ({ payload, footer }: { payload: Plugin, footer?: React.ReactNode }) => (
|
||||||
<div data-testid={`card-${payload.name}`}>
|
<div data-testid={`card-${payload.name}`}>
|
||||||
<div data-testid="card-name">{payload.name}</div>
|
<div data-testid="card-name">{payload.name}</div>
|
||||||
{footer && <div data-testid="card-footer">{footer}</div>}
|
{!!footer && <div data-testid="card-footer">{footer}</div>}
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
}))
|
}))
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ vi.mock('@/app/components/plugins/card', () => ({
|
||||||
<div data-testid={`card-${payload.name}`}>
|
<div data-testid={`card-${payload.name}`}>
|
||||||
<div data-testid="card-name">{payload.name}</div>
|
<div data-testid="card-name">{payload.name}</div>
|
||||||
<div data-testid="card-label">{payload.label?.['en-US'] || payload.name}</div>
|
<div data-testid="card-label">{payload.label?.['en-US'] || payload.name}</div>
|
||||||
{footer && <div data-testid="card-footer">{footer}</div>}
|
{!!footer && <div data-testid="card-footer">{footer}</div>}
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
}))
|
}))
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,7 @@ const DetailHeader = ({
|
||||||
<div className="flex h-5 items-center">
|
<div className="flex h-5 items-center">
|
||||||
<Title title={label[locale]} />
|
<Title title={label[locale]} />
|
||||||
{verified && !isReadmeView && <Verified className="ml-0.5 h-4 w-4" text={t('marketplace.verifiedTip', { ns: 'plugin' })} />}
|
{verified && !isReadmeView && <Verified className="ml-0.5 h-4 w-4" text={t('marketplace.verifiedTip', { ns: 'plugin' })} />}
|
||||||
{version && (
|
{!!version && (
|
||||||
<PluginVersionPicker
|
<PluginVersionPicker
|
||||||
disabled={!isFromMarketplace || isReadmeView}
|
disabled={!isFromMarketplace || isReadmeView}
|
||||||
isShow={isShow}
|
isShow={isShow}
|
||||||
|
|
@ -297,7 +297,7 @@ const DetailHeader = ({
|
||||||
orgName={author}
|
orgName={author}
|
||||||
packageName={name?.includes('/') ? (name.split('/').pop() || '') : name}
|
packageName={name?.includes('/') ? (name.split('/').pop() || '') : name}
|
||||||
/>
|
/>
|
||||||
{source && (
|
{!!source && (
|
||||||
<>
|
<>
|
||||||
<div className="system-xs-regular ml-1 mr-0.5 text-text-quaternary">·</div>
|
<div className="system-xs-regular ml-1 mr-0.5 text-text-quaternary">·</div>
|
||||||
{source === PluginSource.marketplace && (
|
{source === PluginSource.marketplace && (
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,7 @@ vi.mock('@/app/components/base/modal/modal', () => ({
|
||||||
{extraButtonText}
|
{extraButtonText}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
{bottomSlot && <div data-testid="modal-bottom-slot">{bottomSlot}</div>}
|
{!!bottomSlot && <div data-testid="modal-bottom-slot">{bottomSlot}</div>}
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
}))
|
}))
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ vi.mock('@/app/components/base/app-icon', () => ({
|
||||||
data-size={size}
|
data-size={size}
|
||||||
data-icon-type={iconType}
|
data-icon-type={iconType}
|
||||||
>
|
>
|
||||||
{innerIcon && <div data-testid="inner-icon">{innerIcon}</div>}
|
{!!innerIcon && <div data-testid="inner-icon">{innerIcon}</div>}
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
}))
|
}))
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ const Empty = ({
|
||||||
<div className="mb-1 mt-2 text-[13px] font-medium leading-[18px] text-text-primary">
|
<div className="mb-1 mt-2 text-[13px] font-medium leading-[18px] text-text-primary">
|
||||||
{(hasTitle && renderType) ? t(`addToolModal.${renderType}.title`, { ns: 'tools' }) : 'No tools available'}
|
{(hasTitle && renderType) ? t(`addToolModal.${renderType}.title`, { ns: 'tools' }) : 'No tools available'}
|
||||||
</div>
|
</div>
|
||||||
{(!isAgent && hasTitle && renderType) && (
|
{!!(!isAgent && hasTitle && renderType) && (
|
||||||
<Comp className={cn('flex items-center text-[13px] leading-[18px] text-text-tertiary', hasLink && 'cursor-pointer hover:text-text-accent')} {...linkProps}>
|
<Comp className={cn('flex items-center text-[13px] leading-[18px] text-text-tertiary', hasLink && 'cursor-pointer hover:text-text-accent')} {...linkProps}>
|
||||||
{t(`addToolModal.${renderType}.tip`, { ns: 'tools' })}
|
{t(`addToolModal.${renderType}.tip`, { ns: 'tools' })}
|
||||||
{' '}
|
{' '}
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ const Base: FC<Props> = ({
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{headerRight}
|
{headerRight}
|
||||||
{showCodeGenerator && codeLanguages && (
|
{!!(showCodeGenerator && codeLanguages) && (
|
||||||
<div className="ml-1">
|
<div className="ml-1">
|
||||||
<CodeGeneratorButton
|
<CodeGeneratorButton
|
||||||
onGenerated={onGenerated}
|
onGenerated={onGenerated}
|
||||||
|
|
@ -119,7 +119,7 @@ const Base: FC<Props> = ({
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{tip && <div className="px-1 py-0.5">{tip}</div>}
|
{!!tip && <div className="px-1 py-0.5">{tip}</div>}
|
||||||
<PromptEditorHeightResizeWrap
|
<PromptEditorHeightResizeWrap
|
||||||
height={isExpand ? editorExpandHeight : editorContentHeight}
|
height={isExpand ? editorExpandHeight : editorContentHeight}
|
||||||
minHeight={editorContentMinHeight}
|
minHeight={editorContentMinHeight}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ const Field: FC<Props> = ({
|
||||||
{' '}
|
{' '}
|
||||||
{required && <span className="text-text-destructive">*</span>}
|
{required && <span className="text-text-destructive">*</span>}
|
||||||
</div>
|
</div>
|
||||||
{tooltip && (
|
{!!tooltip && (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
popupContent={tooltip}
|
popupContent={tooltip}
|
||||||
popupClassName="ml-1"
|
popupClassName="ml-1"
|
||||||
|
|
@ -55,13 +55,13 @@ const Field: FC<Props> = ({
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex">
|
<div className="flex">
|
||||||
{operations && <div>{operations}</div>}
|
{!!operations && <div>{operations}</div>}
|
||||||
{supportFold && (
|
{supportFold && (
|
||||||
<RiArrowDownSLine className="h-4 w-4 cursor-pointer text-text-tertiary transition-transform" style={{ transform: fold ? 'rotate(-90deg)' : 'rotate(0deg)' }} />
|
<RiArrowDownSLine className="h-4 w-4 cursor-pointer text-text-tertiary transition-transform" style={{ transform: fold ? 'rotate(-90deg)' : 'rotate(0deg)' }} />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{children && (!supportFold || (supportFold && !fold)) && <div className={cn(!inline && 'mt-1')}>{children}</div>}
|
{!!(children && (!supportFold || (supportFold && !fold))) && <div className={cn(!inline && 'mt-1')}>{children}</div>}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,7 @@ const Editor: FC<Props> = ({
|
||||||
{' '}
|
{' '}
|
||||||
{required && <span className="text-text-destructive">*</span>}
|
{required && <span className="text-text-destructive">*</span>}
|
||||||
</div>
|
</div>
|
||||||
{titleTooltip && <Tooltip popupContent={titleTooltip} />}
|
{!!titleTooltip && <Tooltip popupContent={titleTooltip} />}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
<div className="text-xs font-medium leading-[18px] text-text-tertiary">{value?.length || 0}</div>
|
<div className="text-xs font-medium leading-[18px] text-text-tertiary">{value?.length || 0}</div>
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ const VariableLabel = ({
|
||||||
notShowFullPath={notShowFullPath}
|
notShowFullPath={notShowFullPath}
|
||||||
/>
|
/>
|
||||||
{
|
{
|
||||||
variableType && (
|
!!variableType && (
|
||||||
<div className="system-xs-regular shrink-0 text-text-tertiary">
|
<div className="system-xs-regular shrink-0 text-text-tertiary">
|
||||||
{capitalize(variableType)}
|
{capitalize(variableType)}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -275,7 +275,7 @@ const BaseNode: FC<BaseNodeProps> = ({
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
{
|
{
|
||||||
data._iterationLength && data._iterationIndex && data._runningStatus === NodeRunningStatus.Running && (
|
!!(data._iterationLength && data._iterationIndex && data._runningStatus === NodeRunningStatus.Running) && (
|
||||||
<div className="mr-1.5 text-xs font-medium text-text-accent">
|
<div className="mr-1.5 text-xs font-medium text-text-accent">
|
||||||
{data._iterationIndex > data._iterationLength ? data._iterationLength : data._iterationIndex}
|
{data._iterationIndex > data._iterationLength ? data._iterationLength : data._iterationIndex}
|
||||||
/
|
/
|
||||||
|
|
@ -284,7 +284,7 @@ const BaseNode: FC<BaseNodeProps> = ({
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
data.type === BlockEnum.Loop && data._loopIndex && LoopIndex
|
!!(data.type === BlockEnum.Loop && data._loopIndex) && LoopIndex
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
isLoading
|
isLoading
|
||||||
|
|
@ -327,7 +327,7 @@ const BaseNode: FC<BaseNodeProps> = ({
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
data.desc && data.type !== BlockEnum.Iteration && data.type !== BlockEnum.Loop && (
|
!!(data.desc && data.type !== BlockEnum.Iteration && data.type !== BlockEnum.Loop) && (
|
||||||
<div className="system-xs-regular whitespace-pre-line break-words px-3 pb-2 pt-1 text-text-tertiary">
|
<div className="system-xs-regular whitespace-pre-line break-words px-3 pb-2 pt-1 text-text-tertiary">
|
||||||
{data.desc}
|
{data.desc}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,7 @@ const VarList: FC<Props> = ({
|
||||||
className="w-full"
|
className="w-full"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{item.operation === WriteMode.set && assignedVarType && (
|
{!!(item.operation === WriteMode.set && assignedVarType) && (
|
||||||
<>
|
<>
|
||||||
{assignedVarType === 'number' && (
|
{assignedVarType === 'number' && (
|
||||||
<Input
|
<Input
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ const NodeComponent: FC<NodeProps<AssignerNodeType>> = ({
|
||||||
nodeType={node?.data.type}
|
nodeType={node?.data.type}
|
||||||
nodeTitle={node?.data.title}
|
nodeTitle={node?.data.title}
|
||||||
rightSlot={
|
rightSlot={
|
||||||
value.operation && <Badge className="!ml-auto shrink-0" text={t(`${i18nPrefix}.operations.${value.operation}`, { ns: 'workflow' })} />
|
!!value.operation && <Badge className="!ml-auto shrink-0" text={t(`${i18nPrefix}.operations.${value.operation}`, { ns: 'workflow' })} />
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ const ChunkStructure = ({
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
chunkStructure && (
|
!!chunkStructure && (
|
||||||
<OptionCard
|
<OptionCard
|
||||||
{...optionMap[chunkStructure]}
|
{...optionMap[chunkStructure]}
|
||||||
selectedId={chunkStructure}
|
selectedId={chunkStructure}
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ const OptionCard = memo(({
|
||||||
>
|
>
|
||||||
{effectElement}
|
{effectElement}
|
||||||
{
|
{
|
||||||
icon && (
|
!!icon && (
|
||||||
<div className="mr-1 flex h-[18px] w-[18px] shrink-0 items-center justify-center">
|
<div className="mr-1 flex h-[18px] w-[18px] shrink-0 items-center justify-center">
|
||||||
{typeof icon === 'function' ? icon(isActive) : icon}
|
{typeof icon === 'function' ? icon(isActive) : icon}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -139,7 +139,7 @@ const OptionCard = memo(({
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{
|
{
|
||||||
children && isActive && (
|
!!(children && isActive) && (
|
||||||
<div className="relative rounded-b-xl bg-components-panel-bg p-3">
|
<div className="relative rounded-b-xl bg-components-panel-bg p-3">
|
||||||
<ArrowShape className="absolute left-[14px] top-[-11px] h-4 w-4 text-components-panel-bg" />
|
<ArrowShape className="absolute left-[14px] top-[-11px] h-4 w-4 text-components-panel-bg" />
|
||||||
{children}
|
{children}
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ const Panel: FC<NodePanelProps<KnowledgeBaseNodeType>> = ({
|
||||||
/>
|
/>
|
||||||
</Group>
|
</Group>
|
||||||
{
|
{
|
||||||
data.chunk_structure && (
|
!!data.chunk_structure && (
|
||||||
<>
|
<>
|
||||||
<BoxGroupField
|
<BoxGroupField
|
||||||
boxGroupProps={{
|
boxGroupProps={{
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ const DatasetItem: FC<Props> = ({
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{
|
{
|
||||||
payload.indexing_technique && (
|
!!payload.indexing_technique && (
|
||||||
<Badge
|
<Badge
|
||||||
className="shrink-0 group-hover/dataset-item:hidden"
|
className="shrink-0 group-hover/dataset-item:hidden"
|
||||||
text={formatIndexingTechniqueAndMethod(payload.indexing_technique, payload.retrieval_model_dict?.search_method)}
|
text={formatIndexingTechniqueAndMethod(payload.indexing_technique, payload.retrieval_model_dict?.search_method)}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ const ConditionDate = ({
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
{
|
{
|
||||||
value && (
|
!!value && (
|
||||||
<RiCloseCircleFill
|
<RiCloseCircleFill
|
||||||
className={cn(
|
className={cn(
|
||||||
'hidden h-4 w-4 shrink-0 cursor-pointer hover:text-components-input-text-filled group-hover:block',
|
'hidden h-4 w-4 shrink-0 cursor-pointer hover:text-components-input-text-filled group-hover:block',
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ const ConfigPromptItem: FC<Props> = ({
|
||||||
|
|
||||||
<Tooltip
|
<Tooltip
|
||||||
popupContent={
|
popupContent={
|
||||||
<div className="max-w-[180px]">{payload.role && t(`${i18nPrefix}.roleDescription.${payload.role}`, { ns: 'workflow' })}</div>
|
<div className="max-w-[180px]">{!!payload.role && t(`${i18nPrefix}.roleDescription.${payload.role}`, { ns: 'workflow' })}</div>
|
||||||
}
|
}
|
||||||
triggerClassName="w-4 h-4"
|
triggerClassName="w-4 h-4"
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ const ConditionList = ({
|
||||||
className="absolute right-1 top-1/2 flex h-[21px] -translate-y-1/2 cursor-pointer select-none items-center rounded-md border-[0.5px] border-components-button-secondary-border bg-components-button-secondary-bg px-1 text-[10px] font-semibold text-text-accent-secondary shadow-xs"
|
className="absolute right-1 top-1/2 flex h-[21px] -translate-y-1/2 cursor-pointer select-none items-center rounded-md border-[0.5px] border-components-button-secondary-border bg-components-button-secondary-bg px-1 text-[10px] font-semibold text-text-accent-secondary shadow-xs"
|
||||||
onClick={() => doToggleConditionLogicalOperator(conditionId)}
|
onClick={() => doToggleConditionLogicalOperator(conditionId)}
|
||||||
>
|
>
|
||||||
{logicalOperator && logicalOperator.toUpperCase()}
|
{!!logicalOperator && logicalOperator.toUpperCase()}
|
||||||
<RiLoopLeftLine className="ml-0.5 h-3 w-3" />
|
<RiLoopLeftLine className="ml-0.5 h-3 w-3" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ const ConversationVariableModal = ({
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
{latestValueTimestampMap[currentVar.id] && (
|
{!!latestValueTimestampMap[currentVar.id] && (
|
||||||
<div className="system-xs-regular shrink-0 text-text-tertiary">
|
<div className="system-xs-regular shrink-0 text-text-tertiary">
|
||||||
{t('chatVariable.updatedAt', { ns: 'workflow' })}
|
{t('chatVariable.updatedAt', { ns: 'workflow' })}
|
||||||
{formatTime(latestValueTimestampMap[currentVar.id], t('dateTimeFormat', { ns: 'appLog' }) as string)}
|
{formatTime(latestValueTimestampMap[currentVar.id], t('dateTimeFormat', { ns: 'appLog' }) as string)}
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ const AgentLogItem = ({
|
||||||
{label}
|
{label}
|
||||||
</div>
|
</div>
|
||||||
{
|
{
|
||||||
metadata?.elapsed_time && (
|
!!metadata?.elapsed_time && (
|
||||||
<div className="system-xs-regular mr-2 shrink-0 text-text-tertiary">
|
<div className="system-xs-regular mr-2 shrink-0 text-text-tertiary">
|
||||||
{metadata?.elapsed_time?.toFixed(3)}
|
{metadata?.elapsed_time?.toFixed(3)}
|
||||||
s
|
s
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import { defineConfig, importESLintRules } from '@tsslint/config'
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
rules: {
|
rules: {
|
||||||
...await importESLintRules({
|
...await importESLintRules({
|
||||||
'react-x/no-leaked-conditional-rendering': 'warn',
|
'react-x/no-leaked-conditional-rendering': 'error',
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue