mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
* Replace OpenDevin with OpenHands * Update CONTRIBUTING.md * Update README.md * Update README.md * update poetry lock; move opendevin folder to openhands * fix env var * revert image references in docs * revert permissions * revert permissions --------- Co-authored-by: Xingyao Wang <xingyao6@illinois.edu>
48 lines
1.2 KiB
Python
48 lines
1.2 KiB
Python
from dataclasses import dataclass
|
|
from typing import ClassVar
|
|
|
|
from openhands.core.schema import ActionType
|
|
|
|
from .action import Action, ActionSecurityRisk
|
|
|
|
|
|
@dataclass
|
|
class BrowseURLAction(Action):
|
|
url: str
|
|
thought: str = ''
|
|
action: str = ActionType.BROWSE
|
|
runnable: ClassVar[bool] = True
|
|
security_risk: ActionSecurityRisk | None = None
|
|
|
|
@property
|
|
def message(self) -> str:
|
|
return f'Browsing URL: {self.url}'
|
|
|
|
def __str__(self) -> str:
|
|
ret = '**BrowseURLAction**\n'
|
|
if self.thought:
|
|
ret += f'THOUGHT: {self.thought}\n'
|
|
ret += f'URL: {self.url}'
|
|
return ret
|
|
|
|
|
|
@dataclass
|
|
class BrowseInteractiveAction(Action):
|
|
browser_actions: str
|
|
thought: str = ''
|
|
browsergym_send_msg_to_user: str = ''
|
|
action: str = ActionType.BROWSE_INTERACTIVE
|
|
runnable: ClassVar[bool] = True
|
|
security_risk: ActionSecurityRisk | None = None
|
|
|
|
@property
|
|
def message(self) -> str:
|
|
return f'Executing browser actions: {self.browser_actions}'
|
|
|
|
def __str__(self) -> str:
|
|
ret = '**BrowseInteractiveAction**\n'
|
|
if self.thought:
|
|
ret += f'THOUGHT: {self.thought}\n'
|
|
ret += f'BROWSER_ACTIONS: {self.browser_actions}'
|
|
return ret
|