Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
type: Fixed
description: Fixed website monitor LLM toggle to set context_classifier when enabling LLM classification
pr: 7566
labels: []
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down Expand Up @@ -195,7 +195,7 @@ describe("LlmModelSelector", () => {

expect(
screen.queryByTestId("input-llm_model_override"),
).not.toBeInTheDocument();
).not.toBeVisible();
});
});

Expand Down
6 changes: 3 additions & 3 deletions clients/admin-ui/cypress/e2e/integration-management.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
);
Expand All @@ -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",
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand Down
43 changes: 20 additions & 23 deletions clients/admin-ui/src/features/common/form/LlmModelSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,29 +126,26 @@ export const LlmModelSelector = ({
/>
</Form.Item>
)}
{showModelField && (
<Form.Item
name={modelOverrideName}
label={
!serverSupportsLlmClassifier ? (
<Tooltip title={SWITCH_TOOLTIP_DISABLED}>
<span>{modelOverrideLabel}</span>
</Tooltip>
) : (
modelOverrideLabel
)
}
tooltip={
serverSupportsLlmClassifier ? modelOverrideTooltip : undefined
}
>
<Input
data-testid={modelFieldTestId}
placeholder={modelOverridePlaceholder}
disabled={!serverSupportsLlmClassifier}
/>
</Form.Item>
)}
<Form.Item
name={modelOverrideName}
label={
!serverSupportsLlmClassifier ? (
<Tooltip title={SWITCH_TOOLTIP_DISABLED}>
<span>{modelOverrideLabel}</span>
</Tooltip>
) : (
modelOverrideLabel
)
}
tooltip={serverSupportsLlmClassifier ? modelOverrideTooltip : undefined}
hidden={!showModelField}
>
<Input
data-testid={modelFieldTestId}
placeholder={modelOverridePlaceholder}
disabled={!serverSupportsLlmClassifier}
/>
</Form.Item>
</>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 || "",
Expand Down Expand Up @@ -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
Expand Down
Loading