- {label[language] || label.en_US}
+ {translatedLabel}
{required && (
*
@@ -313,6 +314,7 @@ function Form<
handleFormChange(variable, nextValue)
}}
>
+
{translatedLabel}
{selectedOption?.name ?? placeholder?.[language] ?? placeholder?.en_US}
diff --git a/web/app/components/header/account-setting/model-provider-page/model-modal/__tests__/Form.spec.tsx b/web/app/components/header/account-setting/model-provider-page/model-modal/__tests__/Form.spec.tsx
index 11ff189393..3dc9e0f1d9 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-modal/__tests__/Form.spec.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-modal/__tests__/Form.spec.tsx
@@ -1234,7 +1234,7 @@ describe('Form', () => {
expect(screen.getByText('API Key'))!.toBeInTheDocument()
expect(screen.getByText('Region'))!.toBeInTheDocument()
- expect(screen.getByText('Model'))!.toBeInTheDocument()
+ expect(screen.getByRole('combobox', { name: 'Model' }))!.toBeInTheDocument()
expect(screen.getByText('Agree'))!.toBeInTheDocument()
expect(screen.getByLabelText('Enter your API key here'))!.toBeInTheDocument()
expect(screen.getByLabelText('Select region'))!.toBeInTheDocument()
@@ -1546,7 +1546,7 @@ describe('Form', () => {
expect(screen.getByText('API Key Fallback'))!.toBeInTheDocument()
expect(screen.getByText('Region Fallback'))!.toBeInTheDocument()
- expect(screen.getByText('Model Fallback'))!.toBeInTheDocument()
+ expect(screen.getByRole('combobox', { name: 'Model Fallback' }))!.toBeInTheDocument()
expect(screen.getByText('Agree Fallback'))!.toBeInTheDocument()
})
diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/__tests__/parameter-item.select.spec.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/__tests__/parameter-item.select.spec.tsx
index c221071b82..20f7089f73 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/__tests__/parameter-item.select.spec.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/__tests__/parameter-item.select.spec.tsx
@@ -20,6 +20,7 @@ vi.mock('@langgenius/dify-ui/select', async (importOriginal) => {
),
SelectContent: ({ children }: { children: ReactNode }) =>
{children}
,
SelectItem: ({ children }: { children: ReactNode }) =>
{children}
,
+ SelectLabel: () => null,
SelectTrigger: ({ children }: { children: ReactNode }) =>
{children}
,
SelectValue: () =>
SelectValue
,
SelectItemText: ({ children }: { children: ReactNode }) =>
{children} ,
diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/parameter-item.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/parameter-item.tsx
index 42ecb8f211..61f0192f92 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/parameter-item.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/parameter-item.tsx
@@ -8,7 +8,7 @@ import { FieldItem, FieldLabel, FieldRoot } from '@langgenius/dify-ui/field'
import { FieldsetLegend, FieldsetRoot } from '@langgenius/dify-ui/fieldset'
import { Radio } from '@langgenius/dify-ui/radio'
import { RadioGroup } from '@langgenius/dify-ui/radio-group'
-import { Select, SelectContent, SelectItem, SelectItemIndicator, SelectItemText, SelectTrigger, SelectValue } from '@langgenius/dify-ui/select'
+import { Select, SelectContent, SelectItem, SelectItemIndicator, SelectItemText, SelectLabel, SelectTrigger, SelectValue } from '@langgenius/dify-ui/select'
import { Slider } from '@langgenius/dify-ui/slider'
import { Switch } from '@langgenius/dify-ui/switch'
import { useEffect, useMemo, useRef, useState } from 'react'
@@ -165,58 +165,90 @@ function ParameterItem({
step = 10
}
- return (
- <>
- {numberInputWithSlide && (
-
- )}
+ if (!numberInputWithSlide) {
+ return (
- >
+ )
+ }
+
+ return (
+
+ {sliderLabel}
+
+
+
)
}
if (parameterRule.type === 'float') {
- return (
- <>
- {numberInputWithSlide && (
-
- )}
+ if (!numberInputWithSlide) {
+ return (
- >
+ )
+ }
+
+ return (
+
+ {sliderLabel}
+
+
+
)
}
@@ -317,6 +349,7 @@ function ParameterItem({
value={renderValue as string}
onValueChange={v => handleInputChange(v ?? undefined)}
>
+
{sliderLabel}
diff --git a/web/app/components/plugins/install-plugin/install-from-github/steps/__tests__/selectPackage.spec.tsx b/web/app/components/plugins/install-plugin/install-from-github/steps/__tests__/selectPackage.spec.tsx
index 102e79aa1a..352dad7136 100644
--- a/web/app/components/plugins/install-plugin/install-from-github/steps/__tests__/selectPackage.spec.tsx
+++ b/web/app/components/plugins/install-plugin/install-from-github/steps/__tests__/selectPackage.spec.tsx
@@ -38,6 +38,7 @@ vi.mock('@langgenius/dify-ui/select', async () => {
{children}
),
+ SelectLabel: ({ children }: { children: React.ReactNode }) =>
{children}
,
SelectTrigger: ({ children }: { children: React.ReactNode }) => {
const context = React.useContext(SelectContext)
return (
@@ -149,7 +150,8 @@ describe('SelectPackage', () => {
const getSection = (label: string): HTMLElement => {
const labelElement = screen.getByText(label)
- const section = labelElement.closest('label')?.nextElementSibling
+ const labelContainer = labelElement.closest('label') ?? labelElement.parentElement
+ const section = labelContainer?.parentElement
if (!(section instanceof HTMLElement))
throw new Error(`Missing section for ${label}`)
return section
diff --git a/web/app/components/plugins/install-plugin/install-from-github/steps/selectPackage.tsx b/web/app/components/plugins/install-plugin/install-from-github/steps/selectPackage.tsx
index 1dbd0f682e..dc7d8f75af 100644
--- a/web/app/components/plugins/install-plugin/install-from-github/steps/selectPackage.tsx
+++ b/web/app/components/plugins/install-plugin/install-from-github/steps/selectPackage.tsx
@@ -2,8 +2,8 @@
import type { PluginDeclaration, UpdateFromGitHubPayload } from '../../../types'
import { Button } from '@langgenius/dify-ui/button'
-import { FieldLabel, FieldRoot } from '@langgenius/dify-ui/field'
-import { Select, SelectContent, SelectItem, SelectItemIndicator, SelectItemText, SelectTrigger } from '@langgenius/dify-ui/select'
+import { FieldRoot } from '@langgenius/dify-ui/field'
+import { Select, SelectContent, SelectItem, SelectItemIndicator, SelectItemText, SelectLabel, SelectTrigger } from '@langgenius/dify-ui/select'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
import Badge from '@/app/components/base/badge'
@@ -79,9 +79,6 @@ const SelectPackage: React.FC
= ({
return (
<>
-
- {t(`${i18nPrefix}.selectVersion`, { ns: 'plugin' })}
-
{
@@ -92,6 +89,9 @@ const SelectPackage: React.FC = ({
onSelectVersion(selectedItem)
}}
>
+
+ {t(`${i18nPrefix}.selectVersion`, { ns: 'plugin' })}
+
@@ -122,9 +122,6 @@ const SelectPackage: React.FC = ({
-
- {t(`${i18nPrefix}.selectPackage`, { ns: 'plugin' })}
-
= ({
onSelectPackage(selectedItem)
}}
>
+
+ {t(`${i18nPrefix}.selectPackage`, { ns: 'plugin' })}
+
{selectedPackageOption?.name ?? t(`${i18nPrefix}.selectPackagePlaceholder`, { ns: 'plugin' }) ?? ''}
diff --git a/web/app/components/workflow/nodes/_base/components/__tests__/agent-strategy.spec.tsx b/web/app/components/workflow/nodes/_base/components/__tests__/agent-strategy.spec.tsx
index fb63a30030..905e2e07cb 100644
--- a/web/app/components/workflow/nodes/_base/components/__tests__/agent-strategy.spec.tsx
+++ b/web/app/components/workflow/nodes/_base/components/__tests__/agent-strategy.spec.tsx
@@ -145,8 +145,7 @@ describe('AgentStrategy', () => {
/>,
)
- expect(screen.getByLabelText('Count')).toBeInTheDocument()
- expect(screen.getByRole('textbox')).toBeInTheDocument()
+ expect(screen.getByRole('textbox', { name: 'Count' })).toBeInTheDocument()
})
it('should skip text-number schemas when min is missing', () => {
diff --git a/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx b/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx
index adaa9375b9..a9d0a91d08 100644
--- a/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx
+++ b/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx
@@ -4,6 +4,7 @@ import type { NodeOutPutVar } from '../../../types'
import type { ToolVarInputs } from '../../tool/types'
import type { CredentialFormSchema, CredentialFormSchemaNumberInput, CredentialFormSchemaTextInput } from '@/app/components/header/account-setting/model-provider-page/declarations'
import type { PluginMeta } from '@/app/components/plugins/types'
+import { FieldsetLegend, FieldsetRoot } from '@langgenius/dify-ui/fieldset'
import {
NumberField,
NumberFieldControls,
@@ -128,6 +129,7 @@ export const AgentStrategy = memo((props: AgentStrategyProps) => {
const defaultValue = schema.default ? Number.parseInt(schema.default) : 1
const value = props.value[schema.variable] ?? defaultValue
+ const label = renderI18nObject(def.label)
const onChange = (value: number) => {
props.onChange({ ...props.value, [schema.variable]: value })
}
@@ -135,7 +137,7 @@ export const AgentStrategy = memo((props: AgentStrategyProps) => {
- {renderI18nObject(def.label)}
+ {label}
{' '}
{def.required && * }
>
@@ -144,14 +146,15 @@ export const AgentStrategy = memo((props: AgentStrategyProps) => {
tooltip={def.tooltip && renderI18nObject(def.tooltip)}
inline
>
-
+
+ {label}
{
onValueChange={nextValue => onChange(nextValue ?? defaultValue)}
>
-
+
-
+
)
}
diff --git a/web/app/components/workflow/nodes/_base/components/file-upload-setting.tsx b/web/app/components/workflow/nodes/_base/components/file-upload-setting.tsx
index 55b0a424a2..93a96aabd9 100644
--- a/web/app/components/workflow/nodes/_base/components/file-upload-setting.tsx
+++ b/web/app/components/workflow/nodes/_base/components/file-upload-setting.tsx
@@ -161,6 +161,7 @@ const FileUploadSetting: FC = ({
void
}
-const InputNumberWithSlider: FC = ({
+function InputNumberWithSlider({
+ label,
value,
defaultValue = 0,
min,
max,
readonly,
onChange,
-}) => {
+}: InputNumberWithSliderProps) {
const handleBlur = useCallback(() => {
if (value === undefined || value === null || Number.isNaN(value)) {
onChange(defaultValue)
@@ -39,29 +41,33 @@ const InputNumberWithSlider: FC = ({
}, [onChange])
return (
-
-
-
-
+
+ {label}
+
+
+
+
+
)
}
export default React.memo(InputNumberWithSlider)
diff --git a/web/app/components/workflow/nodes/_base/components/memory-config.tsx b/web/app/components/workflow/nodes/_base/components/memory-config.tsx
index 0903ac0111..1dffdd0f9e 100644
--- a/web/app/components/workflow/nodes/_base/components/memory-config.tsx
+++ b/web/app/components/workflow/nodes/_base/components/memory-config.tsx
@@ -2,6 +2,7 @@
import type { FC } from 'react'
import type { Memory } from '../../../types'
import { cn } from '@langgenius/dify-ui/cn'
+import { FieldsetLegend, FieldsetRoot } from '@langgenius/dify-ui/fieldset'
import { Slider } from '@langgenius/dify-ui/slider'
import { Switch } from '@langgenius/dify-ui/switch'
import { produce } from 'immer'
@@ -67,6 +68,7 @@ const MemoryConfig: FC = ({
}) => {
const { t } = useTranslation()
const payload = config.data
+ const windowSizeLabel = t(`${i18nPrefix}.windowSize`, { ns: 'workflow' })
const handleMemoryEnabledChange = useCallback((enabled: boolean) => {
onChange(enabled ? MEMORY_DEFAULT : undefined)
}, [onChange])
@@ -154,9 +156,10 @@ const MemoryConfig: FC = ({
size="md"
disabled={readonly}
/>
- {t(`${i18nPrefix}.windowSize`, { ns: 'workflow' })}
+ {windowSizeLabel}