From df5d045e36436d2698e6032dc2403475eb6d8076 Mon Sep 17 00:00:00 2001 From: xssdoctor Date: Sat, 16 Mar 2024 09:39:05 -0400 Subject: [PATCH] fixed defaultmodel --- installer/client/cli/utils.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/installer/client/cli/utils.py b/installer/client/cli/utils.py index 239b627..7517325 100644 --- a/installer/client/cli/utils.py +++ b/installer/client/cli/utils.py @@ -34,6 +34,8 @@ class Standalone: """ # Expand the tilde to the full path + if args is None: + args = type('Args', (), {})() env_file = os.path.expanduser(env_file) load_dotenv(env_file) assert 'OPENAI_API_KEY' in os.environ, "Error: OPENAI_API_KEY not found in environment variables. Please run fabric --setup and add a key." @@ -45,13 +47,12 @@ class Standalone: self.config_pattern_directory = config_directory self.pattern = pattern self.args = args - self.model = None - if args.model: - self.model = args.model - else: + self.model = getattr(args, 'model', None) + if not self.model: try: - self.model = os.environ["DEFAULT_MODEL"] - except: + self.model = os.environ.get( + "DEFAULT_MODEL", 'gpt-4-turbo-preview') + except KeyError: self.model = 'gpt-4-turbo-preview' self.claude = False sorted_gpt_models, ollamaList, claudeList = self.fetch_available_models()