From ea0e1b52a8c19ae9cb7cbfc5977b4385a8b974f8 Mon Sep 17 00:00:00 2001 From: yyh <92089059+lyzno1@users.noreply.github.com> Date: Wed, 18 Feb 2026 23:47:07 +0800 Subject: [PATCH] refactor(web): make Switch controlled-only and migrate call sites (#32399) --- .../[appId]/overview/tracing/config-popup.tsx | 2 +- web/app/components/app/annotation/index.tsx | 6 +- .../app/configuration/config-vision/index.tsx | 2 +- .../config/agent/agent-tools/index.tsx | 2 +- .../app/configuration/config/config-audio.tsx | 2 +- .../configuration/config/config-document.tsx | 2 +- .../params-config/config-content.tsx | 20 ++--- .../app/configuration/tools/index.tsx | 4 +- web/app/components/app/overview/app-card.tsx | 2 +- .../app/overview/settings/index.tsx | 8 +- .../components/app/overview/trigger-card.tsx | 2 +- .../new-feature-panel/feature-card.tsx | 2 +- .../moderation/moderation-content.tsx | 2 +- .../text-to-speech/param-config-content.tsx | 2 +- web/app/components/base/param-item/index.tsx | 2 +- web/app/components/base/switch/index.spec.tsx | 54 ++++++++----- .../components/base/switch/index.stories.tsx | 77 ++++++++++--------- web/app/components/base/switch/index.tsx | 16 ++-- .../plan-switcher/plan-range-switcher.tsx | 4 +- .../custom/custom-web-app-brand/index.tsx | 28 +++---- .../__tests__/index.spec.tsx | 6 +- .../common/retrieval-param-config/index.tsx | 2 +- .../documents/components/operations.tsx | 6 +- .../detail/completed/segment-card/index.tsx | 2 +- .../datasets/documents/status-item/index.tsx | 2 +- .../datasets/extra-info/api-access/card.tsx | 2 +- .../dataset-metadata-drawer.tsx | 2 +- .../settings/summary-index-setting.tsx | 6 +- .../explore/create-app-modal/index.tsx | 2 +- .../model-parameter-modal/parameter-item.tsx | 2 +- .../provider-added-card/model-list-item.tsx | 4 +- .../model-load-balancing-configs.tsx | 4 +- .../plugin-detail-panel/endpoint-card.tsx | 2 +- .../components/reasoning-config-form.tsx | 2 +- .../tool-selector/components/tool-item.tsx | 6 +- .../components/tools/mcp/mcp-service-card.tsx | 2 +- .../mcp/sections/authentication-section.tsx | 2 +- .../nodes/_base/components/config-vision.tsx | 2 +- .../nodes/_base/components/memory-config.tsx | 4 +- .../nodes/_base/components/prompt/editor.tsx | 2 +- .../_base/components/retry/retry-on-panel.tsx | 8 +- .../components/workflow/nodes/http/panel.tsx | 2 +- .../delivery-method/email-configure-modal.tsx | 2 +- .../delivery-method/method-item.tsx | 2 +- .../delivery-method/recipient/index.tsx | 2 +- .../workflow/nodes/iteration/panel.tsx | 4 +- .../search-method-option.tsx | 6 +- .../top-k-and-score-threshold.tsx | 6 +- .../list-operator/components/limit-config.tsx | 2 +- .../workflow/nodes/list-operator/panel.tsx | 6 +- .../edit-card/required-switch.tsx | 2 +- .../components/reasoning-format-config.tsx | 2 +- .../components/workflow/nodes/llm/panel.tsx | 2 +- .../components/extract-parameter/update.tsx | 2 +- .../nodes/variable-assigner/panel.tsx | 2 +- .../note-editor/toolbar/operator.tsx | 2 +- .../filter/filter-switch.tsx | 2 +- web/eslint-suppressions.json | 50 ------------ 58 files changed, 182 insertions(+), 223 deletions(-) diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/config-popup.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/config-popup.tsx index 4469459b52..138d238b47 100644 --- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/config-popup.tsx +++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/config-popup.tsx @@ -94,7 +94,7 @@ const ConfigPopup: FC = ({ const switchContent = ( diff --git a/web/app/components/app/annotation/index.tsx b/web/app/components/app/annotation/index.tsx index 553836d73c..ee276603cc 100644 --- a/web/app/components/app/annotation/index.tsx +++ b/web/app/components/app/annotation/index.tsx @@ -144,7 +144,7 @@ const Annotation: FC = (props) => { return (
-

{t('description', { ns: 'appLog' })}

+

{t('description', { ns: 'appLog' })}

@@ -152,10 +152,10 @@ const Annotation: FC = (props) => { <>
-
{t('name', { ns: 'appAnnotation' })}
+
{t('name', { ns: 'appAnnotation' })}
{ if (value) { diff --git a/web/app/components/app/configuration/config-vision/index.tsx b/web/app/components/app/configuration/config-vision/index.tsx index 481e6b5ab6..383f6bdf06 100644 --- a/web/app/components/app/configuration/config-vision/index.tsx +++ b/web/app/components/app/configuration/config-vision/index.tsx @@ -121,7 +121,7 @@ const ConfigVision: FC = () => {
diff --git a/web/app/components/app/configuration/config/agent/agent-tools/index.tsx b/web/app/components/app/configuration/config/agent/agent-tools/index.tsx index b97aa6e775..752426cc2d 100644 --- a/web/app/components/app/configuration/config/agent/agent-tools/index.tsx +++ b/web/app/components/app/configuration/config/agent/agent-tools/index.tsx @@ -298,7 +298,7 @@ const AgentTools: FC = () => {
{!item.notAuthor && ( { diff --git a/web/app/components/app/configuration/config/config-audio.tsx b/web/app/components/app/configuration/config/config-audio.tsx index b8764b15e9..e2c7776aa1 100644 --- a/web/app/components/app/configuration/config/config-audio.tsx +++ b/web/app/components/app/configuration/config/config-audio.tsx @@ -69,7 +69,7 @@ const ConfigAudio: FC = () => {
diff --git a/web/app/components/app/configuration/config/config-document.tsx b/web/app/components/app/configuration/config/config-document.tsx index 7d48c1582a..1b27412711 100644 --- a/web/app/components/app/configuration/config/config-document.tsx +++ b/web/app/components/app/configuration/config/config-document.tsx @@ -69,7 +69,7 @@ const ConfigDocument: FC = () => {
diff --git a/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx b/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx index 69032b4743..d2e4913e54 100644 --- a/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx +++ b/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx @@ -188,14 +188,14 @@ const ConfigContent: FC = ({ return (
-
{t('retrievalSettings', { ns: 'dataset' })}
-
+
{t('retrievalSettings', { ns: 'dataset' })}
+
{t('defaultRetrievalTip', { ns: 'dataset' })}
{type === RETRIEVE_TYPE.multiWay && ( <>
-
+
{t('rerankSettings', { ns: 'dataset' })}
@@ -203,21 +203,21 @@ const ConfigContent: FC = ({ { selectedDatasetsMode.inconsistentEmbeddingModel && ( -
+
{t('inconsistentEmbeddingModelTip', { ns: 'dataset' })}
) } { selectedDatasetsMode.mixtureInternalAndExternal && ( -
+
{t('mixtureInternalAndExternalTip', { ns: 'dataset' })}
) } { selectedDatasetsMode.allExternal && ( -
+
{t('allExternalTip', { ns: 'dataset' })}
) @@ -225,7 +225,7 @@ const ConfigContent: FC = ({ { selectedDatasetsMode.mixtureHighQualityAndEconomic && ( -
+
{t('mixtureHighQualityAndEconomicTip', { ns: 'dataset' })}
) @@ -238,7 +238,7 @@ const ConfigContent: FC = ({
handleRerankModeChange(option.value)} @@ -267,12 +267,12 @@ const ConfigContent: FC = ({ canManuallyToggleRerank && ( ) } -
{t('modelProvider.rerankModel.key', { ns: 'common' })}
+
{t('modelProvider.rerankModel.key', { ns: 'common' })}
diff --git a/web/app/components/app/configuration/tools/index.tsx b/web/app/components/app/configuration/tools/index.tsx index bffddc0be9..d2873b0be3 100644 --- a/web/app/components/app/configuration/tools/index.tsx +++ b/web/app/components/app/configuration/tools/index.tsx @@ -130,7 +130,7 @@ const Tools = () => { className="flex h-7 cursor-pointer items-center px-3 text-xs font-medium text-gray-700" onClick={() => handleOpenExternalDataToolModal({}, -1)} > - + {t('operation.add', { ns: 'common' })}
@@ -180,7 +180,7 @@ const Tools = () => {
handleSaveExternalDataToolModal({ ...item, enabled }, index)} />
diff --git a/web/app/components/app/overview/app-card.tsx b/web/app/components/app/overview/app-card.tsx index 9975c81b3e..1b02e54d5f 100644 --- a/web/app/components/app/overview/app-card.tsx +++ b/web/app/components/app/overview/app-card.tsx @@ -260,7 +260,7 @@ function AppCard({ offset={24} >
- +
diff --git a/web/app/components/app/overview/settings/index.tsx b/web/app/components/app/overview/settings/index.tsx index 0d087e27c2..040703f41c 100644 --- a/web/app/components/app/overview/settings/index.tsx +++ b/web/app/components/app/overview/settings/index.tsx @@ -281,7 +281,7 @@ const SettingsModal: FC = ({
{t('answerIcon.title', { ns: 'app' })}
setInputInfo({ ...inputInfo, use_icon_as_answer_icon: v })} />
@@ -315,7 +315,7 @@ const SettingsModal: FC = ({ />

{t(`${prefixSettings}.chatColorThemeInverted`, { ns: 'appOverview' })}

- setInputInfo({ ...inputInfo, chatColorThemeInverted: v })}> + setInputInfo({ ...inputInfo, chatColorThemeInverted: v })}>
@@ -326,7 +326,7 @@ const SettingsModal: FC = ({
{t(`${prefixSettings}.workflow.subTitle`, { ns: 'appOverview' })}
setInputInfo({ ...inputInfo, show_workflow_steps: v })} />
@@ -380,7 +380,7 @@ const SettingsModal: FC = ({ > setInputInfo({ ...inputInfo, copyrightSwitchValue: v })} /> diff --git a/web/app/components/app/overview/trigger-card.tsx b/web/app/components/app/overview/trigger-card.tsx index 12a294b4ec..1f0f0dca56 100644 --- a/web/app/components/app/overview/trigger-card.tsx +++ b/web/app/components/app/overview/trigger-card.tsx @@ -192,7 +192,7 @@ function TriggerCard({ appInfo, onToggleResult }: ITriggerCardProps) {
onToggleTrigger(trigger, enabled)} disabled={!isCurrentWorkspaceEditor} /> diff --git a/web/app/components/base/features/new-feature-panel/feature-card.tsx b/web/app/components/base/features/new-feature-panel/feature-card.tsx index 7b7327517b..23f140ba54 100644 --- a/web/app/components/base/features/new-feature-panel/feature-card.tsx +++ b/web/app/components/base/features/new-feature-panel/feature-card.tsx @@ -48,7 +48,7 @@ const FeatureCard = ({ )}
- onChange?.(state)} defaultValue={value} /> + onChange?.(state)} value={value} />
{description && (
{description}
diff --git a/web/app/components/base/features/new-feature-panel/moderation/moderation-content.tsx b/web/app/components/base/features/new-feature-panel/moderation/moderation-content.tsx index 8e9d6ddbf0..ed691b84d6 100644 --- a/web/app/components/base/features/new-feature-panel/moderation/moderation-content.tsx +++ b/web/app/components/base/features/new-feature-panel/moderation/moderation-content.tsx @@ -38,7 +38,7 @@ const ModerationContent: FC = ({ } handleConfigChange('enabled', v)} />
diff --git a/web/app/components/base/features/new-feature-panel/text-to-speech/param-config-content.tsx b/web/app/components/base/features/new-feature-panel/text-to-speech/param-config-content.tsx index a17de2d151..21b4f1e0cd 100644 --- a/web/app/components/base/features/new-feature-panel/text-to-speech/param-config-content.tsx +++ b/web/app/components/base/features/new-feature-panel/text-to-speech/param-config-content.tsx @@ -232,7 +232,7 @@ const VoiceParamConfig = ({
{ handleChange({ autoPlay: value ? TtsAutoPlay.enabled : TtsAutoPlay.disabled, diff --git a/web/app/components/base/param-item/index.tsx b/web/app/components/base/param-item/index.tsx index 504119bb38..1652290fda 100644 --- a/web/app/components/base/param-item/index.tsx +++ b/web/app/components/base/param-item/index.tsx @@ -30,7 +30,7 @@ const ParamItem: FC = ({ className, id, name, noTooltip, tip, step = 0.1, { onSwitchChange?.(id, val) }} diff --git a/web/app/components/base/switch/index.spec.tsx b/web/app/components/base/switch/index.spec.tsx index b434ddd729..d4788939c6 100644 --- a/web/app/components/base/switch/index.spec.tsx +++ b/web/app/components/base/switch/index.spec.tsx @@ -4,41 +4,54 @@ import { describe, expect, it, vi } from 'vitest' import Switch from './index' describe('Switch', () => { - it('should render in unchecked state by default', () => { - render() + it('should render in unchecked state when value is false', () => { + render() const switchElement = screen.getByRole('switch') expect(switchElement).toBeInTheDocument() expect(switchElement).toHaveAttribute('aria-checked', 'false') }) - it('should render in checked state when defaultValue is true', () => { - render() + it('should render in checked state when value is true', () => { + render() const switchElement = screen.getByRole('switch') expect(switchElement).toHaveAttribute('aria-checked', 'true') }) - it('should toggle state and call onChange when clicked', async () => { + it('should call onChange with next value when clicked', async () => { const onChange = vi.fn() const user = userEvent.setup() - render() + render() const switchElement = screen.getByRole('switch') await user.click(switchElement) - expect(switchElement).toHaveAttribute('aria-checked', 'true') expect(onChange).toHaveBeenCalledWith(true) expect(onChange).toHaveBeenCalledTimes(1) - await user.click(switchElement) + // Controlled component stays the same until parent updates value. expect(switchElement).toHaveAttribute('aria-checked', 'false') - expect(onChange).toHaveBeenCalledWith(false) - expect(onChange).toHaveBeenCalledTimes(2) + }) + + it('should work in controlled mode with value prop', async () => { + const onChange = vi.fn() + const user = userEvent.setup() + const { rerender } = render() + const switchElement = screen.getByRole('switch') + + expect(switchElement).toHaveAttribute('aria-checked', 'false') + + await user.click(switchElement) + expect(onChange).toHaveBeenCalledWith(true) + expect(switchElement).toHaveAttribute('aria-checked', 'false') + + rerender() + expect(switchElement).toHaveAttribute('aria-checked', 'true') }) it('should not call onChange when disabled', async () => { const onChange = vi.fn() const user = userEvent.setup() - render() + render() const switchElement = screen.getByRole('switch') expect(switchElement).toHaveClass('!cursor-not-allowed', '!opacity-50') @@ -48,37 +61,36 @@ describe('Switch', () => { }) it('should apply correct size classes', () => { - const { rerender } = render() + const { rerender } = render() // We only need to find the element once const switchElement = screen.getByRole('switch') expect(switchElement).toHaveClass('h-2.5', 'w-3.5', 'rounded-sm') - rerender() + rerender() expect(switchElement).toHaveClass('h-3', 'w-5') - rerender() + rerender() expect(switchElement).toHaveClass('h-4', 'w-7') - rerender() + rerender() expect(switchElement).toHaveClass('h-5', 'w-9') - rerender() + rerender() expect(switchElement).toHaveClass('h-6', 'w-11') }) it('should apply custom className', () => { - render() + render() expect(screen.getByRole('switch')).toHaveClass('custom-test-class') }) - it('should apply correct background colors based on state', async () => { - const user = userEvent.setup() - render() + it('should apply correct background colors based on value prop', () => { + const { rerender } = render() const switchElement = screen.getByRole('switch') expect(switchElement).toHaveClass('bg-components-toggle-bg-unchecked') - await user.click(switchElement) + rerender() expect(switchElement).toHaveClass('bg-components-toggle-bg') }) }) diff --git a/web/app/components/base/switch/index.stories.tsx b/web/app/components/base/switch/index.stories.tsx index 7fe7d1fbec..f3a24f2396 100644 --- a/web/app/components/base/switch/index.stories.tsx +++ b/web/app/components/base/switch/index.stories.tsx @@ -14,15 +14,18 @@ const meta = { }, }, tags: ['autodocs'], + args: { + value: false, + }, argTypes: { size: { control: 'select', options: ['xs', 'sm', 'md', 'lg', 'l'], description: 'Switch size', }, - defaultValue: { + value: { control: 'boolean', - description: 'Default checked state', + description: 'Checked state (controlled)', }, disabled: { control: 'boolean', @@ -36,14 +39,14 @@ type Story = StoryObj // Interactive demo wrapper const SwitchDemo = (args: any) => { - const [enabled, setEnabled] = useState(args.defaultValue || false) + const [enabled, setEnabled] = useState(args.value ?? false) return (
{ setEnabled(value) console.log('Switch toggled:', value) @@ -62,7 +65,7 @@ export const Default: Story = { render: args => , args: { size: 'md', - defaultValue: false, + value: false, disabled: false, }, } @@ -72,7 +75,7 @@ export const DefaultOn: Story = { render: args => , args: { size: 'md', - defaultValue: true, + value: true, disabled: false, }, } @@ -82,7 +85,7 @@ export const DisabledOff: Story = { render: args => , args: { size: 'md', - defaultValue: false, + value: false, disabled: true, }, } @@ -92,7 +95,7 @@ export const DisabledOn: Story = { render: args => , args: { size: 'md', - defaultValue: true, + value: true, disabled: true, }, } @@ -111,31 +114,31 @@ const SizeComparisonDemo = () => {
- setStates({ ...states, xs: v })} /> + setStates({ ...states, xs: v })} /> Extra Small (xs)
- setStates({ ...states, sm: v })} /> + setStates({ ...states, sm: v })} /> Small (sm)
- setStates({ ...states, md: v })} /> + setStates({ ...states, md: v })} /> Medium (md)
- setStates({ ...states, l: v })} /> + setStates({ ...states, l: v })} /> Large (l)
- setStates({ ...states, lg: v })} /> + setStates({ ...states, lg: v })} /> Extra Large (lg)
@@ -160,7 +163,7 @@ const WithLabelsDemo = () => {
@@ -197,7 +200,7 @@ const SettingsPanelDemo = () => {
updateSetting('notifications', v)} />
@@ -209,7 +212,7 @@ const SettingsPanelDemo = () => {
updateSetting('autoSave', v)} />
@@ -221,7 +224,7 @@ const SettingsPanelDemo = () => {
updateSetting('darkMode', v)} />
@@ -233,7 +236,7 @@ const SettingsPanelDemo = () => {
updateSetting('analytics', v)} /> @@ -245,7 +248,7 @@ const SettingsPanelDemo = () => { updateSetting('emailUpdates', v)} /> @@ -279,7 +282,7 @@ const PrivacyControlsDemo = () => { setPrivacy({ ...privacy, profilePublic: v })} /> @@ -291,7 +294,7 @@ const PrivacyControlsDemo = () => { setPrivacy({ ...privacy, showEmail: v })} /> @@ -303,7 +306,7 @@ const PrivacyControlsDemo = () => { setPrivacy({ ...privacy, allowMessages: v })} /> @@ -315,7 +318,7 @@ const PrivacyControlsDemo = () => { setPrivacy({ ...privacy, shareActivity: v })} /> @@ -351,7 +354,7 @@ const FeatureTogglesDemo = () => { setFeatures({ ...features, betaFeatures: v })} /> @@ -366,7 +369,7 @@ const FeatureTogglesDemo = () => { setFeatures({ ...features, experimentalUI: v })} /> @@ -381,7 +384,7 @@ const FeatureTogglesDemo = () => { setFeatures({ ...features, advancedMode: v })} /> @@ -396,7 +399,7 @@ const FeatureTogglesDemo = () => { setFeatures({ ...features, developerTools: v })} /> @@ -440,7 +443,7 @@ const NotificationPreferencesDemo = () => { setNotifications({ ...notifications, email: v })} /> @@ -455,7 +458,7 @@ const NotificationPreferencesDemo = () => { setNotifications({ ...notifications, push: v })} /> @@ -470,7 +473,7 @@ const NotificationPreferencesDemo = () => { setNotifications({ ...notifications, sms: v })} /> @@ -485,7 +488,7 @@ const NotificationPreferencesDemo = () => { setNotifications({ ...notifications, desktop: v })} /> @@ -523,7 +526,7 @@ const APIAccessControlDemo = () => { setAccess({ ...access, readAccess: v })} /> @@ -539,7 +542,7 @@ const APIAccessControlDemo = () => { setAccess({ ...access, writeAccess: v })} /> @@ -555,7 +558,7 @@ const APIAccessControlDemo = () => { setAccess({ ...access, deleteAccess: v })} /> @@ -571,7 +574,7 @@ const APIAccessControlDemo = () => { setAccess({ ...access, adminAccess: v })} /> @@ -609,7 +612,7 @@ const CompactListDemo = () => { {item.name} toggleItem(item.id)} /> @@ -628,7 +631,7 @@ export const Playground: Story = { render: args => , args: { size: 'md', - defaultValue: false, + value: false, disabled: false, }, } diff --git a/web/app/components/base/switch/index.tsx b/web/app/components/base/switch/index.tsx index 6296a33141..8c900bb123 100644 --- a/web/app/components/base/switch/index.tsx +++ b/web/app/components/base/switch/index.tsx @@ -1,13 +1,12 @@ 'use client' import { Switch as OriginalSwitch } from '@headlessui/react' import * as React from 'react' -import { useEffect, useState } from 'react' import { cn } from '@/utils/classnames' type SwitchProps = { + value: boolean onChange?: (value: boolean) => void size?: 'xs' | 'sm' | 'md' | 'lg' | 'l' - defaultValue?: boolean disabled?: boolean className?: string } @@ -15,19 +14,15 @@ type SwitchProps = { const Switch = ( { ref: propRef, + value, onChange, size = 'md', - defaultValue = false, disabled = false, className, }: SwitchProps & { ref?: React.RefObject }, ) => { - const [enabled, setEnabled] = useState(defaultValue) - useEffect(() => { - setEnabled(defaultValue) - }, [defaultValue]) const wrapStyle = { lg: 'h-6 w-11', l: 'h-5 w-9', @@ -54,18 +49,17 @@ const Switch = ( return ( { if (disabled) return - setEnabled(checked) onChange?.(checked) }} - className={cn(wrapStyle[size], enabled ? 'bg-components-toggle-bg' : 'bg-components-toggle-bg-unchecked', 'relative inline-flex shrink-0 cursor-pointer rounded-[5px] border-2 border-transparent transition-colors duration-200 ease-in-out', disabled ? '!cursor-not-allowed !opacity-50' : '', size === 'xs' && 'rounded-sm', className)} + className={cn(wrapStyle[size], value ? 'bg-components-toggle-bg' : 'bg-components-toggle-bg-unchecked', 'relative inline-flex shrink-0 cursor-pointer rounded-[5px] border-2 border-transparent transition-colors duration-200 ease-in-out', disabled ? '!cursor-not-allowed !opacity-50' : '', size === 'xs' && 'rounded-sm', className)} > ) diff --git a/web/app/components/billing/pricing/plan-switcher/plan-range-switcher.tsx b/web/app/components/billing/pricing/plan-switcher/plan-range-switcher.tsx index cb5b0510d8..92cbdf0e63 100644 --- a/web/app/components/billing/pricing/plan-switcher/plan-range-switcher.tsx +++ b/web/app/components/billing/pricing/plan-switcher/plan-range-switcher.tsx @@ -24,12 +24,12 @@ const PlanRangeSwitcher: FC = ({
{ onChange(v ? PlanRange.yearly : PlanRange.monthly) }} /> - + {t('plansCommon.annualBilling', { ns: 'billing', percent: 17 })}
diff --git a/web/app/components/custom/custom-web-app-brand/index.tsx b/web/app/components/custom/custom-web-app-brand/index.tsx index d9e80e80d1..438e69894d 100644 --- a/web/app/components/custom/custom-web-app-brand/index.tsx +++ b/web/app/components/custom/custom-web-app-brand/index.tsx @@ -116,19 +116,19 @@ const CustomWebAppBrand = () => { return (
-
+
{t('webapp.removeBrand', { ns: 'custom' })}
-
{t('webapp.changeLogo', { ns: 'custom' })}
-
{t('webapp.changeLogoTip', { ns: 'custom' })}
+
{t('webapp.changeLogo', { ns: 'custom' })}
+
{t('webapp.changeLogoTip', { ns: 'custom' })}
{(!uploadDisabled && webappLogo && !webappBrandRemoved) && ( @@ -204,7 +204,7 @@ const CustomWebAppBrand = () => {
{t('uploadedFail', { ns: 'custom' })}
)}
-
{t('overview.appInfo.preview', { ns: 'appOverview' })}
+
{t('overview.appInfo.preview', { ns: 'appOverview' })}
@@ -215,7 +215,7 @@ const CustomWebAppBrand = () => {
-
Chatflow App
+
Chatflow App
@@ -246,7 +246,7 @@ const CustomWebAppBrand = () => {
{!webappBrandRemoved && ( <> -
POWERED BY
+
POWERED BY
{ systemFeatures.branding.enabled && systemFeatures.branding.workspace_logo ? logo @@ -262,12 +262,12 @@ const CustomWebAppBrand = () => {
-
Hello! How can I assist you today?
+
Hello! How can I assist you today?
-
Talk to Dify
+
Talk to Dify
@@ -278,14 +278,14 @@ const CustomWebAppBrand = () => {
-
Workflow App
+
Workflow App
-
RUN ONCE
-
RUN BATCH
+
RUN ONCE
+
RUN BATCH
@@ -293,7 +293,7 @@ const CustomWebAppBrand = () => {
-
+
diff --git a/web/app/components/datasets/common/retrieval-param-config/index.tsx b/web/app/components/datasets/common/retrieval-param-config/index.tsx index f6205a7862..ef4ebdab73 100644 --- a/web/app/components/datasets/common/retrieval-param-config/index.tsx +++ b/web/app/components/datasets/common/retrieval-param-config/index.tsx @@ -122,7 +122,7 @@ const RetrievalParamConfig: FC = ({ {canToggleRerankModalEnable && ( )} diff --git a/web/app/components/datasets/documents/components/operations.tsx b/web/app/components/datasets/documents/components/operations.tsx index cdd694fad9..15c89a9b26 100644 --- a/web/app/components/datasets/documents/components/operations.tsx +++ b/web/app/components/datasets/documents/components/operations.tsx @@ -191,7 +191,7 @@ const Operations = ({ return (
e.stopPropagation()}> {isListScene && !embeddingAvailable && ( - + )} {isListScene && embeddingAvailable && ( <> @@ -202,11 +202,11 @@ const Operations = ({ popupClassName="!font-semibold" >
- +
) - : handleSwitch(v ? 'enable' : 'disable')} size="md" />} + : handleSwitch(v ? 'enable' : 'disable')} size="md" />} )} diff --git a/web/app/components/datasets/documents/detail/completed/segment-card/index.tsx b/web/app/components/datasets/documents/detail/completed/segment-card/index.tsx index ce83d8ab5c..759c26b00c 100644 --- a/web/app/components/datasets/documents/detail/completed/segment-card/index.tsx +++ b/web/app/components/datasets/documents/detail/completed/segment-card/index.tsx @@ -216,7 +216,7 @@ const SegmentCard: FC = ({ { await onChangeSwitch?.(val, id) }} diff --git a/web/app/components/datasets/documents/status-item/index.tsx b/web/app/components/datasets/documents/status-item/index.tsx index 703e3e4bf4..60d837fd81 100644 --- a/web/app/components/datasets/documents/status-item/index.tsx +++ b/web/app/components/datasets/documents/status-item/index.tsx @@ -119,7 +119,7 @@ const StatusItem = ({ disabled={!archived} > !archived && handleSwitch(v ? 'enable' : 'disable')} disabled={embedding || archived} size="md" diff --git a/web/app/components/datasets/extra-info/api-access/card.tsx b/web/app/components/datasets/extra-info/api-access/card.tsx index 77c44795f4..946536bf2c 100644 --- a/web/app/components/datasets/extra-info/api-access/card.tsx +++ b/web/app/components/datasets/extra-info/api-access/card.tsx @@ -60,7 +60,7 @@ const Card = ({
diff --git a/web/app/components/datasets/metadata/metadata-dataset/dataset-metadata-drawer.tsx b/web/app/components/datasets/metadata/metadata-dataset/dataset-metadata-drawer.tsx index 242275d594..ccd6240814 100644 --- a/web/app/components/datasets/metadata/metadata-dataset/dataset-metadata-drawer.tsx +++ b/web/app/components/datasets/metadata/metadata-dataset/dataset-metadata-drawer.tsx @@ -204,7 +204,7 @@ const DatasetMetadataDrawer: FC = ({
{t(`${i18nPrefix}.builtIn`, { ns: 'dataset' })}
diff --git a/web/app/components/datasets/settings/summary-index-setting.tsx b/web/app/components/datasets/settings/summary-index-setting.tsx index b79f8ffe0c..a6b99e8dab 100644 --- a/web/app/components/datasets/settings/summary-index-setting.tsx +++ b/web/app/components/datasets/settings/summary-index-setting.tsx @@ -72,7 +72,7 @@ const SummaryIndexSetting = ({
@@ -119,7 +119,7 @@ const SummaryIndexSetting = ({
@@ -184,7 +184,7 @@ const SummaryIndexSetting = ({
diff --git a/web/app/components/explore/create-app-modal/index.tsx b/web/app/components/explore/create-app-modal/index.tsx index cfe59fb7f3..a687769221 100644 --- a/web/app/components/explore/create-app-modal/index.tsx +++ b/web/app/components/explore/create-app-modal/index.tsx @@ -166,7 +166,7 @@ const CreateAppModal = ({
{t('answerIcon.title', { ns: 'app' })}
setUseIconAsAnswerIcon(v)} />
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 b10634873a..f2c35c1823 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 @@ -257,7 +257,7 @@ const ParameterItem: FC = ({ !parameterRule.required && parameterRule.name !== 'stop' && (
diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-list-item.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-list-item.tsx index d12fbcbad2..908d2f0e6c 100644 --- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-list-item.tsx +++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-list-item.tsx @@ -92,13 +92,13 @@ const ModelListItem = ({ model, provider, isConfigurable, onChange, onModifyLoad } offset={{ mainAxis: 4 }} > - + ) : (isCurrentWorkspaceManager && ( toggleConfigEntryEnabled(index, value)} diff --git a/web/app/components/plugins/plugin-detail-panel/endpoint-card.tsx b/web/app/components/plugins/plugin-detail-panel/endpoint-card.tsx index 4190ef0a7f..164bab0f04 100644 --- a/web/app/components/plugins/plugin-detail-panel/endpoint-card.tsx +++ b/web/app/components/plugins/plugin-detail-panel/endpoint-card.tsx @@ -181,7 +181,7 @@ const EndpointCard = ({ )} diff --git a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/reasoning-config-form.tsx b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/reasoning-config-form.tsx index 6ffb8756d3..7460226768 100644 --- a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/reasoning-config-form.tsx +++ b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/reasoning-config-form.tsx @@ -258,7 +258,7 @@ const ReasoningConfigForm: React.FC = ({ {t('detailPanel.toolSelector.auto', { ns: 'plugin' })} handleAutomatic(variable, val, type)} />
diff --git a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-item.tsx b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-item.tsx index dd85bc376c..b35770f23d 100644 --- a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-item.tsx +++ b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-item.tsx @@ -95,8 +95,8 @@ const ToolItem = ({
)}
-
{providerNameText}
-
{toolLabel}
+
{providerNameText}
+
{toolLabel}
{!noAuth && !isError && !uninstalled && !versionMismatch && !isShowCanNotChooseMCPTip && ( @@ -120,7 +120,7 @@ const ToolItem = ({
e.stopPropagation()}>
diff --git a/web/app/components/tools/mcp/mcp-service-card.tsx b/web/app/components/tools/mcp/mcp-service-card.tsx index 4a85fff7c8..f0efefd7b1 100644 --- a/web/app/components/tools/mcp/mcp-service-card.tsx +++ b/web/app/components/tools/mcp/mcp-service-card.tsx @@ -250,7 +250,7 @@ const MCPServiceCard: FC = ({ offset={24} >
- +
diff --git a/web/app/components/tools/mcp/sections/authentication-section.tsx b/web/app/components/tools/mcp/sections/authentication-section.tsx index dc27e573ef..0e202b2f59 100644 --- a/web/app/components/tools/mcp/sections/authentication-section.tsx +++ b/web/app/components/tools/mcp/sections/authentication-section.tsx @@ -32,7 +32,7 @@ const AuthenticationSection: FC = ({
{t('mcp.modal.useDynamicClientRegistration', { ns: 'tools' })} diff --git a/web/app/components/workflow/nodes/_base/components/config-vision.tsx b/web/app/components/workflow/nodes/_base/components/config-vision.tsx index b81d0b9a90..65a179fddd 100644 --- a/web/app/components/workflow/nodes/_base/components/config-vision.tsx +++ b/web/app/components/workflow/nodes/_base/components/config-vision.tsx @@ -65,7 +65,7 @@ const ConfigVision: FC = ({ popupContent={t('vision.onlySupportVisionModelTip', { ns: 'appDebug' })!} disabled={isVisionModel} > - + )} > 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 4669762f0c..ac82162915 100644 --- a/web/app/components/workflow/nodes/_base/components/memory-config.tsx +++ b/web/app/components/workflow/nodes/_base/components/memory-config.tsx @@ -136,7 +136,7 @@ const MemoryConfig: FC = ({ tooltip={t(`${i18nPrefix}.memoryTip`, { ns: 'workflow' })!} operations={( = ({
= ({ { onEditionTypeChange?.(checked ? EditionType.jinja2 : EditionType.basic) }} diff --git a/web/app/components/workflow/nodes/_base/components/retry/retry-on-panel.tsx b/web/app/components/workflow/nodes/_base/components/retry/retry-on-panel.tsx index b4ac15bf38..d509ea4757 100644 --- a/web/app/components/workflow/nodes/_base/components/retry/retry-on-panel.tsx +++ b/web/app/components/workflow/nodes/_base/components/retry/retry-on-panel.tsx @@ -55,10 +55,10 @@ const RetryOnPanel = ({
-
{t('nodes.common.retry.retryOnFailure', { ns: 'workflow' })}
+
{t('nodes.common.retry.retryOnFailure', { ns: 'workflow' })}
handleRetryEnabledChange(v)} />
@@ -66,7 +66,7 @@ const RetryOnPanel = ({ retry_config?.retry_enabled && (
-
{t('nodes.common.retry.maxRetries', { ns: 'workflow' })}
+
{t('nodes.common.retry.maxRetries', { ns: 'workflow' })}
-
{t('nodes.common.retry.retryInterval', { ns: 'workflow' })}
+
{t('nodes.common.retry.retryInterval', { ns: 'workflow' })}
> = ({ tooltip={t(`${i18nPrefix}.verifySSL.warningTooltip`, { ns: 'workflow' })} operations={(
setDebugMode(checked)} />
diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/method-item.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/method-item.tsx index bea2f8cb35..40f0acf137 100644 --- a/web/app/components/workflow/nodes/human-input/components/delivery-method/method-item.tsx +++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/method-item.tsx @@ -160,7 +160,7 @@ const DeliveryMethodItem: FC = ({ )} {(method.config || method.type === DeliveryMethodType.WebApp) && ( diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/index.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/index.tsx index 9b5f4ef68c..f186daab4d 100644 --- a/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/index.tsx +++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/index.tsx @@ -91,7 +91,7 @@ const Recipient = ({
{t(`${i18nPrefix}.deliveryMethod.emailConfigure.allMembers`, { workspaceName: currentWorkspace.name.replace(/'/g, '’'), ns: 'workflow' })}
onChange({ ...data, whole_workspace: checked })} />
diff --git a/web/app/components/workflow/nodes/iteration/panel.tsx b/web/app/components/workflow/nodes/iteration/panel.tsx index 6307869bd4..c1c5e97839 100644 --- a/web/app/components/workflow/nodes/iteration/panel.tsx +++ b/web/app/components/workflow/nodes/iteration/panel.tsx @@ -92,7 +92,7 @@ const Panel: FC> = ({
{t(`${i18nPrefix}.parallelPanelDesc`, { ns: 'workflow' })}
} inline> - +
{ @@ -130,7 +130,7 @@ const Panel: FC> = ({ tooltip={
{t(`${i18nPrefix}.flattenOutputDesc`, { ns: 'workflow' })}
} inline > - +
diff --git a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/search-method-option.tsx b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/search-method-option.tsx index d5f632699f..c7addde4c5 100644 --- a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/search-method-option.tsx +++ b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/search-method-option.tsx @@ -166,10 +166,10 @@ const SearchMethodOption = ({
{ showRerankModelSelectorSwitch && ( -
+
@@ -192,7 +192,7 @@ const SearchMethodOption = ({
- + {t('form.retrievalSetting.multiModalTip', { ns: 'datasetSettings' })}
diff --git a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/top-k-and-score-threshold.tsx b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/top-k-and-score-threshold.tsx index bf3b8297c3..62b4e68093 100644 --- a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/top-k-and-score-threshold.tsx +++ b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/top-k-and-score-threshold.tsx @@ -56,7 +56,7 @@ const TopKAndScoreThreshold = ({ return (
-
+
{t('datasetConfig.top_k', { ns: 'appDebug' })} -
+
{t('datasetConfig.score_threshold', { ns: 'appDebug' })}
= ({ title={t(`${i18nPrefix}.limit`, { ns: 'workflow' })} operations={( > = ({ title={t(`${i18nPrefix}.filterCondition`, { ns: 'workflow' })} operations={( > = ({ title={t(`${i18nPrefix}.extractsCondition`, { ns: 'workflow' })} operations={( > = ({ title={t(`${i18nPrefix}.orderBy`, { ns: 'workflow' })} operations={( = ({ return (
{t('nodes.llm.jsonSchema.required', { ns: 'workflow' })} - +
) } diff --git a/web/app/components/workflow/nodes/llm/components/reasoning-format-config.tsx b/web/app/components/workflow/nodes/llm/components/reasoning-format-config.tsx index 5d4193502e..7e6ddd0282 100644 --- a/web/app/components/workflow/nodes/llm/components/reasoning-format-config.tsx +++ b/web/app/components/workflow/nodes/llm/components/reasoning-format-config.tsx @@ -24,7 +24,7 @@ const ReasoningFormatConfig: FC = ({ operations={( // ON = separated, OFF = tagged onChange(enabled ? 'separated' : 'tagged')} size="md" disabled={readonly} diff --git a/web/app/components/workflow/nodes/llm/panel.tsx b/web/app/components/workflow/nodes/llm/panel.tsx index 7146d9e64a..5948ee7ac5 100644 --- a/web/app/components/workflow/nodes/llm/panel.tsx +++ b/web/app/components/workflow/nodes/llm/panel.tsx @@ -285,7 +285,7 @@ const Panel: FC> = ({
= ({ <>
{t(`${i18nPrefix}.addExtractParameterContent.requiredContent`, { ns: 'workflow' })}
- +
diff --git a/web/app/components/workflow/nodes/variable-assigner/panel.tsx b/web/app/components/workflow/nodes/variable-assigner/panel.tsx index 9665e947a1..d7bf571efd 100644 --- a/web/app/components/workflow/nodes/variable-assigner/panel.tsx +++ b/web/app/components/workflow/nodes/variable-assigner/panel.tsx @@ -90,7 +90,7 @@ const Panel: FC> = ({ tooltip={t(`${i18nPrefix}.aggregationGroupTip`, { ns: 'workflow' })!} operations={( {t('nodes.note.editor.showAuthor', { ns: 'workflow' })}
diff --git a/web/app/components/workflow/panel/version-history-panel/filter/filter-switch.tsx b/web/app/components/workflow/panel/version-history-panel/filter/filter-switch.tsx index e5ed396a25..866e61730b 100644 --- a/web/app/components/workflow/panel/version-history-panel/filter/filter-switch.tsx +++ b/web/app/components/workflow/panel/version-history-panel/filter/filter-switch.tsx @@ -21,7 +21,7 @@ const FilterSwitch: FC = ({ {t('versionHistory.filter.onlyShowNamedVersions', { ns: 'workflow' })}
handleSwitch(v)} size="md" className="shrink-0" diff --git a/web/eslint-suppressions.json b/web/eslint-suppressions.json index c88a3550a0..8f08836a70 100644 --- a/web/eslint-suppressions.json +++ b/web/eslint-suppressions.json @@ -452,9 +452,6 @@ "react-hooks-extra/no-direct-set-state-in-use-effect": { "count": 1 }, - "tailwindcss/enforce-consistent-class-order": { - "count": 2 - }, "ts/no-explicit-any": { "count": 5 } @@ -803,11 +800,6 @@ "count": 1 } }, - "app/components/app/configuration/dataset-config/params-config/config-content.tsx": { - "tailwindcss/enforce-consistent-class-order": { - "count": 9 - } - }, "app/components/app/configuration/dataset-config/params-config/index.tsx": { "react-hooks-extra/no-direct-set-state-in-use-effect": { "count": 1 @@ -954,11 +946,6 @@ "count": 2 } }, - "app/components/app/configuration/tools/index.tsx": { - "tailwindcss/no-unnecessary-whitespace": { - "count": 1 - } - }, "app/components/app/create-app-dialog/app-card/index.spec.tsx": { "ts/no-explicit-any": { "count": 1 @@ -2758,14 +2745,6 @@ "count": 1 } }, - "app/components/base/switch/index.tsx": { - "react-hooks-extra/no-direct-set-state-in-use-effect": { - "count": 1 - }, - "tailwindcss/no-unnecessary-whitespace": { - "count": 1 - } - }, "app/components/base/tab-header/index.tsx": { "tailwindcss/enforce-consistent-class-order": { "count": 1 @@ -2927,9 +2906,6 @@ "app/components/billing/pricing/plan-switcher/plan-range-switcher.tsx": { "react-refresh/only-export-components": { "count": 1 - }, - "tailwindcss/enforce-consistent-class-order": { - "count": 1 } }, "app/components/billing/pricing/plan-switcher/tab.tsx": { @@ -3001,12 +2977,6 @@ } }, "app/components/custom/custom-web-app-brand/index.tsx": { - "tailwindcss/enforce-consistent-class-order": { - "count": 12 - }, - "tailwindcss/no-unnecessary-whitespace": { - "count": 1 - }, "ts/no-explicit-any": { "count": 2 } @@ -5034,11 +5004,6 @@ "count": 2 } }, - "app/components/plugins/plugin-detail-panel/tool-selector/components/tool-item.tsx": { - "tailwindcss/enforce-consistent-class-order": { - "count": 2 - } - }, "app/components/plugins/plugin-detail-panel/tool-selector/components/tool-settings-panel.tsx": { "tailwindcss/enforce-consistent-class-order": { "count": 4 @@ -6319,11 +6284,6 @@ "count": 1 } }, - "app/components/workflow/nodes/_base/components/retry/retry-on-panel.tsx": { - "tailwindcss/enforce-consistent-class-order": { - "count": 3 - } - }, "app/components/workflow/nodes/_base/components/selector.tsx": { "tailwindcss/no-unnecessary-whitespace": { "count": 2 @@ -6944,16 +6904,6 @@ "count": 1 } }, - "app/components/workflow/nodes/knowledge-base/components/retrieval-setting/search-method-option.tsx": { - "tailwindcss/enforce-consistent-class-order": { - "count": 2 - } - }, - "app/components/workflow/nodes/knowledge-base/components/retrieval-setting/top-k-and-score-threshold.tsx": { - "tailwindcss/enforce-consistent-class-order": { - "count": 2 - } - }, "app/components/workflow/nodes/knowledge-base/components/retrieval-setting/type.ts": { "ts/no-explicit-any": { "count": 2