Skip to content

Commit 5578961

Browse files
authored
Merge branch 'OpenInterpreter:main' into main
2 parents 4d852df + 38a95aa commit 5578961

File tree

2 files changed

+34
-4
lines changed

2 files changed

+34
-4
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<img src="https://img.shields.io/static/v1?label=license&message=AGPL&color=white&style=flat" alt="License"/>
1010
<br>
1111
<br>
12-
<strong>Let language models run code.</strong><br>
12+
<strong>Today we launched a new computer (the 01) with Open Interpreter at the center. <a href="https://github.com/OpenInterpreter/01">Star the repo →</a></strong><br>
1313
<br><a href="https://openinterpreter.com">Get early access to the desktop app</a>‎ ‎ |‎ ‎ <a href="https://docs.openinterpreter.com/">Documentation</a><br>
1414
</p>
1515

@@ -18,9 +18,9 @@
1818
![poster](https://github.com/KillianLucas/open-interpreter/assets/63927363/08f0d493-956b-4d49-982e-67d4b20c4b56)
1919

2020
<br>
21-
<p align="center">
21+
<!--<p align="center">
2222
<strong>The New Computer Update</strong> introduces <strong><code>--os</code></strong> and a new <strong>Computer API</strong>. <a href="https://changes.openinterpreter.com/log/the-new-computer-update">Read On →</a>
23-
</p>
23+
</p>-->
2424
<br>
2525

2626
```shell

interpreter/core/computer/skills/skills.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,21 @@ def search(self, query):
2424

2525
def import_skills(self):
2626
previous_save_skills_setting = self.computer.save_skills
27+
2728
self.computer.save_skills = False
2829

30+
# Make sure it's not over 100mb
31+
total_size = 0
32+
for path, dirs, files in os.walk(self.path):
33+
for f in files:
34+
fp = os.path.join(path, f)
35+
total_size += os.path.getsize(fp)
36+
total_size = total_size / (1024 * 1024) # convert bytes to megabytes
37+
if total_size > 100:
38+
raise Warning(
39+
f"Skills at path {self.path} can't exceed 100mb. Try deleting some."
40+
)
41+
2942
code_to_run = ""
3043
for file in glob.glob(os.path.join(self.path, "*.py")):
3144
with open(file, "r") as f:
@@ -34,7 +47,24 @@ def import_skills(self):
3447
if self.computer.interpreter.debug:
3548
print("IMPORTING SKILLS:\n", code_to_run)
3649

37-
self.computer.run("python", code_to_run)
50+
output = self.computer.run("python", code_to_run)
51+
52+
if "traceback" in output.lower():
53+
# Import them individually
54+
for file in glob.glob(os.path.join(self.path, "*.py")):
55+
with open(file, "r") as f:
56+
code_to_run = f.read() + "\n"
57+
58+
if self.computer.interpreter.debug:
59+
print("IMPORTING SKILL:\n", code_to_run)
60+
61+
output = self.computer.run("python", code_to_run)
62+
63+
if "traceback" in output.lower():
64+
print(
65+
f"Skill at {file} might be broken— it produces a traceback when run."
66+
)
67+
3868
self.computer.save_skills = previous_save_skills_setting
3969

4070

0 commit comments

Comments
 (0)