From 4455260290a3a521aee7c3cd46f7ddde9c03a3e1 Mon Sep 17 00:00:00 2001 From: Frank Xu Date: Fri, 7 Jun 2024 12:03:32 -0400 Subject: [PATCH] [bugfix] browse actions shouldn't change url and screenshot, only observations (#2311) * browse related actions shouldn't change url and screenshot, only the observations should * fix linting * fix integrat * update integration test --------- Co-authored-by: Xingyao Wang --- frontend/src/services/actions.ts | 9 ++------- .../CodeActAgent/test_browse_internet/prompt_003.log | 5 ++--- .../CodeActAgent/test_browse_internet/prompt_004.log | 5 ++--- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/frontend/src/services/actions.ts b/frontend/src/services/actions.ts index a67e34605e..724ede66e0 100644 --- a/frontend/src/services/actions.ts +++ b/frontend/src/services/actions.ts @@ -1,4 +1,3 @@ -import { setScreenshotSrc, setUrl } from "#/state/browserSlice"; import { addAssistantMessage, addUserMessage } from "#/state/chatSlice"; import { setCode, setActiveFilepath } from "#/state/codeSlice"; import { appendInput } from "#/state/commandSlice"; @@ -13,18 +12,14 @@ import { getRootTask } from "./taskService"; const messageActions = { [ActionType.BROWSE]: (message: ActionMessage) => { - const { url, screenshotSrc } = message.args; - store.dispatch(setUrl(url)); - store.dispatch(setScreenshotSrc(screenshotSrc)); store.dispatch(addAssistantMessage(message.message)); }, [ActionType.BROWSE_INTERACTIVE]: (message: ActionMessage) => { if (message.args.thought) { store.dispatch(addAssistantMessage(message.args.thought)); + } else { + store.dispatch(addAssistantMessage(message.message)); } - const { url, screenshotSrc } = message.args; - store.dispatch(setUrl(url)); - store.dispatch(setScreenshotSrc(screenshotSrc)); }, [ActionType.WRITE]: (message: ActionMessage) => { const { path, content } = message.args; diff --git a/tests/integration/mock/CodeActAgent/test_browse_internet/prompt_003.log b/tests/integration/mock/CodeActAgent/test_browse_internet/prompt_003.log index fe9643cdfe..8125347cbd 100644 --- a/tests/integration/mock/CodeActAgent/test_browse_internet/prompt_003.log +++ b/tests/integration/mock/CodeActAgent/test_browse_internet/prompt_003.log @@ -118,11 +118,10 @@ RootWebArea 'The Ultimate Answer', focused [8] heading 'The Ultimate Answer' [9] paragraph '' StaticText 'Click the button to reveal the answer to life, the universe, and everything.' - [10] button 'Click me' + [10] button 'Click me', clickable # Previous Actions -goto('http://localhost:8000') - +noop() Here is an example with chain of thought of a valid action when clicking on a button: " diff --git a/tests/integration/mock/CodeActAgent/test_browse_internet/prompt_004.log b/tests/integration/mock/CodeActAgent/test_browse_internet/prompt_004.log index d0c78c5c7a..7e60311651 100644 --- a/tests/integration/mock/CodeActAgent/test_browse_internet/prompt_004.log +++ b/tests/integration/mock/CodeActAgent/test_browse_internet/prompt_004.log @@ -118,14 +118,13 @@ RootWebArea 'The Ultimate Answer', focused [8] heading 'The Ultimate Answer' [9] paragraph '' StaticText 'Click the button to reveal the answer to life, the universe, and everything.' - [10] button 'Click me', focused + [10] button 'Click me', clickable, focused StaticText 'The answer is OpenDevin is all you need!' # Previous Actions -goto('http://localhost:8000') +noop() click("10") - Here is an example with chain of thought of a valid action when clicking on a button: " In order to accomplish my goal I need to click on the button with bid 12