update terminate prompt

This commit is contained in:
xiangjinyu 2025-03-12 19:21:13 +08:00
parent 548c402316
commit 5bba31db3e
2 changed files with 4 additions and 6 deletions

View File

@ -4,7 +4,7 @@ from typing import Optional
from browser_use import Browser as BrowserUseBrowser from browser_use import Browser as BrowserUseBrowser
from browser_use import BrowserConfig from browser_use import BrowserConfig
from browser_use.browser.context import BrowserContext, BrowserContextConfig from browser_use.browser.context import BrowserContext
from browser_use.dom.service import DomService from browser_use.dom.service import DomService
from pydantic import Field, field_validator from pydantic import Field, field_validator
from pydantic_core.core_schema import ValidationInfo from pydantic_core.core_schema import ValidationInfo
@ -110,10 +110,7 @@ class BrowserUseTool(BaseTool):
) )
self.browser = BrowserUseBrowser(browser_config) self.browser = BrowserUseBrowser(browser_config)
if self.context is None: if self.context is None:
context_config = BrowserContextConfig( self.context = await self.browser.new_context()
browser_window_size={"width": 400, "height": 800}
)
self.context = await self.browser.new_context(context_config)
self.dom_service = DomService(await self.context.get_current_page()) self.dom_service = DomService(await self.context.get_current_page())
return self.context return self.context

View File

@ -1,7 +1,8 @@
from app.tool.base import BaseTool from app.tool.base import BaseTool
_TERMINATE_DESCRIPTION = """Terminate the interaction when the request is met OR if the assistant cannot proceed further with the task.""" _TERMINATE_DESCRIPTION = """Terminate the interaction when the request is met OR if the assistant cannot proceed further with the task.
When you have finished all the tasks, call this tool to end the work."""
class Terminate(BaseTool): class Terminate(BaseTool):