update browser sandbox tool message

This commit is contained in:
white-rm
2025-07-16 00:24:56 +08:00
parent e4c4d4a00f
commit c016d5627c
3 changed files with 20 additions and 23 deletions
-2
View File
@@ -7,7 +7,6 @@ from pydantic import Field
# from app.agentpress.thread_manager import ThreadManager
from app.tool.base import BaseTool, ToolResult
from daytona import Sandbox
from app.daytona.sandbox import get_or_start_sandbox
from app.utils.logger import logger
from app.utils.files_utils import clean_path
@@ -16,7 +15,6 @@ class ThreadMessage:
"""
Represents a message to be added to a thread.
"""
thread_id: str
type: str
content: Dict[str, Any]
is_llm_message: bool = False
-1
View File
@@ -224,7 +224,6 @@ class SandboxBrowserTool(SandboxToolsBase):
# is_llm_message=False
# )
message = ThreadMessage(
thread_id=self.thread_id,
type="browser_state",
content=result,
is_llm_message=False
+20 -20
View File
@@ -6,26 +6,26 @@ from daytona import DaytonaConfig, Daytona
import json
async def main():
# 创建沙箱和工具
# sandbox = create_sandbox(password="123456")
config = DaytonaConfig(
api_key="dtn_bedf8ed9953f0b5c410c042090e1002a56ba8129b573c92f5607aef04b08c82a",
api_url="https://app.daytona.io/api",
target="us"
)
daytona = Daytona(config)
sandbox = daytona.find_one("201415a9-28ad-4b6d-8756-13b1e34a70c3")
if sandbox.state == "archived" or sandbox.state == "stopped":
logger.info(f"Sandbox is in {sandbox.state} state. Starting...")
try:
daytona.start(sandbox)
start_supervisord_session(sandbox)
# Wait a moment for the sandbox to initialize
# sleep(5)
# Refresh sandbox state after starting
# sandbox = daytona.get(sandbox.id)
except Exception as e:
logger.error(f"Error starting sandbox: {e}")
raise e
sandbox = create_sandbox(password="123456")
# config = DaytonaConfig(
# api_key="dtn_bedf8ed9953f0b5c410c042090e1002a56ba8129b573c92f5607aef04b08c82a",
# api_url="https://app.daytona.io/api",
# target="us"
# )
# daytona = Daytona(config)
# sandbox = daytona.find_one("201415a9-28ad-4b6d-8756-13b1e34a70c3")
# if sandbox.state == "archived" or sandbox.state == "stopped":
# logger.info(f"Sandbox is in {sandbox.state} state. Starting...")
# try:
# daytona.start(sandbox)
# start_supervisord_session(sandbox)
# # Wait a moment for the sandbox to initialize
# # sleep(5)
# # Refresh sandbox state after starting
# # sandbox = daytona.get(sandbox.id)
# except Exception as e:
# logger.error(f"Error starting sandbox: {e}")
# raise e
# sandbox.start()
vnc_link = sandbox.get_preview_link(6080)