Custom Paths from Menu structure fixed

This commit is contained in:
ebolam
2023-05-19 18:28:47 -04:00
parent 6df5fe4ad0
commit a1ee6849dc
4 changed files with 4 additions and 8 deletions

View File

@@ -6152,7 +6152,8 @@ def UI_2_select_model(data):
#Here we have a model that's not in our menu structure (either a custom model or a custom path
#so we'll just go through all the possible loaders
for model_backend in model_backends:
valid_loaders[model_backend] = model_backends[model_backend].get_requested_parameters(data["name"], data["path"] if 'path' in data else None, data["menu"])
if model_backends[model_backend].is_valid(data["name"], data["path"] if 'path' in data else None, data["menu"]):
valid_loaders[model_backend] = model_backends[model_backend].get_requested_parameters(data["name"], data["path"] if 'path' in data else None, data["menu"])
emit("selected_model_info", {"model_backends": valid_loaders})
else:
#Get directories

View File

@@ -19,7 +19,6 @@ model_backend_name = "GooseAI"
class OpenAIAPIError(Exception):
def __init__(self, error_type: str, error_message) -> None:
super().__init__(f"{error_type}: {error_message}")
self.source = "GooseAI"
class model_backend(openai_gooseai_model_backend):
@@ -28,6 +27,7 @@ class model_backend(openai_gooseai_model_backend):
def __init__(self):
super().__init__()
self.url = "https://api.goose.ai/v1/engines"
self.source = "GooseAI"
def is_valid(self, model_name, model_path, menu_path):
return model_name == "GooseAI"

View File

@@ -19,7 +19,6 @@ model_backend_name = "OpenAI"
class OpenAIAPIError(Exception):
def __init__(self, error_type: str, error_message) -> None:
super().__init__(f"{error_type}: {error_message}")
self.source = "OpenAI"
class model_backend(openai_gooseai_model_backend):
@@ -28,6 +27,7 @@ class model_backend(openai_gooseai_model_backend):
def __init__(self):
super().__init__()
self.url = "https://api.openai.com/v1/engines"
self.source = "OpenAI"
def is_valid(self, model_name, model_path, menu_path):
return model_name == "OAI"

View File

@@ -31,11 +31,6 @@ class model_backend(InferenceModel):
return model_name == "OAI" or model_name == "GooseAI"
def get_requested_parameters(self, model_name, model_path, menu_path):
try:
print(self.source)
except:
print(vars(self))
raise
if os.path.exists("settings/{}.model_backend.settings".format(self.source)) and 'colaburl' not in vars(self):
with open("settings/{}.model_backend.settings".format(self.source), "r") as f:
self.key = json.load(f)['key']