Skip to content

Commit 119198c

Browse files
committed
Clarify skills messages in list() and search()
Update error messages to better explain how to enable skills, and return empty list if skills are disabled. When OI tries to list skills, it shows them, but then it can't actually call them and it gets very confused.
1 parent 75ef14d commit 119198c

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

interpreter/core/computer/skills/skills.py

+24
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ class Skills:
2424
"""
2525
Manages access to pre-imported automation skills.
2626
27+
Note: Skills system must be enabled via profile (like 'the01') or by creating
28+
OpenInterpreter with import_skills=True.
29+
2730
Available methods:
2831
- list(): Returns names of available skills
2932
- search(query): Lists available skills (currently same as list())
@@ -47,6 +50,15 @@ def list(self):
4750
Returns:
4851
list[str]: Names of available skills with () to indicate they're callable
4952
"""
53+
if not self.computer.import_skills:
54+
print("Skills are disabled. To enable skills, either use a profile like 'the01' that supports skills, "
55+
"or create an instance of OpenInterpreter with import_skills=True")
56+
return []
57+
58+
if not self.computer._has_imported_skills:
59+
print("Skills have not been imported yet.")
60+
return []
61+
5062
return [
5163
file.replace(".py", "()")
5264
for file in os.listdir(self.path)
@@ -70,6 +82,15 @@ def search(self, query):
7082
Returns:
7183
list[str]: Names of available skills with () to indicate they're callable
7284
"""
85+
if not self.computer.import_skills:
86+
print("Skills are disabled. To enable skills, either use a profile like 'the01' that supports skills, "
87+
"or create an instance of OpenInterpreter with import_skills=True")
88+
return []
89+
90+
if not self.computer._has_imported_skills:
91+
print("Skills have not been imported yet.")
92+
return []
93+
7394
return [
7495
file.replace(".py", "()")
7596
for file in os.listdir(self.path)
@@ -84,6 +105,9 @@ def import_skills(self):
84105
This method is called automatically during system setup to load available skills.
85106
Assistant should use list(), search(), or call skills directly instead of this method.
86107
"""
108+
if not self.computer.import_skills:
109+
return
110+
87111
previous_save_skills_setting = self.computer.save_skills
88112

89113
self.computer.save_skills = False

0 commit comments

Comments
 (0)