Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: deprecate Parsing component and replace them in starter projects #6697

Open
wants to merge 19 commits into
base: fix/parser_component
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
Expand Up @@ -10,6 +10,7 @@ class ParseDataComponent(Component):
description = "Convert Data objects into Messages using any {field_name} from input data."
icon = "message-square"
name = "ParseData"
legacy = True
metadata = {
"legacy_name": "Parse Data",
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ParseDataFrameComponent(Component):
)
icon = "braces"
name = "ParseDataFrame"
legacy = True

inputs = [
DataFrameInput(name="df", display_name="DataFrame", info="The DataFrame to convert to text rows."),
Expand Down
593 changes: 273 additions & 320 deletions src/backend/base/langflow/initial_setup/starter_projects/Blog Writer.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

9 changes: 2 additions & 7 deletions src/frontend/tests/core/features/filterEdge-shard-0.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect, test } from "@playwright/test";
import { addLegacyComponents } from "../../utils/add-legacy-components";
import { adjustScreenView } from "../../utils/adjust-screen-view";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";

Expand All @@ -12,13 +13,7 @@ test(
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("retrievalqa");

await page.getByTestId("sidebar-options-trigger").click();
await page
.getByTestId("sidebar-legacy-switch")
.isVisible({ timeout: 5000 });
await page.getByTestId("sidebar-legacy-switch").click();
await expect(page.getByTestId("sidebar-legacy-switch")).toBeChecked();
await page.getByTestId("sidebar-options-trigger").click();
await addLegacyComponents(page);

await page.waitForTimeout(1000);
await page
Expand Down
4 changes: 3 additions & 1 deletion src/frontend/tests/core/features/freeze.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect, test } from "@playwright/test";
import { addLegacyComponents } from "../../utils/add-legacy-components";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
import { zoomOut } from "../../utils/zoom-out";

Expand All @@ -11,8 +12,9 @@ test(

await page.getByTestId("blank-flow").click();

//first component
await addLegacyComponents(page);

//first component
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("text input");
await page.waitForSelector('[data-testid="inputsText Input"]', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ withEventDeliveryModes(

expect(concatAllText.length).toBeGreaterThan(200);

expect(concatAllText).toContain("div");
expect(concatAllText).toContain("class=");
expect(concatAllText).toContain("html");
expect(concatAllText).toContain("body");
},
);
7 changes: 2 additions & 5 deletions src/frontend/tests/core/integrations/decisionFlow.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
import { addLegacyComponents } from "../../utils/add-legacy-components";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
import { zoomOut } from "../../utils/zoom-out";

Expand All @@ -23,11 +24,7 @@ test(
});
await page.getByTestId("blank-flow").click();

await page.getByTestId("sidebar-options-trigger").click();
await page
.getByTestId("sidebar-legacy-switch")
.isVisible({ timeout: 5000 });
await page.getByTestId("sidebar-legacy-switch").click();
await addLegacyComponents(page);

//---------------------------------- CHAT INPUT
await page.getByTestId("sidebar-search-input").click();
Expand Down
4 changes: 4 additions & 0 deletions src/frontend/tests/core/integrations/similarity.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect, test } from "@playwright/test";
import { addLegacyComponents } from "../../utils/add-legacy-components";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
import { updateOldComponents } from "../../utils/update-old-components";
import { zoomOut } from "../../utils/zoom-out";
Expand All @@ -16,7 +17,10 @@ test(

await page.getByTestId("blank-flow").click();

await addLegacyComponents(page);

//first component

await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("openai embedding");
await page.waitForSelector("text=OpenAI Embeddings", {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
import { addLegacyComponents } from "../../utils/add-legacy-components";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
import { initialGPTsetup } from "../../utils/initialGPTsetup";
test(
Expand Down Expand Up @@ -28,11 +29,7 @@ test(
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("message history");

await page.getByTestId("sidebar-options-trigger").click();
await page
.getByTestId("sidebar-legacy-switch")
.isVisible({ timeout: 5000 });
await page.getByTestId("sidebar-legacy-switch").click();
await addLegacyComponents(page);

// Locate the canvas element
const canvas = page.locator("#react-flow-id"); // Update the selector if needed
Expand Down
7 changes: 2 additions & 5 deletions src/frontend/tests/core/unit/codeAreaModalComponent.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { test } from "@playwright/test";
import { addLegacyComponents } from "../../utils/add-legacy-components";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";

test(
Expand All @@ -19,11 +20,7 @@ test(
timeout: 3000,
});

await page.getByTestId("sidebar-options-trigger").click();
await page
.getByTestId("sidebar-legacy-switch")
.isVisible({ timeout: 5000 });
await page.getByTestId("sidebar-legacy-switch").click();
await addLegacyComponents(page);

await page.waitForSelector('[data-testid="prototypesPython Function"]', {
timeout: 3000,
Expand Down
3 changes: 3 additions & 0 deletions src/frontend/tests/core/unit/fileUploadComponent.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect, test } from "@playwright/test";
import fs from "fs";
import path from "path";
import { addLegacyComponents } from "../../utils/add-legacy-components";
import { adjustScreenView } from "../../utils/adjust-screen-view";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
import { generateRandomFilename } from "../../utils/generate-filename";
Expand Down Expand Up @@ -29,6 +30,8 @@ test(
});
await page.getByTestId("blank-flow").click();

await addLegacyComponents(page);

await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("file");

Expand Down
9 changes: 2 additions & 7 deletions src/frontend/tests/core/unit/nestedComponent.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect, test } from "@playwright/test";
import { addLegacyComponents } from "../../utils/add-legacy-components";
import { adjustScreenView } from "../../utils/adjust-screen-view";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";

Expand All @@ -15,13 +16,7 @@ test(
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("alter metadata");

await page.getByTestId("sidebar-options-trigger").click();
await page
.getByTestId("sidebar-legacy-switch")
.isVisible({ timeout: 5000 });
await page.getByTestId("sidebar-legacy-switch").click();
await expect(page.getByTestId("sidebar-legacy-switch")).toBeChecked();
await page.getByTestId("sidebar-options-trigger").click();
await addLegacyComponents(page);

await page.waitForTimeout(500);

Expand Down
10 changes: 2 additions & 8 deletions src/frontend/tests/extended/features/filterEdge-shard-1.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect, test } from "@playwright/test";
import { addLegacyComponents } from "../../utils/add-legacy-components";
import { adjustScreenView } from "../../utils/adjust-screen-view";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";

Expand All @@ -14,14 +15,7 @@ test(
timeout: 3000,
});

await page.getByTestId("sidebar-options-trigger").click();

await expect(page.getByTestId("sidebar-legacy-switch")).toBeVisible({
timeout: 5000,
});
await page.getByTestId("sidebar-legacy-switch").click();
await expect(page.getByTestId("sidebar-legacy-switch")).toBeChecked();
await page.getByTestId("sidebar-options-trigger").click();
await addLegacyComponents(page);

await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("retrievalqa");
Expand Down
15 changes: 14 additions & 1 deletion src/frontend/tests/extended/features/loop-component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect, test } from "@playwright/test";
import { addLegacyComponents } from "../../utils/add-legacy-components";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
import { zoomOut } from "../../utils/zoom-out";

Expand All @@ -9,6 +10,8 @@ test(
await awaitBootstrapTest(page);
await page.getByTestId("blank-flow").click();

await addLegacyComponents(page);

await page.waitForSelector(
'[data-testid="sidebar-custom-component-button"]',
{
Expand Down Expand Up @@ -146,13 +149,23 @@ test(
.first()
.click();

await zoomOut(page, 4);

await page.getByTestId("div-generic-node").nth(5).click();

await page.waitForTimeout(1000);

await page.waitForSelector('[data-testid="more-options-modal"]', {
timeout: 100000,
});

await page.getByTestId("more-options-modal").click();

await page.waitForTimeout(500);
await page.waitForTimeout(1000);

await page.waitForSelector('[data-testid="expand-button-modal"]', {
timeout: 100000,
});

await page.getByTestId("expand-button-modal").click();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect, test } from "@playwright/test";
import { addLegacyComponents } from "../../utils/add-legacy-components";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";

test(
Expand All @@ -18,13 +19,7 @@ test(
timeout: 30000,
});

await page.getByTestId("sidebar-options-trigger").click();
await page
.getByTestId("sidebar-legacy-switch")
.isVisible({ timeout: 5000 });
await page.getByTestId("sidebar-legacy-switch").click();
await expect(page.getByTestId("sidebar-legacy-switch")).toBeChecked();
await page.getByTestId("sidebar-options-trigger").click();
await addLegacyComponents(page);

let modelElement = await page.getByTestId(
"langchain_utilitiesRetrieverTool",
Expand Down
9 changes: 9 additions & 0 deletions src/frontend/tests/utils/add-legacy-components.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { expect, Page } from "playwright/test";

export const addLegacyComponents = async (page: Page) => {
await page.getByTestId("sidebar-options-trigger").click();
await page.getByTestId("sidebar-legacy-switch").isVisible({ timeout: 5000 });
await page.getByTestId("sidebar-legacy-switch").click();
await expect(page.getByTestId("sidebar-legacy-switch")).toBeChecked();
await page.getByTestId("sidebar-options-trigger").click();
};
Loading