Skip to content

Commit c26bc92

Browse files
committed
put base64 in the currect position for sb_vision
1 parent decd25a commit c26bc92

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

app/agent/sandbox_agent.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from app.prompt.manus import NEXT_STEP_PROMPT, SYSTEM_PROMPT
1212
from app.tool import Terminate, ToolCollection
1313
from app.tool.ask_human import AskHuman
14-
from app.tool.browser_use_tool import BrowserUseTool
1514
from app.tool.mcp import MCPClients, MCPClientTool
1615
from app.tool.sandbox.sb_browser_tool import SandboxBrowserTool
1716
from app.tool.sandbox.sb_files_tool import SandboxFilesTool
@@ -205,7 +204,7 @@ async def think(self) -> bool:
205204
original_prompt = self.next_step_prompt
206205
recent_messages = self.memory.messages[-3:] if self.memory.messages else []
207206
browser_in_use = any(
208-
tc.function.name == BrowserUseTool().name
207+
tc.function.name == SandboxBrowserTool().name
209208
for msg in recent_messages
210209
if msg.tool_calls
211210
for tc in msg.tool_calls

app/daytona/sandbox.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import time
2+
13
from daytona import (
24
CreateSandboxFromImageParams,
35
Daytona,
@@ -90,6 +92,7 @@ def start_supervisord_session(sandbox: Sandbox):
9092
var_async=True,
9193
),
9294
)
95+
time.sleep(25) # Wait a bit to ensure supervisord starts properly
9396
logger.info(f"Supervisord started in session {session_id}")
9497
except Exception as e:
9598
logger.error(f"Error starting supervisord session: {str(e)}")

app/tool/sandbox/sb_browser_tool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ async def _execute_browser_action(
229229
f"Screenshot validation failed: {validation_message}"
230230
)
231231
result["image_validation_error"] = validation_message
232-
del result["screenshot_base64"]
232+
del result["screenshot_base64"]
233233

234234
# added_message = await self.thread_manager.add_message(
235235
# thread_id=self.thread_id,

app/tool/sandbox/sb_vision_tool.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,9 @@ async def execute(
170170
)
171171
self.vision_message = message
172172
# return self.success_response(f"成功加载并压缩图片 '{cleaned_path}' (由 {file_info.size / 1024:.1f}KB 压缩到 {len(compressed_bytes) / 1024:.1f}KB)。")
173-
return self.success_response(
174-
f"成功加载并压缩图片 '{cleaned_path}',压缩后的内容为:{base64_image}"
173+
return ToolResult(
174+
output=f"成功加载并压缩图片 '{cleaned_path}'",
175+
base64_image=base64_image,
175176
)
176177
except Exception as e:
177178
return self.fail_response(f"see_image 执行异常: {str(e)}")

0 commit comments

Comments
 (0)