refactor: reorganize components and update PromptComponent with priority attribute (#8667)

* Update styleUtils.ts

* update to prompt component

* update to template

* update to mcp component

* update to smart function

* [autofix.ci] apply automated fixes

* update to templates

* fix sidebar

* change name

* update import

* update import

* update import

* [autofix.ci] apply automated fixes

* fix import

* fix ollama

* fix ruff

* refactor(agent): standardize memory handling and update chat history logic (#8715)

* update chat history

* update to agents

* Update Simple Agent.json

* update to templates

* ruff errors

* Update agent.py

* Update test_agent_component.py

* [autofix.ci] apply automated fixes

* update templates

* test fix

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Mike Fortman <michael.fortman@datastax.com>

* fix prompt change

* feat(message): support sequencing of multiple streamable models (#8434)

* feat: update OpenAI model parameters handling for reasoning models

* feat: extend input_value type in LCModelComponent to support AsyncIterator and Iterator

* refactor: remove assert_streaming_sequence method and related checks from Graph class

* feat: add consume_iterator method to Message class for handling iterators

* test: add unit tests for OpenAIModelComponent functionality and integration

* feat: update OpenAIModelComponent to include temperature and seed parameters in build_model method

* feat: rename consume_iterator method to consume_iterator_in_text and update its implementation for handling text

* feat: add is_connected_to_chat_output method to Component class for improved message handling

* feat: refactor LCModelComponent methods to support asynchronous message handling and improve chat output integration

* refactor: remove consume_iterator_in_text method from Message class and clean up LCModelComponent input handling

* fix: update import paths for input components in multiple starter project JSON files

* fix: enhance error message formatting in ErrorMessage class to handle additional exception attributes

* refactor: remove validate_stream calls from generate_flow_events and Graph class to streamline flow processing

* fix: handle asyncio.CancelledError in aadd_messagetables to ensure proper session rollback and retry logic

* refactor: streamline message handling in LCModelComponent by replacing async invocation with synchronous calls and updating message text handling

* refactor: enhance message handling in LCModelComponent by introducing lf_message for improved return value management and updating properties for consistency

* feat: add _build_source method to Component class for enhanced source handling and flexibility in source object management

* feat: enhance LCModelComponent by adding _handle_stream method for improved streaming response handling and refactoring chat output integration

* feat: update MemoryComponent to enhance message retrieval and storage functionality, including new sender type handling and output options for text and dataframe formats

* test: refactor LanguageModelComponent tests to use ComponentTestBaseWithoutClient and add tests for Google model creation and error handling

* test: add fixtures for API keys and implement live API tests for OpenAI, Anthropic, and Google models

* fix: reorder JSON properties for consistency in starter projects

* Updated JSON files for various starter projects to ensure consistent ordering of properties, specifically moving "type" to follow "selected_output" for better readability and maintainability.
* Affected files: Basic Prompt Chaining.json, Blog Writer.json, Financial Report Parser.json, Hybrid Search RAG.json, SEO Keyword Generator.json.

* refactor: simplify input_value type in LCModelComponent

* Updated the input_value parameter in LCModelComponent to remove AsyncIterator and Iterator types, streamlining the input options to only str and Message for improved clarity and maintainability.
* This change enhances the documentation and understanding of the expected input types for the component.

* fix: clarify comment for handling source in Component class

* refactor: remove unnecessary mocking in OpenAI model integration tests

* auto update

* update

* [autofix.ci] apply automated fixes

* fix openai import

* revert template changes

* test fixes

* update templates

* [autofix.ci] apply automated fixes

* fix tests

* fix order

* fix prompts import

* fix frontend tests

* fix frontend

* [autofix.ci] apply automated fixes

* add charmander

* [autofix.ci] apply automated fixes

* fix prompt frontend

* fix frontend

* test fix

* [autofix.ci] apply automated fixes

* change pokedex

* remove pokedex extra

* update template

* name fix

* update template

* mcp test fix

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
Co-authored-by: Yuqi Tang <yuqi.tang@datastax.com>
Co-authored-by: Mike Fortman <michael.fortman@datastax.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
This commit is contained in:
Edwin Jose 2025-06-27 12:02:06 -05:00 • committed by GitHub
commit 5ba8f91c9a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
96 changed files with 234 additions and 218 deletions

View file

@ -56,8 +56,7 @@ test(
.isVisible();
});
await expect(page.getByTestId("disclosure-i/o")).toBeVisible();
await expect(page.getByTestId("disclosure-prompts")).toBeVisible();
await expect(page.getByTestId("disclosure-input / output")).toBeVisible();
await expect(page.getByTestId("disclosure-models")).toBeVisible();
await expect(page.getByTestId("disclosure-helpers")).toBeVisible();
await expect(page.getByTestId("disclosure-agents")).toBeVisible();
@ -73,7 +72,7 @@ test(
await expect(page.getByTestId("input_outputChat Input")).toBeVisible();
await expect(page.getByTestId("input_outputChat Output")).toBeVisible();
await expect(page.getByTestId("promptsPrompt")).toBeVisible();
await expect(page.getByTestId("processingPrompt Template")).toBeVisible();
await expect(page.getByTestId("langchain_utilitiesCSVAgent")).toBeVisible();
await expect(
page.getByTestId("langchain_utilitiesConversationChain"),
@ -97,7 +96,9 @@ test(
await expect(page.getByTestId("input_outputChat Input")).not.toBeVisible();
await expect(page.getByTestId("input_outputChat Output")).not.toBeVisible();
await expect(page.getByTestId("promptsPrompt")).not.toBeVisible();
await expect(
page.getByTestId("processingPrompt Template"),
).not.toBeVisible();
await expect(
page.getByTestId("agentsTool Calling Agent"),
).not.toBeVisible();

View file

@ -16,12 +16,12 @@ test(
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("openai");
await page.waitForSelector('[data-testid="languagemodelsOpenAI"]', {
await page.waitForSelector('[data-testid="openaiOpenAI"]', {
timeout: 1000,
});
await page
.getByTestId("languagemodelsOpenAI")
.getByTestId("openaiOpenAI")
.hover()
.then(async () => {
await page.getByTestId("add-component-button-openai").last().click();

View file

@ -58,7 +58,7 @@ test(
await page.keyboard.type("prompt");
// Verify disclosures open with new search
await expect(page.getByTestId("promptsPrompt")).toBeVisible();
await expect(page.getByTestId("processingPrompt Template")).toBeVisible();
await page.keyboard.press("Tab");
await page.keyboard.press("Tab");

View file

@ -41,10 +41,7 @@ withEventDeliveryModes(
await expect(stopButton).toBeHidden({ timeout: 120000 });
}
const output = await page
.getByTestId("div-chat-message")
.last()
.innerText();
const output = await page.getByTestId("div-chat-message").innerText();
expect(output).toContain("Charmander");
expect(output.length).toBeGreaterThan(100);
},

View file

@ -152,11 +152,11 @@ test(
//---------------------------------- PROMPT
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("prompt");
await page.waitForSelector('[data-testid="promptsPrompt"]', {
await page.waitForSelector('[data-testid="processingPrompt Template"]', {
timeout: 2000,
});
await page
.getByTestId("promptsPrompt")
.getByTestId("processingPrompt Template")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 350, y: 300 },
});
@ -164,14 +164,11 @@ test(
//---------------------------------- OPENAI
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("openai");
await page.waitForSelector(
'[data-testid="languagemodels_openai_draggable"]',
{
timeout: 2000,
},
);
await page.waitForSelector('[data-testid="openai_openai_draggable"]', {
timeout: 2000,
});
await page
.getByTestId("languagemodelsOpenAI")
.getByTestId("openaiOpenAI")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 500, y: 300 },
});
@ -261,7 +258,7 @@ test(
.click();
//quebrando aqui
await page
.getByTestId("handle-prompt-shownode-true_examples-left")
.getByTestId("handle-prompt template-shownode-true_examples-left")
.nth(0)
.click();
await page
@ -269,7 +266,7 @@ test(
.nth(1)
.click();
await page
.getByTestId("handle-prompt-shownode-false_examples-left")
.getByTestId("handle-prompt template-shownode-false_examples-left")
.nth(0)
.click();
await page
@ -277,11 +274,11 @@ test(
.nth(2)
.click();
await page
.getByTestId("handle-prompt-shownode-user_message-left")
.getByTestId("handle-prompt template-shownode-user_message-left")
.nth(0)
.click();
await page
.getByTestId("handle-prompt-shownode-prompt-right")
.getByTestId("handle-prompt template-shownode-prompt-right")
.first()
.click();
await page

View file

@ -34,7 +34,7 @@ test.skip(
await page.getByTestId("sidebar-search-input").fill("openai");
await page.waitForTimeout(1000);
await page
.getByTestId("languagemodelsOpenAI")
.getByTestId("openaiOpenAI")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();

View file

@ -14,12 +14,12 @@ test(
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("nvidia");
await page.waitForSelector('[data-testid="languagemodelsNVIDIA"]', {
await page.waitForSelector('[data-testid="nvidiaNVIDIA"]', {
timeout: 30000,
});
await page
.getByTestId("languagemodelsNVIDIA")
.getByTestId("nvidiaNVIDIA")
.hover()
.then(async () => {
// Wait for the API request to complete after clicking the add button

View file

@ -12,12 +12,12 @@ test("IntComponent", { tag: ["@release", "@workspace"] }, async ({ page }) => {
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("openai");
await page.waitForSelector('[data-testid="languagemodelsOpenAI"]', {
await page.waitForSelector('[data-testid="openaiOpenAI"]', {
timeout: 3000,
});
await page
.getByTestId("languagemodelsOpenAI")
.getByTestId("openaiOpenAI")
.first()
.dragTo(page.locator('//*[@id="react-flow-id"]'));

View file

@ -60,12 +60,12 @@ test(
await page.getByTestId("blank-flow").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("prompt");
await page.waitForSelector('[data-testid="promptsPrompt"]', {
await page.waitForSelector('[data-testid="processingPrompt Template"]', {
timeout: 3000,
});
await page
.locator('//*[@id="promptsPrompt"]')
.locator('//*[@id="processingPrompt Template"]')
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
@ -145,12 +145,12 @@ test(
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("prompt");
await page.waitForSelector('[data-testid="promptsPrompt"]', {
await page.waitForSelector('[data-testid="processingPrompt Template"]', {
timeout: 3000,
});
await page
.locator('//*[@id="promptsPrompt"]')
.locator('//*[@id="processingPrompt Template"]')
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();

View file

@ -17,12 +17,12 @@ test(
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("openai");
await page.waitForSelector('[data-testid="languagemodelsOpenAI"]', {
await page.waitForSelector('[data-testid="openaiOpenAI"]', {
timeout: 3000,
});
await page
.getByTestId("languagemodelsOpenAI")
.getByTestId("openaiOpenAI")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();

View file

@ -17,12 +17,12 @@ test(
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("ollama");
await page.waitForSelector('[data-testid="languagemodelsOllama"]', {
await page.waitForSelector('[data-testid="ollamaOllama"]', {
timeout: 3000,
});
await page
.getByTestId("languagemodelsOllama")
.getByTestId("ollamaOllama")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();

View file

@ -16,12 +16,12 @@ test(
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("prompt");
await page.waitForSelector('[data-testid="promptsPrompt"]', {
await page.waitForSelector('[data-testid="processingPrompt Template"]', {
timeout: 30000,
});
await page
.locator('//*[@id="promptsPrompt"]')
.locator('//*[@id="processingPrompt Template"]')
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();

View file

@ -31,12 +31,12 @@ test(
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("NVIDIA");
await page.waitForSelector('[data-testid="languagemodelsNVIDIA"]', {
await page.waitForSelector('[data-testid="nvidiaNVIDIA"]', {
timeout: 3000,
});
await page
.getByTestId("languagemodelsNVIDIA")
.getByTestId("nvidiaNVIDIA")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
@ -85,7 +85,7 @@ test(
await page.keyboard.press("Escape");
await page.locator('//*[@id="react-flow-id"]').click();
const lastNvidiaModel = page.getByTestId("languagemodelsNVIDIA").last();
const lastNvidiaModel = page.getByTestId("nvidiaNVIDIA").last();
await lastNvidiaModel.scrollIntoViewIfNeeded();
try {
@ -128,12 +128,12 @@ test(
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("NVIDIA");
await page.waitForSelector('[data-testid="languagemodelsNVIDIA"]', {
await page.waitForSelector('[data-testid="nvidiaNVIDIA"]', {
timeout: 3000,
});
await page
.getByTestId("languagemodelsNVIDIA")
.getByTestId("nvidiaNVIDIA")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();

View file

@ -56,7 +56,7 @@ test(
});
const disclosureTestIds = [
"disclosure-i/o",
"disclosure-input / output",
"disclosure-data",
"disclosure-models",
"disclosure-helpers",
@ -101,23 +101,15 @@ test(
await page.getByTestId("sidebar-search-input").click();
const visibleModelSpecsTestIds = [
"languagemodelsAIML",
"languagemodelsAnthropic",
"languagemodelsAzure OpenAI",
"languagemodelsCohere",
"languagemodelsGoogle Generative AI",
"languagemodelsGroq",
"languagemodelsHuggingFace",
"languagemodelsLM Studio",
"languagemodelsMaritalk",
"languagemodelsMistralAI",
"languagemodelsNVIDIA",
"languagemodelsOllama",
"languagemodelsOpenAI",
"languagemodelsPerplexity",
"languagemodelsQianfan",
"languagemodelsSambaNova",
"languagemodelsVertex AI",
"languagemodelsxAI",
];
await Promise.all(

View file

@ -16,12 +16,12 @@ test(
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("ollama");
await page.waitForSelector('[data-testid="languagemodelsOllama"]', {
await page.waitForSelector('[data-testid="ollamaOllama"]', {
timeout: 3000,
});
await page
.getByTestId("languagemodelsOllama")
.getByTestId("ollamaOllama")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();

View file

@ -200,14 +200,14 @@ test(
// Create a new flow with MCP component
await page.getByTestId("blank-flow").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("mcp connection");
await page.getByTestId("sidebar-search-input").fill("mcp");
await page.waitForSelector('[data-testid="dataMCP Connection"]', {
await page.waitForSelector('[data-testid="agentsMCP Tools"]', {
timeout: 30000,
});
await page
.getByTestId("dataMCP Connection")
.getByTestId("agentsMCP Tools")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 0, y: 0 },
});

View file

@ -3,7 +3,7 @@ import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
import { zoomOut } from "../../utils/zoom-out";
test(
"user must be able to change mode of MCP connection without any issues",
"user must be able to change mode of MCP tools without any issues",
{ tag: ["@release", "@workspace", "@components"] },
async ({ page }) => {
await awaitBootstrapTest(page);
@ -13,14 +13,14 @@ test(
});
await page.getByTestId("blank-flow").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("mcp connection");
await page.getByTestId("sidebar-search-input").fill("mcp tools");
await page.waitForSelector('[data-testid="dataMCP Connection"]', {
await page.waitForSelector('[data-testid="agentsMCP Tools"]', {
timeout: 30000,
});
await page
.getByTestId("dataMCP Connection")
.getByTestId("agentsMCP Tools")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 0, y: 0 },
});

View file

@ -17,19 +17,19 @@ test(
await page.getByTestId("sidebar-search-input").fill("prompt");
await page
.getByTestId("promptsPrompt")
.getByTestId("processingPrompt Template")
.hover()
.then(async () => {
await page.getByTestId("add-component-button-prompt").click();
await page.getByTestId("add-component-button-prompt-template").click();
});
await page.waitForSelector('[data-testid="title-Prompt"]', {
await page.waitForSelector('[data-testid="title-Prompt Template"]', {
timeout: 3000,
});
expect(await page.getByText("Toolset", { exact: true }).count()).toBe(0);
await page.getByTestId("title-Prompt").click();
await page.getByTestId("title-Prompt Template").click();
await page.keyboard.press("ControlOrMeta+Shift+m");
await page.waitForSelector('text="Toolset"', {
@ -39,7 +39,7 @@ test(
await page.getByText("Toolset", { exact: true }).count(),
).toBeGreaterThan(0);
await page.getByTestId("title-Prompt").click();
await page.getByTestId("title-Prompt Template").click();
await page.waitForSelector('[data-testid="code-button-modal"]', {
timeout: 3000,
@ -61,11 +61,11 @@ test(
// check if the response is 200
expect(customComponentResponse?.status()).toBe(200);
await page.waitForSelector('[data-testid="title-Prompt"]', {
await page.waitForSelector('[data-testid="title-Prompt Template"]', {
timeout: 3000,
});
await page.getByTestId("title-Prompt").click();
await page.getByTestId("title-Prompt Template").click();
await page.keyboard.press("ControlOrMeta+Shift+m");
expect(await page.getByText("Toolset", { exact: true }).count()).toBe(0);

View file

@ -14,12 +14,12 @@ test(
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("openai");
await page.waitForSelector('[data-testid="languagemodelsOpenAI"]', {
await page.waitForSelector('[data-testid="openaiOpenAI"]', {
timeout: 1000,
});
await page
.getByTestId("languagemodelsOpenAI")
.getByTestId("openaiOpenAI")
.hover()
.then(async () => {
await page.getByTestId("add-component-button-openai").last().click();

View file

@ -1,7 +1,6 @@
import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
import { adjustScreenView } from "../../utils/adjust-screen-view";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
import { initialGPTsetup } from "../../utils/initialGPTsetup";
@ -55,7 +54,7 @@ test(
await page.getByTestId("sidebar-search-input").fill("openai");
await page
.getByTestId("languagemodelsOpenAI")
.getByTestId("openaiOpenAI")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 100, y: 200 },
});

View file

@ -26,12 +26,12 @@ test(
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("ollama");
await page.waitForSelector('[data-testid="embeddingsOllama Embeddings"]', {
await page.waitForSelector('[data-testid="ollamaOllama Embeddings"]', {
timeout: 3000,
});
await page
.getByTestId("embeddingsOllama Embeddings")
.getByTestId("ollamaOllama Embeddings")
.hover()
.then(async () => {
await page