Skip to content

Commit 268e8ec

Browse files
committed
Fixed updating profiles
1 parent 19e3562 commit 268e8ec

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

interpreter/terminal_interface/profiles/profiles.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,24 @@ def apply_profile(interpreter, profile, profile_path):
161161
migrate_user_app_directory()
162162
print("Migration complete.")
163163
print("")
164+
if profile_path.endswith("default.yaml"):
165+
with open(profile_path, "r") as file:
166+
text = file.read()
167+
text = text.replace("version: " + str(profile["version"]), f"version: {OI_VERSION}")
168+
169+
try:
170+
if profile["llm"]["model"] == "gpt-4":
171+
text = text.replace("gpt-4", "gpt-4-turbo")
172+
profile["llm"]["model"] = "gpt-4-turbo"
173+
elif profile["llm"]["model"] == "gpt-4-turbo-preview":
174+
text = text.replace("gpt-4-turbo-preview", "gpt-4-turbo")
175+
profile["llm"]["model"] = "gpt-4-turbo"
176+
except:
177+
raise
178+
pass # fine
179+
180+
with open(profile_path, "w") as file:
181+
file.write(text)
164182
else:
165183
print("Skipping loading profile...")
166184
print("")

0 commit comments

Comments
 (0)