mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Custom Paths from Menu structure fixed
This commit is contained in:
@@ -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
|
#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
|
#so we'll just go through all the possible loaders
|
||||||
for model_backend in model_backends:
|
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})
|
emit("selected_model_info", {"model_backends": valid_loaders})
|
||||||
else:
|
else:
|
||||||
#Get directories
|
#Get directories
|
||||||
|
@@ -19,7 +19,6 @@ model_backend_name = "GooseAI"
|
|||||||
class OpenAIAPIError(Exception):
|
class OpenAIAPIError(Exception):
|
||||||
def __init__(self, error_type: str, error_message) -> None:
|
def __init__(self, error_type: str, error_message) -> None:
|
||||||
super().__init__(f"{error_type}: {error_message}")
|
super().__init__(f"{error_type}: {error_message}")
|
||||||
self.source = "GooseAI"
|
|
||||||
|
|
||||||
|
|
||||||
class model_backend(openai_gooseai_model_backend):
|
class model_backend(openai_gooseai_model_backend):
|
||||||
@@ -28,6 +27,7 @@ class model_backend(openai_gooseai_model_backend):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.url = "https://api.goose.ai/v1/engines"
|
self.url = "https://api.goose.ai/v1/engines"
|
||||||
|
self.source = "GooseAI"
|
||||||
|
|
||||||
def is_valid(self, model_name, model_path, menu_path):
|
def is_valid(self, model_name, model_path, menu_path):
|
||||||
return model_name == "GooseAI"
|
return model_name == "GooseAI"
|
@@ -19,7 +19,6 @@ model_backend_name = "OpenAI"
|
|||||||
class OpenAIAPIError(Exception):
|
class OpenAIAPIError(Exception):
|
||||||
def __init__(self, error_type: str, error_message) -> None:
|
def __init__(self, error_type: str, error_message) -> None:
|
||||||
super().__init__(f"{error_type}: {error_message}")
|
super().__init__(f"{error_type}: {error_message}")
|
||||||
self.source = "OpenAI"
|
|
||||||
|
|
||||||
|
|
||||||
class model_backend(openai_gooseai_model_backend):
|
class model_backend(openai_gooseai_model_backend):
|
||||||
@@ -28,6 +27,7 @@ class model_backend(openai_gooseai_model_backend):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.url = "https://api.openai.com/v1/engines"
|
self.url = "https://api.openai.com/v1/engines"
|
||||||
|
self.source = "OpenAI"
|
||||||
|
|
||||||
def is_valid(self, model_name, model_path, menu_path):
|
def is_valid(self, model_name, model_path, menu_path):
|
||||||
return model_name == "OAI"
|
return model_name == "OAI"
|
@@ -31,11 +31,6 @@ class model_backend(InferenceModel):
|
|||||||
return model_name == "OAI" or model_name == "GooseAI"
|
return model_name == "OAI" or model_name == "GooseAI"
|
||||||
|
|
||||||
def get_requested_parameters(self, model_name, model_path, menu_path):
|
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):
|
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:
|
with open("settings/{}.model_backend.settings".format(self.source), "r") as f:
|
||||||
self.key = json.load(f)['key']
|
self.key = json.load(f)['key']
|
||||||
|
Reference in New Issue
Block a user