-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/KillianLucas/open-interpreter
- Loading branch information
Showing
9 changed files
with
98 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import json | ||
import os | ||
|
||
import requests | ||
import yaml | ||
|
||
from .get_oi_dir import get_oi_dir | ||
|
||
config_dir = os.path.join(get_oi_dir() + "configs") | ||
|
||
|
||
def get_config(filename_or_url): | ||
# i.com/ is a shortcut for openinterpreter.com/profiles/ | ||
shortcuts = ["i.com/", "www.i.com/", "https://i.com/", "http://i.com/"] | ||
for shortcut in shortcuts: | ||
if filename_or_url.startswith(shortcut): | ||
filename_or_url = filename_or_url.replace( | ||
shortcut, "openinterpreter.com/profiles/" | ||
) | ||
break | ||
|
||
config_path = os.path.join(config_dir, filename_or_url) | ||
if os.path.exists(config_path): | ||
with open(config_path, "r") as file: | ||
try: | ||
return yaml.safe_load(file) | ||
except: | ||
return json.load(file) | ||
else: | ||
response = requests.get(filename_or_url) | ||
response.raise_for_status() | ||
try: | ||
return yaml.safe_load(response.text) | ||
except: | ||
return json.loads(response.text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import appdirs | ||
|
||
|
||
def get_oi_dir(): | ||
return appdirs.user_config_dir("Open Interpreter Terminal") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters