From 824b9b82e917cba81ddfbeac409980dd3c2a9096 Mon Sep 17 00:00:00 2001 From: cristhianzl Date: Tue, 1 Oct 2024 12:31:55 -0300 Subject: [PATCH 1/6] =?UTF-8?q?=F0=9F=90=9B=20(model.py):=20fix=20issue=20?= =?UTF-8?q?where=20message.files=20was=20not=20being=20updated=20correctly?= =?UTF-8?q?=20when=20image=5Fpaths=20is=20empty=20in=20MessageBase=20class?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/langflow/services/database/models/message/model.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/backend/base/langflow/services/database/models/message/model.py b/src/backend/base/langflow/services/database/models/message/model.py index d6e027885d6b..c32827f8ab20 100644 --- a/src/backend/base/langflow/services/database/models/message/model.py +++ b/src/backend/base/langflow/services/database/models/message/model.py @@ -36,7 +36,9 @@ def from_message(cls, message: "Message", flow_id: str | UUID | None = None): if hasattr(file, "path") and hasattr(file, "url") and file.path: session_id = message.session_id image_paths.append(f"{session_id}{file.path.split(session_id)[1]}") - message.files = image_paths + if len(image_paths) > 0: + message.files = image_paths + if isinstance(message.timestamp, str): timestamp = datetime.fromisoformat(message.timestamp) else: From c7e9ffe1ea517197d62ec91a5743465730b82ee7 Mon Sep 17 00:00:00 2001 From: cristhianzl Date: Tue, 1 Oct 2024 15:01:45 -0300 Subject: [PATCH 2/6] =?UTF-8?q?=F0=9F=90=9B=20(model.py):=20simplify=20con?= =?UTF-8?q?dition=20for=20checking=20if=20image=5Fpaths=20is=20not=20empty?= =?UTF-8?q?=20to=20improve=20readability=20and=20maintainability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/langflow/services/database/models/message/model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/base/langflow/services/database/models/message/model.py b/src/backend/base/langflow/services/database/models/message/model.py index c32827f8ab20..f2f9437aea70 100644 --- a/src/backend/base/langflow/services/database/models/message/model.py +++ b/src/backend/base/langflow/services/database/models/message/model.py @@ -36,7 +36,7 @@ def from_message(cls, message: "Message", flow_id: str | UUID | None = None): if hasattr(file, "path") and hasattr(file, "url") and file.path: session_id = message.session_id image_paths.append(f"{session_id}{file.path.split(session_id)[1]}") - if len(image_paths) > 0: + if image_paths: message.files = image_paths if isinstance(message.timestamp, str): From 13f81aa146d9338138e2d33f63bc804843aceda9 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Tue, 1 Oct 2024 18:04:07 +0000 Subject: [PATCH 3/6] [autofix.ci] apply automated fixes --- .../base/langflow/components/output_parsers/OutputParser.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/backend/base/langflow/components/output_parsers/OutputParser.py b/src/backend/base/langflow/components/output_parsers/OutputParser.py index ce32700a09f0..6a054d10cf9f 100644 --- a/src/backend/base/langflow/components/output_parsers/OutputParser.py +++ b/src/backend/base/langflow/components/output_parsers/OutputParser.py @@ -34,11 +34,9 @@ class OutputParserComponent(Component): def build_parser(self) -> OutputParser: if self.parser_type == "CSV": return CommaSeparatedListOutputParser() - else: - raise ValueError("Unsupported or missing parser") + raise ValueError("Unsupported or missing parser") def format_instructions(self) -> Message: if self.parser_type == "CSV": return Message(text=CommaSeparatedListOutputParser().get_format_instructions()) - else: - raise ValueError("Unsupported or missing parser") + raise ValueError("Unsupported or missing parser") From fd585058b1f2d209065d17d8dc00c8c6f0982a80 Mon Sep 17 00:00:00 2001 From: cristhianzl Date: Tue, 1 Oct 2024 15:11:30 -0300 Subject: [PATCH 4/6] =?UTF-8?q?=F0=9F=94=A7=20(OutputParser.py):=20refacto?= =?UTF-8?q?r=20error=20message=20handling=20for=20unsupported=20or=20missi?= =?UTF-8?q?ng=20parser=20to=20improve=20readability=20and=20maintainabilit?= =?UTF-8?q?y?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/langflow/components/output_parsers/OutputParser.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/backend/base/langflow/components/output_parsers/OutputParser.py b/src/backend/base/langflow/components/output_parsers/OutputParser.py index ce32700a09f0..1442deb9ba84 100644 --- a/src/backend/base/langflow/components/output_parsers/OutputParser.py +++ b/src/backend/base/langflow/components/output_parsers/OutputParser.py @@ -35,10 +35,12 @@ def build_parser(self) -> OutputParser: if self.parser_type == "CSV": return CommaSeparatedListOutputParser() else: - raise ValueError("Unsupported or missing parser") + msg = "Unsupported or missing parser" + raise ValueError(msg) def format_instructions(self) -> Message: if self.parser_type == "CSV": return Message(text=CommaSeparatedListOutputParser().get_format_instructions()) else: - raise ValueError("Unsupported or missing parser") + msg = "Unsupported or missing parser" + raise ValueError(msg) From 1860b2665c6ac8577d74559c03686b7b7a6cda29 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Tue, 1 Oct 2024 18:16:30 +0000 Subject: [PATCH 5/6] [autofix.ci] apply automated fixes --- .../langflow/components/output_parsers/OutputParser.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/backend/base/langflow/components/output_parsers/OutputParser.py b/src/backend/base/langflow/components/output_parsers/OutputParser.py index 1442deb9ba84..0dfa37273767 100644 --- a/src/backend/base/langflow/components/output_parsers/OutputParser.py +++ b/src/backend/base/langflow/components/output_parsers/OutputParser.py @@ -34,13 +34,11 @@ class OutputParserComponent(Component): def build_parser(self) -> OutputParser: if self.parser_type == "CSV": return CommaSeparatedListOutputParser() - else: - msg = "Unsupported or missing parser" - raise ValueError(msg) + msg = "Unsupported or missing parser" + raise ValueError(msg) def format_instructions(self) -> Message: if self.parser_type == "CSV": return Message(text=CommaSeparatedListOutputParser().get_format_instructions()) - else: - msg = "Unsupported or missing parser" - raise ValueError(msg) + msg = "Unsupported or missing parser" + raise ValueError(msg) From 60b79345f55c2d2efb64986589f6fda4cd32b32f Mon Sep 17 00:00:00 2001 From: cristhianzl Date: Tue, 1 Oct 2024 15:34:01 -0300 Subject: [PATCH 6/6] =?UTF-8?q?=E2=9C=A8=20(Simple=20Agent.spec.ts):=20add?= =?UTF-8?q?=20ua-parser-js=20library=20to=20parse=20user=20agent=20string?= =?UTF-8?q?=20for=20better=20browser=20compatibility=20handling=20?= =?UTF-8?q?=F0=9F=93=9D=20(Simple=20Agent.spec.ts):=20update=20test=20to?= =?UTF-8?q?=20use=20ua-parser-js=20to=20determine=20control=20key=20based?= =?UTF-8?q?=20on=20user's=20operating=20system?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tests/core/integrations/Simple Agent.spec.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/frontend/tests/core/integrations/Simple Agent.spec.ts b/src/frontend/tests/core/integrations/Simple Agent.spec.ts index 26dafbefccfb..1c7568466f9b 100644 --- a/src/frontend/tests/core/integrations/Simple Agent.spec.ts +++ b/src/frontend/tests/core/integrations/Simple Agent.spec.ts @@ -1,6 +1,7 @@ import { expect, test } from "@playwright/test"; import * as dotenv from "dotenv"; import path from "path"; +import uaParser from "ua-parser-js"; test("Simple Agent", async ({ page }) => { test.skip( @@ -37,6 +38,14 @@ test("Simple Agent", async ({ page }) => { modalCount = await page.getByTestId("modal-title")?.count(); } + const getUA = await page.evaluate(() => navigator.userAgent); + const userAgentInfo = uaParser(getUA); + let control = "Control"; + + if (userAgentInfo.os.name.includes("Mac")) { + control = "Meta"; + } + await page.getByRole("heading", { name: "Simple Agent" }).click(); await page.waitForSelector('[title="fit view"]', { @@ -124,7 +133,7 @@ test("Simple Agent", async ({ page }) => { await page.waitForTimeout(500); - await page.keyboard.press("Control+V"); + await page.keyboard.press(`${control}+V`); await page.waitForTimeout(500);