更新格式

This commit is contained in:
yuruo 2025-03-14 20:01:37 +08:00
parent d7c8639479
commit 9996b996c2
2 changed files with 2 additions and 6 deletions

View File

@ -19,7 +19,7 @@ class VerificationAgent(BaseAgent):
})
response = run(
messages,
user_prompt=prompt.format(screen_info=str(parsed_screen_result['parsed_content_list'], action_list=str(Action))),
user_prompt=prompt.format(screen_info=str(parsed_screen_result['parsed_content_list']), action_list=str(Action)),
response_format=VerificationResponse
)
return json.loads(response)

View File

@ -145,8 +145,7 @@ class ComputerTool(BaseAnthropicTool):
pyautogui.hotkey('ctrl', 'v')
# Copy old data back to clipboard
pyperclip.copy(clipboard_data)
screenshot_base64 = (await self.screenshot()).base64_image
return ToolResult(output=text, base64_image=screenshot_base64)
return ToolResult(output=text)
if action in (
"left_click",
"right_click",
@ -196,9 +195,6 @@ class ComputerTool(BaseAnthropicTool):
raise ToolError(f"Invalid action: {action}")
async def screenshot(self):
if not hasattr(self, 'target_dimension'):
screenshot = self.padding_image(screenshot)
self.target_dimension = MAX_SCALING_TARGETS["WXGA"]
width, height = self.target_dimension["width"], self.target_dimension["height"]
screenshot, path = get_screenshot(resize=True, target_width=width, target_height=height)
time.sleep(0.7) # avoid async error as actions take time to complete