- {myData.node?.template[templateParam].type ===
- "str" &&
- !myData.node.template[templateParam].options ? (
+
- {myData.node.template[templateParam]
+ {myData.node!.template[templateParam]
?.list ? (
{
handleOnNewValue(
value,
- templateParam
+ templateParam,
);
}}
/>
- ) : myData.node.template[templateParam]
+ ) : myData.node!.template[templateParam]
.multiline ? (
{
handleOnNewValue(
value,
- templateParam
+ templateParam,
);
}}
/>
@@ -274,8 +282,13 @@ const EditNodeModal = forwardRef(
/>
)}
- ) : myData.node?.template[templateParam]
- .type === "NestedDict" ? (
+
+
+
- ) : myData.node?.template[templateParam]
- .type === "dict" ? (
+
+
+
1
? "my-3"
- : ""
+ : "",
)}
>
- ) : myData.node?.template[templateParam]
- .type === "bool" ? (
+
+
+
{" "}
{
handleOnNewValue(
isEnabled,
- templateParam
+ templateParam,
);
}}
size="small"
editNode={true}
/>
- ) : myData.node?.template[templateParam]
- .type === "float" ? (
+
+
+
{
@@ -392,32 +416,38 @@ const EditNodeModal = forwardRef(
}}
/>
- ) : myData.node?.template[templateParam]
- .type === "str" &&
- myData.node.template[templateParam]
- .options ? (
+
+
+
handleOnNewValue(value, templateParam)
}
value={
- myData.node.template[templateParam]
+ myData.node!.template[templateParam]
.value ?? "Choose an option"
}
id={
"dropdown-edit-" +
- myData.node.template[templateParam].name
+ myData.node!.template[templateParam]
+ .name
}
>
- ) : myData.node?.template[templateParam]
- .type === "int" ? (
+
+
+
{
@@ -439,21 +470,24 @@ const EditNodeModal = forwardRef(
}}
/>
- ) : myData.node?.template[templateParam]
- .type === "file" ? (
+
+
+
{
handleOnNewValue(value, templateParam);
}}
fileTypes={
- myData.node.template[templateParam]
+ myData.node!.template[templateParam]
.fileTypes
}
onFileChange={(filePath: string) => {
@@ -463,8 +497,11 @@ const EditNodeModal = forwardRef(
}}
>
- ) : myData.node?.template[templateParam]
- .type === "prompt" ? (
+
+
+
{
@@ -486,21 +523,26 @@ const EditNodeModal = forwardRef(
}}
id={
"prompt-area-edit-" +
- myData.node.template[templateParam].name
+ myData.node!.template[templateParam]
+ .name
}
data-testid={
"modal-prompt-input-" +
- myData.node.template[templateParam].name
+ myData.node!.template[templateParam]
+ .name
}
/>
- ) : myData.node?.template[templateParam]
- .type === "code" ? (
+
+
+
{
@@ -524,16 +566,16 @@ const EditNodeModal = forwardRef(
}}
id={
"code-area-edit" +
- myData.node.template[templateParam].name
+ myData.node!.template[templateParam]
+ .name
}
/>
- ) : myData.node?.template[templateParam]
- .type === "Any" ? (
- "-"
- ) : (
-
- )}
+
+
+
+ <>->
+
@@ -588,7 +630,7 @@ const EditNodeModal = forwardRef(
);
- }
+ },
);
export default EditNodeModal;
diff --git a/src/frontend/src/shared/components/caseComponent/index.tsx b/src/frontend/src/shared/components/caseComponent/index.tsx
new file mode 100644
index 000000000..c5330af3d
--- /dev/null
+++ b/src/frontend/src/shared/components/caseComponent/index.tsx
@@ -0,0 +1,15 @@
+import { memo } from "react";
+
+type BooleanLike = boolean | string | number | null | undefined;
+
+type Props = {
+ condition: (() => BooleanLike) | BooleanLike;
+ children: React.ReactNode | any;
+};
+
+export const Case = memo(({ condition, children }: Props) => {
+ const conditionResult =
+ typeof condition === "function" ? condition() : condition;
+
+ return conditionResult ? children : null;
+});
diff --git a/src/frontend/src/types/components/index.ts b/src/frontend/src/types/components/index.ts
index 2724cb5ee..8e78e2bc1 100644
--- a/src/frontend/src/types/components/index.ts
+++ b/src/frontend/src/types/components/index.ts
@@ -400,6 +400,7 @@ export type StoreApiKeyType = {
export type groupedObjType = {
family: string;
type: string;
+ display_name?: string;
};
export type nodeGroupedObjType = {
diff --git a/src/frontend/src/utils/reactflowUtils.ts b/src/frontend/src/utils/reactflowUtils.ts
index d222db3da..d56041068 100644
--- a/src/frontend/src/utils/reactflowUtils.ts
+++ b/src/frontend/src/utils/reactflowUtils.ts
@@ -461,7 +461,8 @@ export function getConnectedNodes(
return nodes.filter((node) => node.id === targetId || node.id === sourceId);
}
-export function convertObjToArray(singleObject: object | string) {
+export function convertObjToArray(singleObject: object | string, type: string) {
+ if (type !== "dict") return [{ "": "" }];
if (typeof singleObject === "string") {
singleObject = JSON.parse(singleObject);
}
diff --git a/src/frontend/tests/end-to-end/deleteComponentFlows.spec.ts b/src/frontend/tests/end-to-end/deleteComponentFlows.spec.ts
index ecb590aa9..7ca9c482c 100644
--- a/src/frontend/tests/end-to-end/deleteComponentFlows.spec.ts
+++ b/src/frontend/tests/end-to-end/deleteComponentFlows.spec.ts
@@ -4,6 +4,14 @@ test("shoud delete a flow", async ({ page }) => {
await page.goto("/");
await page.waitForTimeout(2000);
await page.getByText("Store").nth(0).click();
+
+ await page.getByText("API Key", { exact: true }).click();
+ await page
+ .getByPlaceholder("Insert your API Key", { exact: true })
+ .fill(process.env.STORE_API_KEY ?? "");
+ await page.getByText("Save").last().click();
+ await page.waitForTimeout(8000);
+
await page.getByTestId("install-Website Content QA").click();
await page.waitForTimeout(5000);
await page.getByText("My Collection").nth(0).click();
@@ -16,7 +24,9 @@ test("shoud delete a flow", async ({ page }) => {
await page.getByTestId("icon-Trash2").first().click();
await page.waitForTimeout(2000);
});
- await page.getByText("Confirm deletion of component?").isVisible();
+ await page
+ .getByText("Are you sure you want to delete the selected component?")
+ .isVisible();
await page.getByText("Delete").nth(1).click();
await page.waitForTimeout(1000);
await page.getByText("Successfully").first().isVisible();
@@ -39,7 +49,9 @@ test("shoud delete a component", async ({ page }) => {
await page.getByTestId("icon-Trash2").first().click();
await page.waitForTimeout(2000);
});
- await page.getByText("Confirm deletion of component?").isVisible();
+ await page
+ .getByText("Are you sure you want to delete the selected component?")
+ .isVisible();
await page.getByText("Delete").nth(1).click();
await page.waitForTimeout(1000);
await page.getByText("Successfully").first().isVisible();
diff --git a/src/frontend/tests/end-to-end/nestedComponent.spec.ts b/src/frontend/tests/end-to-end/nestedComponent.spec.ts
index a6b358f71..891229aaf 100644
--- a/src/frontend/tests/end-to-end/nestedComponent.spec.ts
+++ b/src/frontend/tests/end-to-end/nestedComponent.spec.ts
@@ -15,7 +15,7 @@ test("NestedComponent", async ({ page }) => {
}
while (modalCount === 0) {
- await page.locator('//*[@id="new-project-btn"]').click();
+ await page.getByText("New Project", { exact: true }).click();
await page.waitForTimeout(5000);
modalCount = await page.getByTestId("modal-title")?.count();
}
@@ -70,13 +70,6 @@ test("NestedComponent", async ({ page }) => {
await page.locator('//*[@id="showpinecone_api_key"]').isChecked()
).toBeFalsy();
- // showpinecone_env
- await page.locator('//*[@id="showpinecone_env"]').click();
-
- expect(
- await page.locator('//*[@id="showpinecone_env"]').isChecked()
- ).toBeFalsy();
-
// showindex_name
await page.locator('//*[@id="showindex_name"]').click();
@@ -98,13 +91,6 @@ test("NestedComponent", async ({ page }) => {
await page.locator('//*[@id="showpinecone_api_key"]').isChecked()
).toBeTruthy();
- // showpinecone_env
- await page.locator('//*[@id="showpinecone_env"]').click();
-
- expect(
- await page.locator('//*[@id="showpinecone_env"]').isChecked()
- ).toBeTruthy();
-
// showindex_name
await page.locator('//*[@id="showindex_name"]').click();
@@ -126,13 +112,6 @@ test("NestedComponent", async ({ page }) => {
await page.locator('//*[@id="showpinecone_api_key"]').isChecked()
).toBeFalsy();
- // showpinecone_env
- await page.locator('//*[@id="showpinecone_env"]').click();
-
- expect(
- await page.locator('//*[@id="showpinecone_env"]').isChecked()
- ).toBeFalsy();
-
// showindex_name
await page.locator('//*[@id="showindex_name"]').click();
@@ -154,13 +133,6 @@ test("NestedComponent", async ({ page }) => {
await page.locator('//*[@id="showpinecone_api_key"]').isChecked()
).toBeTruthy();
- // showpinecone_env
- await page.locator('//*[@id="showpinecone_env"]').click();
-
- expect(
- await page.locator('//*[@id="showpinecone_env"]').isChecked()
- ).toBeTruthy();
-
// showindex_name
await page.locator('//*[@id="showindex_name"]').click();
@@ -182,13 +154,6 @@ test("NestedComponent", async ({ page }) => {
await page.locator('//*[@id="showpinecone_api_key"]').isChecked()
).toBeFalsy();
- // showpinecone_env
- await page.locator('//*[@id="showpinecone_env"]').click();
-
- expect(
- await page.locator('//*[@id="showpinecone_env"]').isChecked()
- ).toBeFalsy();
-
// showindex_name
await page.locator('//*[@id="showindex_name"]').click();
@@ -210,13 +175,6 @@ test("NestedComponent", async ({ page }) => {
await page.locator('//*[@id="showpinecone_api_key"]').isChecked()
).toBeTruthy();
- // showpinecone_env
- await page.locator('//*[@id="showpinecone_env"]').click();
-
- expect(
- await page.locator('//*[@id="showpinecone_env"]').isChecked()
- ).toBeTruthy();
-
//showpool_threads
await page.locator('//*[@id="showpool_threads"]').click();
diff --git a/src/frontend/tests/end-to-end/saveComponents.spec.ts b/src/frontend/tests/end-to-end/saveComponents.spec.ts
index b089abc9c..acd8a61e9 100644
--- a/src/frontend/tests/end-to-end/saveComponents.spec.ts
+++ b/src/frontend/tests/end-to-end/saveComponents.spec.ts
@@ -16,7 +16,7 @@ test.describe("save component tests", () => {
}
while (modalCount === 0) {
- await page.locator('//*[@id="new-project-btn"]').click();
+ await page.getByText("New Project", { exact: true }).click();
await page.waitForTimeout(5000);
modalCount = await page.getByTestId("modal-title")?.count();
}
@@ -61,9 +61,6 @@ test.describe("save component tests", () => {
.locator('//*[@id="react-flow-id"]/div[1]/div[2]/button[3]')
.click();
- await page.getByTestId("title-PythonFunctionTool").click({
- modifiers: ["Control"],
- });
await page.getByTestId("title-ChatOpenAI").click({
modifiers: ["Control"],
});
diff --git a/src/frontend/tests/end-to-end/store.spec.ts b/src/frontend/tests/end-to-end/store.spec.ts
index 6e372c5b0..2eff8879a 100644
--- a/src/frontend/tests/end-to-end/store.spec.ts
+++ b/src/frontend/tests/end-to-end/store.spec.ts
@@ -144,7 +144,7 @@ test("should add API-KEY", async ({ page }) => {
await page.getByTestId("api-key-button-store").click();
await page
.getByPlaceholder("Insert your API Key")
- .fill("x1fOKU0v2e5zL5d-BZW6CxZBZvoyuFgF");
+ .fill(process.env.STORE_API_KEY ?? "");
await page.getByTestId("api-key-save-button-store").click();
await page.waitForTimeout(2000);
@@ -165,7 +165,7 @@ test("should like and add components and flows", async ({ page }) => {
await page
.getByPlaceholder("Insert your API Key")
- .fill("x1fOKU0v2e5zL5d-BZW6CxZBZvoyuFgF");
+ .fill(process.env.STORE_API_KEY ?? "");
await page.getByTestId("api-key-save-button-store").click();
await page.waitForTimeout(2000);
@@ -174,6 +174,8 @@ test("should like and add components and flows", async ({ page }) => {
await page.waitForTimeout(2000);
await page.getByText("API Key Error").isHidden();
+ await page.waitForTimeout(5000);
+
const likedValue = await page
.getByTestId("likes-Website Content QA")
.innerText();
@@ -214,7 +216,7 @@ test("should like and add components and flows", async ({ page }) => {
await page.getByText("My Collection").click();
await page.getByText("Website Content QA").first().isVisible();
- await page.getByTestId("sidebar-nav-Components").click();
+ await page.getByText("Components").first().click();
await page.getByText("Basic RAG").first().isVisible();
});
@@ -233,7 +235,7 @@ test("should share component with share button", async ({ page }) => {
}
while (modalCount === 0) {
- await page.locator('//*[@id="new-project-btn"]').click();
+ await page.getByText("New Project", { exact: true }).click();
await page.waitForTimeout(5000);
modalCount = await page.getByTestId("modal-title")?.count();
}
diff --git a/src/frontend/tests/end-to-end/tweaks_test.spec.ts b/src/frontend/tests/end-to-end/tweaks_test.spec.ts
index 55386fcae..7d29f9e4c 100644
--- a/src/frontend/tests/end-to-end/tweaks_test.spec.ts
+++ b/src/frontend/tests/end-to-end/tweaks_test.spec.ts
@@ -13,7 +13,7 @@ test("curl_api_generation", async ({ page, context }) => {
}
while (modalCount === 0) {
- await page.locator('//*[@id="new-project-btn"]').click();
+ await page.getByText("New Project", { exact: true }).click();
await page.waitForTimeout(5000);
modalCount = await page.getByTestId("modal-title")?.count();
}
@@ -24,7 +24,7 @@ test("curl_api_generation", async ({ page, context }) => {
await page.getByRole("tab", { name: "cURL" }).click();
await page.getByRole("button", { name: "Copy Code" }).click();
const handle = await page.evaluateHandle(() =>
- navigator.clipboard.readText(),
+ navigator.clipboard.readText()
);
const clipboardContent = await handle.jsonValue();
const oldValue = clipboardContent;
@@ -50,7 +50,7 @@ test("curl_api_generation", async ({ page, context }) => {
await page.getByRole("tab", { name: "cURL" }).click();
await page.getByRole("button", { name: "Copy Code" }).click();
const handle2 = await page.evaluateHandle(() =>
- navigator.clipboard.readText(),
+ navigator.clipboard.readText()
);
const clipboardContent2 = await handle2.jsonValue();
const newValue = clipboardContent2;
@@ -75,7 +75,7 @@ test("check if tweaks are updating when someothing on the flow changes", async (
}
while (modalCount === 0) {
- await page.locator('//*[@id="new-project-btn"]').click();
+ await page.getByText("New Project", { exact: true }).click();
await page.waitForTimeout(5000);
modalCount = await page.getByTestId("modal-title")?.count();
}