Skip to content

Commit 84a7512

Browse files
committed
Improved rendering, fixed screenshots
1 parent e793c81 commit 84a7512

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

interpreter_1/interpreter.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ async def async_respond(self):
262262
elif isinstance(chunk, BetaRawContentBlockDeltaEvent):
263263
if chunk.delta.type == "text_delta":
264264
md.feed(chunk.delta.text)
265-
yield {"type": "chunk", "chunk": chunk.delta.text}
266265
await asyncio.sleep(0)
267266
if current_block and current_block.type == "text":
268267
current_block.text += chunk.delta.text
@@ -291,7 +290,6 @@ async def async_respond(self):
291290
delattr(current_block, "partial_json")
292291
else:
293292
md.feed("\n")
294-
yield {"type": "chunk", "chunk": "\n"}
295293
await asyncio.sleep(0)
296294

297295
for attr in [
@@ -305,6 +303,8 @@ async def async_respond(self):
305303
response_content.append(current_block)
306304
current_block = None
307305

306+
edit.close()
307+
308308
response = BetaMessage(
309309
id=str(uuid.uuid4()),
310310
content=response_content,
@@ -406,8 +406,6 @@ async def async_respond(self):
406406
tool_result_content: list[BetaToolResultBlockParam] = []
407407
for content_block in cast(list[BetaContentBlock], response.content):
408408
if content_block.type == "tool_use":
409-
edit.close()
410-
411409
if user_approval in ["y", "a"]:
412410
result = await tool_collection.run(
413411
name=content_block.name,

interpreter_1/ui/tool.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,9 @@ def flush(self):
313313
pass # No need to flush since we render when we get a complete command
314314

315315
def close(self):
316-
if self.json_obj and self.json_obj.get("action") == "screenshot":
317-
SchemaRenderer.print_separator("┴", newline=True)
316+
if self.json_obj and self.json_obj.get("name") == "computer":
317+
if set(self.json_obj.keys()) == {"name", "action"}:
318+
SchemaRenderer.print_separator("┴", newline=True)
318319

319320

320321
class InsertRenderer(ContentRenderer):

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ readme = "README.md"
1313
[tool.poetry.dependencies]
1414

1515
# Required dependencies
16-
python = ">=3.8,<4"
16+
python = ">=3.9,<4"
1717
litellm = "^1.52.3"
1818
anthropic = "^0.39.0"
1919
pygments = "^2.18.0"
@@ -23,6 +23,7 @@ prompt-toolkit = "^3.0.48"
2323
pyte = "^0.8.2"
2424
screeninfo = "^0.8.1"
2525
readchar = "^4.2.1"
26+
pillow = "^11.0.0"
2627

2728
[build-system]
2829
requires = ["poetry-core>=1.0.0"]

0 commit comments

Comments
 (0)