Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix: no model selected but params keep loading (#36342)
Joel06f076e0ff47
diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/__tests__/index.spec.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/__tests__/index.spec.tsxindex 29e5d379809..b3f1ee9be13 100644--- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/__tests__/index.spec.tsx+++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/__tests__/index.spec.tsx@@ -13,6 +13,7 @@ let parameterRules: Array<Record<string, unknown>> | undefined = [},]let isRulesLoading = false+let isRulesPending = falselet currentProvider: Record<string, unknown> | undefined = { provider: 'openai', label: { en_US: 'OpenAI' } }let currentModel: Record<string, unknown> | undefined = {model: 'gpt-3.5-turbo',@@ -49,7 +50,7 @@ vi.mock('@/service/use-common', () => ({data: parameterRules,},isLoading: isRulesLoading,- isPending: isRulesLoading,+ isPending: isRulesPending,}),}))@@ -138,6 +139,7 @@ describe('ModelParameterModal', () => {beforeEach(() => {vi.clearAllMocks()isRulesLoading = false+ isRulesPending = falseparameterRules = [{name: 'temperature',@@ -252,11 +254,29 @@ describe('ModelParameterModal', () => {it('should render loading state when parameter rules are loading', () => {isRulesLoading = true+ isRulesPending = truerender(<ModelParameterModal {...defaultProps} />)fireEvent.click(screen.getByText('Open Settings'))expect(screen.getByRole('status')).toBeInTheDocument()})+ it('should not render parameter loading when model is not configured and parameter rules query is pending but disabled', () => {+ isRulesPending = true+ parameterRules = []++ render(+ <ModelParameterModal+ {...defaultProps}+ provider=""+ modelId=""+ />,+ )+ fireEvent.click(screen.getByText('Open Settings'))++ expect(screen.queryByRole('status')).not.toBeInTheDocument()+ expect(screen.getByTestId('model-selector')).toBeInTheDocument()+ })+it('should not open content when readonly is true', () => {render(<ModelParameterModal {...defaultProps} readonly />)fireEvent.click(screen.getByText('Open Settings'))@@ -332,6 +352,7 @@ describe('ModelParameterModal', () => {it('should render the empty loading fallback when rules resolve to an empty list', () => {parameterRules = []isRulesLoading = true+ isRulesPending = truerender(<ModelParameterModal {...defaultProps} />)fireEvent.click(screen.getByText('Open Settings'))diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsxindex 648edf195d0..f0764fade01 100644--- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx+++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx@@ -76,10 +76,9 @@ const ModelParameterModal: FC<ModelParameterModalProps> = ({const settingsIconRef = useRef<HTMLDivElement>(null)const {data: parameterRulesData,- isPending,isLoading,} = useModelParameterRules(provider, modelId)- const isRulesLoading = isPending || isLoading+ const isRulesLoading = !!provider && !!modelId && isLoadingconst {currentProvider,currentModel,diff --git a/web/app/components/plugins/plugin-detail-panel/model-selector/__tests__/llm-params-panel.spec.tsx b/web/app/components/plugins/plugin-detail-panel/model-selector/__tests__/llm-params-panel.spec.tsxindex 5525934d264..8230ec5b143 100644--- a/web/app/components/plugins/plugin-detail-panel/model-selector/__tests__/llm-params-panel.spec.tsx+++ b/web/app/components/plugins/plugin-detail-panel/model-selector/__tests__/llm-params-panel.spec.tsx@@ -192,10 +192,12 @@ const createDefaultProps = (overrides: Partial<{const setupModelParameterRulesMock = (config: {data?: ModelParameterRule[]isPending?: boolean+ isLoading?: boolean} = {}) => {mockUseModelParameterRules.mockReturnValue({data: config.data ? { data: config.data } : undefined,isPending: config.isPending ?? false,+ isLoading: config.isLoading ?? config.isPending ?? false,})}@@ -232,6 +234,19 @@ describe('LLMParamsPanel', () => {expect(screen.getByRole('status')).toBeInTheDocument()})+ it('should not render loading state when model is not configured and parameter rules query is pending but disabled', () => {+ // Arrange+ setupModelParameterRulesMock({ isPending: true, isLoading: false })+ const props = createDefaultProps({ provider: '', modelId: '' })++ // Act+ render(<LLMParamsPanel {...props} />)++ // Assert+ expect(screen.queryByRole('status')).not.toBeInTheDocument()+ expect(screen.getByText('common.modelProvider.parameters')).toBeInTheDocument()+ })+it('should render parameters header', () => {// ArrangesetupModelParameterRulesMock({ data: [], isPending: false })diff --git a/web/app/components/plugins/plugin-detail-panel/model-selector/llm-params-panel.tsx b/web/app/components/plugins/plugin-detail-panel/model-selector/llm-params-panel.tsxindex 49933f61383..4d12efb9b56 100644--- a/web/app/components/plugins/plugin-detail-panel/model-selector/llm-params-panel.tsx+++ b/web/app/components/plugins/plugin-detail-panel/model-selector/llm-params-panel.tsx@@ -30,7 +30,8 @@ const LLMParamsPanel = ({onCompletionParamsChange,}: Props) => {const { t } = useTranslation()- const { data: parameterRulesData, isPending: isLoading } = useModelParameterRules(provider, modelId)+ const { data: parameterRulesData, isLoading } = useModelParameterRules(provider, modelId)+ const isRulesLoading = !!provider && !!modelId && isLoadingconst parameterRules: ModelParameterRule[] = useMemo(() => {return parameterRulesData?.data || []@@ -66,7 +67,7 @@ const LLMParamsPanel = ({}}- if (isLoading) {+ if (isRulesLoading) {return (<div className="mt-5"><Loading /></div>)