diff --git a/changelog/7566-fix-website-monitor-llm-context-classifier.yaml b/changelog/7566-fix-website-monitor-llm-context-classifier.yaml new file mode 100644 index 00000000000..04b6aae93e5 --- /dev/null +++ b/changelog/7566-fix-website-monitor-llm-context-classifier.yaml @@ -0,0 +1,4 @@ +type: Fixed +description: Fixed website monitor LLM toggle to set context_classifier when enabling LLM classification +pr: 7566 +labels: [] diff --git a/clients/admin-ui/__tests__/features/common/form/LlmModelSelector.test.tsx b/clients/admin-ui/__tests__/features/common/form/LlmModelSelector.test.tsx index 942cc835b6f..a5b36e7ded3 100644 --- a/clients/admin-ui/__tests__/features/common/form/LlmModelSelector.test.tsx +++ b/clients/admin-ui/__tests__/features/common/form/LlmModelSelector.test.tsx @@ -113,7 +113,7 @@ describe("LlmModelSelector", () => { expect( screen.queryByTestId("input-llm_model_override"), - ).not.toBeInTheDocument(); + ).not.toBeVisible(); }); it("shows model override field when switch is on", () => { @@ -195,7 +195,7 @@ describe("LlmModelSelector", () => { expect( screen.queryByTestId("input-llm_model_override"), - ).not.toBeInTheDocument(); + ).not.toBeVisible(); }); }); diff --git a/clients/admin-ui/cypress/e2e/integration-management.cy.ts b/clients/admin-ui/cypress/e2e/integration-management.cy.ts index 7082551ad26..51545da4643 100644 --- a/clients/admin-ui/cypress/e2e/integration-management.cy.ts +++ b/clients/admin-ui/cypress/e2e/integration-management.cy.ts @@ -821,7 +821,7 @@ describe("Integration management for data detection & discovery", () => { // Toggle it back off cy.getByTestId("input-use_llm_classifier").click(); - cy.getByTestId("input-llm_model_override").should("not.exist"); + cy.getByTestId("input-llm_model_override").should("not.be.visible"); cy.getByTestId("controlled-select-prompt_template").should( "not.exist", ); @@ -846,8 +846,8 @@ describe("Integration management for data detection & discovery", () => { .should("exist") .should("be.disabled"); - // LLM fields should not exist - cy.getByTestId("input-llm_model_override").should("not.exist"); + // LLM fields should not be visible + cy.getByTestId("input-llm_model_override").should("not.be.visible"); cy.getByTestId("controlled-select-prompt_template").should( "not.exist", ); diff --git a/clients/admin-ui/cypress/e2e/systems/plus/bulk-vendor-add.cy.ts b/clients/admin-ui/cypress/e2e/systems/plus/bulk-vendor-add.cy.ts index da9f7969216..bb223f8aaf0 100644 --- a/clients/admin-ui/cypress/e2e/systems/plus/bulk-vendor-add.cy.ts +++ b/clients/admin-ui/cypress/e2e/systems/plus/bulk-vendor-add.cy.ts @@ -86,12 +86,18 @@ describe("Plus Bulk Vendor Add", () => { stubDatamap(); cy.visit(ADD_SYSTEMS_MULTIPLE_ROUTE); cy.wait("@getSystemVendors"); + cy.wait("@getDict"); + // unreliable test because when dictionary loads it overrides the rows selected + // adding a .wait to make it more reliable + // eslint-disable-next-line cypress/no-unnecessary-waiting + cy.wait(500); cy.get('[type="checkbox"').check({ force: true }); cy.getByTestId("add-multiple-systems-btn") .should("exist") .click({ force: true }); cy.getByTestId("confirmation-modal"); cy.getByTestId("continue-btn").click({ force: true }); + cy.wait("@postSystemVendors"); cy.url().should("include", DATAMAP_ROUTE); }); diff --git a/clients/admin-ui/src/features/common/form/LlmModelSelector.tsx b/clients/admin-ui/src/features/common/form/LlmModelSelector.tsx index f01aa643be8..ccc23a49a13 100644 --- a/clients/admin-ui/src/features/common/form/LlmModelSelector.tsx +++ b/clients/admin-ui/src/features/common/form/LlmModelSelector.tsx @@ -126,29 +126,26 @@ export const LlmModelSelector = ({ /> )} - {showModelField && ( - - {modelOverrideLabel} - - ) : ( - modelOverrideLabel - ) - } - tooltip={ - serverSupportsLlmClassifier ? modelOverrideTooltip : undefined - } - > - - - )} + + {modelOverrideLabel} + + ) : ( + modelOverrideLabel + ) + } + tooltip={serverSupportsLlmClassifier ? modelOverrideTooltip : undefined} + hidden={!showModelField} + > + + ); }; diff --git a/clients/admin-ui/src/features/integrations/configure-monitor/ConfigureWebsiteMonitorForm.tsx b/clients/admin-ui/src/features/integrations/configure-monitor/ConfigureWebsiteMonitorForm.tsx index 616e150e61e..2853f2c39fe 100644 --- a/clients/admin-ui/src/features/integrations/configure-monitor/ConfigureWebsiteMonitorForm.tsx +++ b/clients/admin-ui/src/features/integrations/configure-monitor/ConfigureWebsiteMonitorForm.tsx @@ -116,7 +116,7 @@ const ConfigureWebsiteMonitorForm = ({ // Check if monitor currently uses LLM classifier const monitorUsesLlmClassifier = - !!monitor?.classify_params?.llm_model_override; + monitor?.classify_params?.context_classifier === "llm"; const initialValues: WebsiteMonitorConfigFormValues = { name: monitor?.name || "", @@ -152,10 +152,9 @@ const ConfigureWebsiteMonitorForm = ({ // Build classify_params based on LLM classifier toggle const classifyParams = { - ...(monitor?.classify_params || {}), - llm_model_override: values.use_llm_classifier - ? values.llm_model_override - : undefined, + ...(monitor?.classify_params ?? {}), + context_classifier: values.use_llm_classifier ? "llm" : undefined, + llm_model_override: values.llm_model_override || undefined, }; // Destructure form-only fields to exclude them from payload // eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-unused-vars