fix: Update templates and include global variables (#3755)

* update templates

* update to include global variables

* Refactor code to include global variables

* update PythonREPLTool.py

* [autofix.ci] apply automated fixes

* update pythonREPL and example

* Refactor code to handle decoding chat messages and handle decoding errors

* ✨ (Simple Agent.spec.ts): Add test case to fill textarea with specific text for testing purposes
📝 (Simple Agent.spec.ts): Update test case descriptions for better clarity and accuracy
✅ (Simple Agent.spec.ts): Update test assertions to match the expected behavior of the test case

* [autofix.ci] apply automated fixes

* 🐛 (Dynamic Agent.spec.ts): fix environment variable name from BRAVE_SEARCH_API_KEY to SEARCH_API_KEY for consistency and clarity
💡 (Dynamic Agent.spec.ts): add additional test cases to improve test coverage and ensure specific text is not present in the chat output

* 🔧 (.github/workflows/typescript_test.yml): update environment variable name from BRAVE_SEARCH_API_KEY to SEARCH_API_KEY for consistency
🐛 (Travel Planning Agent.spec.ts): fix test to skip if SEARCH_API_KEY is not available in the environment variables

* ✅ (Simple Agent.spec.ts): update expected count of python words to 3 for accurate test validation

* updating search tools

* [autofix.ci] apply automated fixes

* change examples

* update travel planning to include global variable

* Refactor search API component to include result limiting

* 📝 (Travel Planning Agent.spec.ts): remove unnecessary empty line to improve code readability and consistency

* test: adjusts asserts to make the test pass successfully

---------

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: italojohnny <italojohnnydosanjos@gmail.com>
This commit is contained in:
anovazzi1 2024-09-11 11:47:42 -03:00 • committed by GitHub
commit 810cf72487
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 953 additions and 823 deletions

View file

@ -65,6 +65,12 @@ test("Simple Agent", async ({ page }) => {
await page.waitForTimeout(1000);
await page
.getByTestId("textarea_str_input_value")
.fill(
"Use the Python REPL tool to create a python function that calculates 4 + 4 and stores it in a variable.",
);
await page.getByTestId("button_run_chat output").click();
await page.waitForSelector("text=built successfully", { timeout: 30000 });
@ -75,7 +81,7 @@ test("Simple Agent", async ({ page }) => {
await page.getByText("Playground", { exact: true }).click();
await page.waitForSelector(
"text=write short python scsript to say hello world",
"text=Use the Python REPL tool to create a python function that calculates 4 + 4 and stores it in a variable.",
{
timeout: 30000,
},
@ -83,19 +89,41 @@ test("Simple Agent", async ({ page }) => {
await page.waitForTimeout(1000);
expect(await page.getByText("User")).toBeVisible();
expect(page.getByText("User")).toBeVisible();
expect(await page.locator(".language-python")).toBeVisible();
expect(page.locator(".language-python")).toBeVisible();
let pythonWords = await page.getByText("Hello, World!").count();
let pythonWords = await page.getByText("4 + 4").count();
expect(pythonWords).toBe(2);
expect(pythonWords).toBe(3);
await page
.getByPlaceholder("Send a message...")
.fill("write short python scsript to say hello world");
await page.getByTestId("icon-LucideSend").last().click();
await page.waitForSelector(
"text=write short python scsript to say hello world",
{
timeout: 30000,
},
);
await page.waitForSelector('[data-testid="icon-Copy"]', {
timeout: 100000,
});
await page.waitForTimeout(1000);
await page.getByTestId("icon-Copy").last().click();
await page.waitForTimeout(500);
await page.getByPlaceholder("Send a message...").click();
await page.waitForTimeout(500);
await page.keyboard.press("Control+V");
await page.waitForTimeout(500);