Revert "Refactor state management to use Zustand, migrate components to CustomComponent and other fixes"

This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-02-05 18:29:03 -03:00 • committed by GitHub
commit f3b3d2cf68
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
239 changed files with 28527 additions and 15390 deletions

View file

@ -3,8 +3,8 @@ export const custom = `from langflow import CustomComponent
from langchain.llms.base import BaseLLM
from langchain.chains import LLMChain
from langchain.prompts import PromptTemplate
from langchain_core.documents import Document
from langflow.field_typing import NestedDict
from langchain.schema import Document
from langchain.field_typing import NestedDict
import requests

View file

@ -44,7 +44,7 @@ test("PromptTemplateComponent", async ({ page }) => {
await page.getByTestId("genericModalBtnSave").click();
await page.getByTestId("div-textarea-prompt").click();
await page.getByTestId("div-textarea-5").click();
await page.getByTestId("text-area-modal").fill("prompt_value_!@#!@#");
value = await page.getByTestId("text-area-modal").inputValue();
@ -55,7 +55,7 @@ test("PromptTemplateComponent", async ({ page }) => {
await page.getByTestId("genericModalBtnSave").click();
await page.getByTestId("div-textarea-prompt1").click();
await page.getByTestId("div-textarea-6").click();
await page
.getByTestId("text-area-modal")
.fill("prompt_name_test_123123!@#!@#");
@ -77,31 +77,29 @@ test("PromptTemplateComponent", async ({ page }) => {
await page.getByTestId("more-options-modal").click();
await page.getByTestId("edit-button-modal").click();
value = await page.locator('//*[@id="textarea-edit-prompt"]').inputValue();
value = await page.locator('//*[@id="textarea-edit-1"]').inputValue();
if (value != "prompt_value_!@#!@#") {
expect(false).toBeTruthy();
}
value = await page.locator('//*[@id="textarea-edit-prompt1"]').inputValue();
value = await page.locator('//*[@id="textarea-edit-2"]').inputValue();
if (value != "prompt_name_test_123123!@#!@#") {
expect(false).toBeTruthy();
}
value = await page
.locator('//*[@id="prompt-area-edit-template"]')
.innerText();
value = await page.locator('//*[@id="prompt-area-edit0"]').innerText();
if (value != "{prompt} example {prompt1}") {
expect(false).toBeTruthy();
}
await page
.locator('//*[@id="textarea-edit-prompt1"]')
.locator('//*[@id="textarea-edit-2"]')
.fill("prompt_edit_test_12312312321!@#$");
await page
.locator('//*[@id="textarea-edit-prompt"]')
.locator('//*[@id="textarea-edit-1"]')
.fill("prompt_edit_test_44444444444!@#$");
await page.locator('//*[@id="showtemplate"]').click();
@ -143,29 +141,35 @@ test("PromptTemplateComponent", async ({ page }) => {
await page.locator('//*[@id="saveChangesBtn"]').click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("edit-button-modal").click();
const plusButtonLocator = page.locator('//*[@id="textarea-8"]');
const elementCount = await plusButtonLocator.count();
if (elementCount === 0) {
expect(true).toBeTruthy();
await page.locator('//*[@id="showprompt1"]').click();
expect(await page.locator('//*[@id="showprompt1"]').isChecked()).toBeTruthy();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("edit-button-modal").click();
value = await page.locator('//*[@id="textarea-edit-prompt"]').inputValue();
await page.locator('//*[@id="showprompt1"]').click();
expect(
await page.locator('//*[@id="showprompt1"]').isChecked()
).toBeTruthy();
if (value != "prompt_edit_test_44444444444!@#$") {
expect(false).toBeTruthy();
}
value = await page.locator('//*[@id="textarea-edit-1"]').inputValue();
value = await page.locator('//*[@id="textarea-edit-prompt1"]').inputValue();
if (value != "prompt_edit_test_44444444444!@#$") {
expect(false).toBeTruthy();
}
if (value != "prompt_edit_test_12312312321!@#$") {
expect(false).toBeTruthy();
}
value = await page.locator('//*[@id="textarea-edit-2"]').inputValue();
value = await page
.locator('//*[@id="prompt-area-edit-template"]')
.innerText();
if (value != "prompt_edit_test_12312312321!@#$") {
expect(false).toBeTruthy();
}
if (value != "{prompt} example {prompt1}") {
expect(false).toBeTruthy();
value = await page.locator('//*[@id="prompt-area-edit0"]').innerText();
if (value != "{prompt} example {prompt1}") {
expect(false).toBeTruthy();
}
}
});

View file

@ -43,7 +43,9 @@ test.describe("drag and drop test", () => {
);
await page
.getByTestId("edit-flow-button-e9ac1bdc-429b-475d-ac03-d26f9a2a3210-0")
.locator(
'//*[@id="root"]/div/div[1]/div[2]/div[3]/div/div/div/div/div/div/div/div[2]/span[2]'
)
.click();
await page.waitForTimeout(2000);

View file

@ -33,8 +33,7 @@ test.describe("group node test", () => {
return dt;
}, jsonContent);
page.waitForTimeout(2000);
// Now dispatch
await page.dispatchEvent(
'//*[@id="root"]/div/div[1]/div[2]/div[3]/div/div',
"drop",
@ -44,7 +43,9 @@ test.describe("group node test", () => {
);
await page
.getByTestId("edit-flow-button-e9ac1bdc-429b-475d-ac03-d26f9a2a3210-0")
.locator(
'//*[@id="root"]/div/div[1]/div[2]/div[3]/div/div/div/div/div/div/div/div[2]/span[2]'
)
.click();
await page.waitForTimeout(2000);
@ -66,8 +67,9 @@ test.describe("group node test", () => {
});
await page.getByRole("button", { name: "Group" }).click();
await page.locator("div").filter({ hasText: "Star13756" }).nth(3).click();
const textArea = page.getByTestId("div-textarea-description");
const textArea = page.getByTestId("div-textarea-2");
const elementCountText = await textArea.count();
if (elementCountText > 0) {
expect(true).toBeTruthy();
@ -78,7 +80,5 @@ test.describe("group node test", () => {
if (elementGroup > 0) {
expect(true).toBeTruthy();
}
// Now dispatch
});
});

View file

@ -26,7 +26,8 @@ test("NestedComponent", async ({ page }) => {
.getByTestId("vectorstoresPinecone")
.first()
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.click('//*[@id="react-flow-id"]');
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("edit-button-modal").click();

View file

@ -51,7 +51,9 @@ test.describe("save component tests", () => {
);
await page
.getByTestId("edit-flow-button-e9ac1bdc-429b-475d-ac03-d26f9a2a3210-0")
.locator(
'//*[@id="root"]/div/div[1]/div[2]/div[3]/div/div/div/div/div/div/div/div[2]/span[2]'
)
.click();
await page.waitForTimeout(2000);
@ -73,8 +75,9 @@ test.describe("save component tests", () => {
});
await page.getByRole("button", { name: "Group" }).click();
await page.locator("div").filter({ hasText: "Star13756" }).nth(3).click();
let textArea = page.getByTestId("div-textarea-description");
let textArea = page.getByTestId("div-textarea-2");
let elementCountText = await textArea.count();
if (elementCountText > 0) {
expect(true).toBeTruthy();
@ -102,7 +105,7 @@ test.describe("save component tests", () => {
await page.mouse.up();
await page.mouse.down();
textArea = page.getByTestId("div-textarea-description");
textArea = page.getByTestId("div-textarea-2");
elementCountText = await textArea.count();
if (elementCountText > 0) {
expect(true).toBeTruthy();