orgo 0.0.14__tar.gz → 0.0.15__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {orgo-0.0.14 → orgo-0.0.15}/PKG-INFO +1 -1
- {orgo-0.0.14 → orgo-0.0.15}/pyproject.toml +1 -1
- {orgo-0.0.14 → orgo-0.0.15}/src/orgo/computer.py +25 -4
- {orgo-0.0.14 → orgo-0.0.15}/src/orgo.egg-info/PKG-INFO +1 -1
- {orgo-0.0.14 → orgo-0.0.15}/README.md +0 -0
- {orgo-0.0.14 → orgo-0.0.15}/setup.cfg +0 -0
- {orgo-0.0.14 → orgo-0.0.15}/src/orgo/__init__.py +0 -0
- {orgo-0.0.14 → orgo-0.0.15}/src/orgo/api/__init__.py +0 -0
- {orgo-0.0.14 → orgo-0.0.15}/src/orgo/api/client.py +0 -0
- {orgo-0.0.14 → orgo-0.0.15}/src/orgo/project.py +0 -0
- {orgo-0.0.14 → orgo-0.0.15}/src/orgo/prompt.py +0 -0
- {orgo-0.0.14 → orgo-0.0.15}/src/orgo/utils/__init__.py +0 -0
- {orgo-0.0.14 → orgo-0.0.15}/src/orgo/utils/auth.py +0 -0
- {orgo-0.0.14 → orgo-0.0.15}/src/orgo.egg-info/SOURCES.txt +0 -0
- {orgo-0.0.14 → orgo-0.0.15}/src/orgo.egg-info/dependency_links.txt +0 -0
- {orgo-0.0.14 → orgo-0.0.15}/src/orgo.egg-info/requires.txt +0 -0
- {orgo-0.0.14 → orgo-0.0.15}/src/orgo.egg-info/top_level.txt +0 -0
|
@@ -4,8 +4,9 @@ import os
|
|
|
4
4
|
import io
|
|
5
5
|
import base64
|
|
6
6
|
import logging
|
|
7
|
-
from typing import Dict, List, Any, Optional, Callable
|
|
7
|
+
from typing import Dict, List, Any, Optional, Callable
|
|
8
8
|
from PIL import Image
|
|
9
|
+
import requests
|
|
9
10
|
from requests.exceptions import RequestException
|
|
10
11
|
|
|
11
12
|
from .api.client import ApiClient
|
|
@@ -97,13 +98,33 @@ class Computer:
|
|
|
97
98
|
def screenshot(self) -> Image.Image:
|
|
98
99
|
"""Capture screenshot and return as PIL Image"""
|
|
99
100
|
response = self.api.get_screenshot(self.project_id)
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
image_data = response.get("image", "")
|
|
102
|
+
|
|
103
|
+
# Check if it's a URL (new format) or base64 (legacy format)
|
|
104
|
+
if image_data.startswith(('http://', 'https://')):
|
|
105
|
+
# Download image from URL
|
|
106
|
+
img_response = requests.get(image_data)
|
|
107
|
+
img_response.raise_for_status()
|
|
108
|
+
return Image.open(io.BytesIO(img_response.content))
|
|
109
|
+
else:
|
|
110
|
+
# Legacy base64 format
|
|
111
|
+
img_data = base64.b64decode(image_data)
|
|
112
|
+
return Image.open(io.BytesIO(img_data))
|
|
102
113
|
|
|
103
114
|
def screenshot_base64(self) -> str:
|
|
104
115
|
"""Capture screenshot and return as base64 string"""
|
|
105
116
|
response = self.api.get_screenshot(self.project_id)
|
|
106
|
-
|
|
117
|
+
image_data = response.get("image", "")
|
|
118
|
+
|
|
119
|
+
# Check if it's a URL (new format) or base64 (legacy format)
|
|
120
|
+
if image_data.startswith(('http://', 'https://')):
|
|
121
|
+
# Download image from URL and convert to base64
|
|
122
|
+
img_response = requests.get(image_data)
|
|
123
|
+
img_response.raise_for_status()
|
|
124
|
+
return base64.b64encode(img_response.content).decode('utf-8')
|
|
125
|
+
else:
|
|
126
|
+
# Already base64
|
|
127
|
+
return image_data
|
|
107
128
|
|
|
108
129
|
# Execution methods
|
|
109
130
|
def bash(self, command: str) -> str:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|