mirror of
https://github.com/ParisNeo/lollms.git
synced 2025-01-18 18:56:28 +00:00
upgraded backend
This commit is contained in:
parent
5f1365c306
commit
26c1b62f04
@ -175,7 +175,7 @@ def models():
|
||||
"limits": None,
|
||||
"permission": []
|
||||
}
|
||||
for model in cv.binding.list_models(cv.config)
|
||||
for model in cv.binding.list_models()
|
||||
]
|
||||
return {'data': data, 'object': 'list'}
|
||||
|
||||
|
@ -105,8 +105,9 @@ class LoLLMsServer(LollmsApplication):
|
||||
|
||||
def list_models():
|
||||
if self.binding is not None:
|
||||
models = self.binding.list_models(self.config)
|
||||
ASCIIColors.yellow("Listing models")
|
||||
models = self.binding.list_models()
|
||||
ASCIIColors.green("ok")
|
||||
return jsonify(models)
|
||||
else:
|
||||
return jsonify([])
|
||||
@ -117,7 +118,7 @@ class LoLLMsServer(LollmsApplication):
|
||||
|
||||
def get_active_model():
|
||||
if self.binding is not None:
|
||||
models = self.binding.list_models(self.config)
|
||||
models = self.binding.list_models()
|
||||
index = models.index(self.config.model_name)
|
||||
ASCIIColors.yellow(f"Recovering active model: {models[index]}")
|
||||
return jsonify({"model":models[index],"index":index})
|
||||
@ -137,7 +138,7 @@ class LoLLMsServer(LollmsApplication):
|
||||
"""
|
||||
server_infos = {}
|
||||
if self.binding is not None:
|
||||
models = self.binding.list_models(self.config)
|
||||
models = self.binding.list_models()
|
||||
index = models.index(self.config.model_name)
|
||||
ASCIIColors.yellow(f"Recovering active model: {models[index]}")
|
||||
server_infos["binding"]=self.binding.name
|
||||
@ -365,7 +366,7 @@ class LoLLMsServer(LollmsApplication):
|
||||
"""
|
||||
if self.binding is None:
|
||||
emit('available_models_list', {'success':False, 'error': "No binding selected"}, room=request.sid)
|
||||
model_list = self.binding.get_available_models()
|
||||
model_list = self.binding.get_available_models(self)
|
||||
|
||||
models = []
|
||||
for model in model_list:
|
||||
|
@ -467,7 +467,7 @@ class LLMBinding:
|
||||
pass
|
||||
|
||||
|
||||
def list_models(self, config:dict):
|
||||
def list_models(self):
|
||||
"""Lists the models for this binding
|
||||
"""
|
||||
models = []
|
||||
@ -479,7 +479,7 @@ class LLMBinding:
|
||||
return models
|
||||
|
||||
|
||||
def get_available_models(self):
|
||||
def get_available_models(self, app:LoLLMsCom=None):
|
||||
# Create the file path relative to the child class's directory
|
||||
full_data = []
|
||||
for models_dir_name in self.models_dir_names:
|
||||
|
@ -267,7 +267,7 @@ class MainMenu(Menu):
|
||||
models_dir:Path = (self.lollms_app.lollms_paths.personal_models_path/self.lollms_app.config['binding_name'])
|
||||
models_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
models_list = self.lollms_app.binding.list_models(self.lollms_app.config) + ["Install model", "Change binding", "Back"]
|
||||
models_list = self.lollms_app.binding.list_models() + ["Install model", "Change binding", "Back"]
|
||||
choice = self.show_menu(models_list)
|
||||
if 1 <= choice <= len(models_list)-3:
|
||||
print(f"You selected model: {ASCIIColors.color_green}{models_list[choice - 1]}{ASCIIColors.color_reset}")
|
||||
|
Loading…
Reference in New Issue
Block a user