mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-07-31 23:42:01 +08:00
This commit is contained in:
parent
7b7ac7a495
commit
d796fcc0e7
@ -270,7 +270,7 @@ const DatasetConfig: FC = () => {
|
|||||||
handleMetadataModelChange={handleMetadataModelChange}
|
handleMetadataModelChange={handleMetadataModelChange}
|
||||||
handleMetadataCompletionParamsChange={handleMetadataCompletionParamsChange}
|
handleMetadataCompletionParamsChange={handleMetadataCompletionParamsChange}
|
||||||
isCommonVariable
|
isCommonVariable
|
||||||
availableCommonStringVars={promptVariablesToSelect.filter(item => item.type === MetadataFilteringVariableType.string)}
|
availableCommonStringVars={promptVariablesToSelect.filter(item => item.type === MetadataFilteringVariableType.string || item.type === MetadataFilteringVariableType.select)}
|
||||||
availableCommonNumberVars={promptVariablesToSelect.filter(item => item.type === MetadataFilteringVariableType.number)}
|
availableCommonNumberVars={promptVariablesToSelect.filter(item => item.type === MetadataFilteringVariableType.number)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -77,7 +77,9 @@ const ConditionItem = ({
|
|||||||
|
|
||||||
const valueAndValueMethod = useMemo(() => {
|
const valueAndValueMethod = useMemo(() => {
|
||||||
if (
|
if (
|
||||||
(currentMetadata?.type === MetadataFilteringVariableType.string || currentMetadata?.type === MetadataFilteringVariableType.number)
|
(currentMetadata?.type === MetadataFilteringVariableType.string
|
||||||
|
|| currentMetadata?.type === MetadataFilteringVariableType.number
|
||||||
|
|| currentMetadata?.type === MetadataFilteringVariableType.select)
|
||||||
&& typeof condition.value === 'string'
|
&& typeof condition.value === 'string'
|
||||||
) {
|
) {
|
||||||
const regex = isCommonVariable ? COMMON_VARIABLE_REGEX : VARIABLE_REGEX
|
const regex = isCommonVariable ? COMMON_VARIABLE_REGEX : VARIABLE_REGEX
|
||||||
@ -140,7 +142,9 @@ const ConditionItem = ({
|
|||||||
</div>
|
</div>
|
||||||
<div className='border-t border-t-divider-subtle'>
|
<div className='border-t border-t-divider-subtle'>
|
||||||
{
|
{
|
||||||
!comparisonOperatorNotRequireValue(condition.comparison_operator) && currentMetadata?.type === MetadataFilteringVariableType.string && (
|
!comparisonOperatorNotRequireValue(condition.comparison_operator)
|
||||||
|
&& (currentMetadata?.type === MetadataFilteringVariableType.string
|
||||||
|
|| currentMetadata?.type === MetadataFilteringVariableType.select) && (
|
||||||
<ConditionString
|
<ConditionString
|
||||||
valueMethod={localValueMethod}
|
valueMethod={localValueMethod}
|
||||||
onValueMethodChange={handleValueMethodChange}
|
onValueMethodChange={handleValueMethodChange}
|
||||||
|
@ -22,6 +22,7 @@ export const isComparisonOperatorNeedTranslate = (operator?: ComparisonOperator)
|
|||||||
export const getOperators = (type?: MetadataFilteringVariableType) => {
|
export const getOperators = (type?: MetadataFilteringVariableType) => {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case MetadataFilteringVariableType.string:
|
case MetadataFilteringVariableType.string:
|
||||||
|
case MetadataFilteringVariableType.select:
|
||||||
return [
|
return [
|
||||||
ComparisonOperator.is,
|
ComparisonOperator.is,
|
||||||
ComparisonOperator.isNot,
|
ComparisonOperator.isNot,
|
||||||
|
@ -18,7 +18,7 @@ const MetadataIcon = ({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{
|
{
|
||||||
type === MetadataFilteringVariableType.string && (
|
(type === MetadataFilteringVariableType.string || type === MetadataFilteringVariableType.select) && (
|
||||||
<RiTextSnippet className={cn('h-3.5 w-3.5', className)} />
|
<RiTextSnippet className={cn('h-3.5 w-3.5', className)} />
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -80,6 +80,7 @@ export enum MetadataFilteringVariableType {
|
|||||||
string = 'string',
|
string = 'string',
|
||||||
number = 'number',
|
number = 'number',
|
||||||
time = 'time',
|
time = 'time',
|
||||||
|
select = 'select',
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MetadataFilteringCondition = {
|
export type MetadataFilteringCondition = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user