Skip to content

Commit 32083b1

Browse files
committed
wtf respects profiles 🇺🇸
1 parent 9792749 commit 32083b1

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

‎interpreter/terminal_interface/profiles/defaults/default.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,9 @@ computer:
2525
# verbose: False # If True, will print detailed logs
2626
# multi_line: False # If True, you can input multiple lines starting and ending with ```
2727

28+
# To use a separate model for the `wtf` command:
29+
# wtf:
30+
# model: "gpt-3.5-turbo"
31+
2832
# Documentation
2933
# All options: https://docs.openinterpreter.com/settings

‎interpreter/terminal_interface/profiles/profiles.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -563,10 +563,15 @@ def normalize_text(message):
563563
def apply_profile_to_object(obj, profile):
564564
for key, value in profile.items():
565565
if isinstance(value, dict):
566+
if (
567+
key == "wtf"
568+
): # The wtf command has a special part of the profile, not used here
569+
continue
566570
apply_profile_to_object(getattr(obj, key), value)
567571
else:
568572
setattr(obj, key, value)
569573

574+
570575
def open_storage_dir(directory):
571576
dir = os.path.join(oi_dir, directory)
572577

@@ -763,25 +768,27 @@ def migrate_user_app_directory():
763768

764769
def write_key_to_profile(key, value):
765770
try:
766-
with open(user_default_profile_path, 'r') as file:
771+
with open(user_default_profile_path, "r") as file:
767772
lines = file.readlines()
768-
773+
769774
version_line_index = None
770775
new_lines = []
771776
for index, line in enumerate(lines):
772777
if line.strip().startswith("version:"):
773778
version_line_index = index
774779
break
775780
new_lines.append(line)
776-
781+
777782
# Insert the new key-value pair before the version line
778783
if version_line_index is not None:
779784
if f"{key}: {value}\n" not in new_lines:
780-
new_lines.append(f"{key}: {value}\n\n") # Adding a newline for separation
785+
new_lines.append(
786+
f"{key}: {value}\n\n"
787+
) # Adding a newline for separation
781788
# Append the version line and all subsequent lines
782789
new_lines.extend(lines[version_line_index:])
783-
784-
with open(user_default_profile_path, 'w') as file:
790+
791+
with open(user_default_profile_path, "w") as file:
785792
file.writelines(new_lines)
786793
except Exception:
787-
pass # Fail silently
794+
pass # Fail silently

‎scripts/wtf.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,11 @@ def main():
118118
try:
119119
with open(default_profile_path, "r") as file:
120120
profile = yaml.safe_load(file)
121-
model = profile.get("llm", {}).get("model", "gpt-3.5-turbo")
121+
wtf_model = profile.get("wtf", {}).get("model")
122+
if wtf_model:
123+
model = wtf_model
124+
else:
125+
model = profile.get("llm", {}).get("model", "gpt-3.5-turbo")
122126
except:
123127
model = "gpt-3.5-turbo"
124128

0 commit comments

Comments
 (0)