mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2025-01-18 02:39:47 +00:00
fixed some bugs
This commit is contained in:
parent
5ea2c4b70d
commit
9f46573826
@ -200,30 +200,30 @@ class ModelProcess:
|
||||
def cancel_generation(self):
|
||||
self.completion_signal.set()
|
||||
self.cancel_queue.put(('cancel',))
|
||||
ASCIIColors.print(ASCIIColors.color_red,"Canel request received")
|
||||
ASCIIColors.error("Canel request received")
|
||||
|
||||
def clear_queue(self):
|
||||
self.clear_queue_queue.put(('clear_queue',))
|
||||
|
||||
def rebuild_binding(self, config):
|
||||
try:
|
||||
ASCIIColors.print(ASCIIColors.color_green," ******************* Building Binding from main Process *************************")
|
||||
ASCIIColors.success(" ******************* Building Binding from main Process *************************")
|
||||
binding = self.load_binding(config["binding_name"], install=True)
|
||||
ASCIIColors.print(ASCIIColors.color_green,"Binding loaded successfully")
|
||||
ASCIIColors.success("Binding loaded successfully")
|
||||
except Exception as ex:
|
||||
ASCIIColors.print(ASCIIColors.color_red,"Couldn't build binding.")
|
||||
ASCIIColors.print(ASCIIColors.color_red,"-----------------")
|
||||
ASCIIColors.error("Couldn't build binding.")
|
||||
ASCIIColors.error("-----------------")
|
||||
print(f"It seems that there is no valid binding selected. Please use the ui settings to select a binding.\nHere is encountered error: {ex}")
|
||||
ASCIIColors.print(ASCIIColors.color_red,"-----------------")
|
||||
ASCIIColors.error("-----------------")
|
||||
binding = None
|
||||
return binding
|
||||
|
||||
def _rebuild_model(self):
|
||||
try:
|
||||
self.reset_config_result()
|
||||
ASCIIColors.print(ASCIIColors.color_green," ******************* Building Binding from generation Process *************************")
|
||||
ASCIIColors.success(" ******************* Building Binding from generation Process *************************")
|
||||
self.binding = self.load_binding(self.config["binding_name"], install=True)
|
||||
ASCIIColors.print(ASCIIColors.color_green,"Binding loaded successfully")
|
||||
ASCIIColors.success("Binding loaded successfully")
|
||||
try:
|
||||
model_file = self.lollms_paths.personal_models_path/self.config["binding_name"]/self.config["model_name"]
|
||||
print(f"Loading model : {model_file}")
|
||||
@ -251,7 +251,7 @@ class ModelProcess:
|
||||
|
||||
def rebuild_personalities(self):
|
||||
mounted_personalities=[]
|
||||
ASCIIColors.print(ASCIIColors.color_green,f" ******************* Building mounted Personalities from main Process *************************")
|
||||
ASCIIColors.success(f" ******************* Building mounted Personalities from main Process *************************")
|
||||
for personality in self.config['personalities']:
|
||||
try:
|
||||
print(f" {personality}")
|
||||
@ -260,12 +260,12 @@ class ModelProcess:
|
||||
personality = AIPersonality(self.lollms_paths, personality_path, run_scripts=False)
|
||||
mounted_personalities.append(personality)
|
||||
except Exception as ex:
|
||||
ASCIIColors.print(ASCIIColors.color_red,f"Personality file not found or is corrupted ({personality_path}).\nPlease verify that the personality you have selected exists or select another personality. Some updates may lead to change in personality name or category, so check the personality selection in settings to be sure.")
|
||||
ASCIIColors.error(f"Personality file not found or is corrupted ({personality_path}).\nPlease verify that the personality you have selected exists or select another personality. Some updates may lead to change in personality name or category, so check the personality selection in settings to be sure.")
|
||||
if self.config["debug"]:
|
||||
print(ex)
|
||||
personality = AIPersonality(self.lollms_paths)
|
||||
|
||||
ASCIIColors.print(ASCIIColors.color_green,f" ************ Personalities mounted (Main process) ***************************")
|
||||
ASCIIColors.success(f" ************ Personalities mounted (Main process) ***************************")
|
||||
|
||||
return mounted_personalities
|
||||
|
||||
@ -273,7 +273,7 @@ class ModelProcess:
|
||||
self.mounted_personalities=[]
|
||||
failed_personalities=[]
|
||||
self.reset_config_result()
|
||||
ASCIIColors.print(ASCIIColors.color_green,f" ******************* Building mounted Personalities from generation Process *************************")
|
||||
ASCIIColors.success(f" ******************* Building mounted Personalities from generation Process *************************")
|
||||
for personality in self.config['personalities']:
|
||||
try:
|
||||
print(f" {personality}")
|
||||
@ -288,7 +288,7 @@ class ModelProcess:
|
||||
failed_personalities.append(personality_path)
|
||||
self._set_config_result['errors'].append(f"couldn't build personalities:{ex}")
|
||||
|
||||
ASCIIColors.print(ASCIIColors.color_green,f" ************ Personalities mounted (Generation process) ***************************")
|
||||
ASCIIColors.success(f" ************ Personalities mounted (Generation process) ***************************")
|
||||
if len(failed_personalities)==len(self.config['personalities']):
|
||||
self._set_config_result['status'] ='failed'
|
||||
self._set_config_result['personalities_status'] ='failed'
|
||||
@ -298,7 +298,7 @@ class ModelProcess:
|
||||
|
||||
self.personality = self.mounted_personalities[self.config['active_personality_id']]
|
||||
self.mounted_personalities = self.config["personalities"]
|
||||
ASCIIColors.print(ASCIIColors.color_green,"Personality set successfully")
|
||||
ASCIIColors.success("Personality set successfully")
|
||||
|
||||
def _run(self):
|
||||
self._rebuild_model()
|
||||
@ -336,7 +336,7 @@ class ModelProcess:
|
||||
if self.personality.processor_cfg is not None:
|
||||
if "custom_workflow" in self.personality.processor_cfg:
|
||||
if self.personality.processor_cfg["custom_workflow"]:
|
||||
ASCIIColors.print(ASCIIColors.color_green,"Running workflow")
|
||||
ASCIIColors.success("Running workflow")
|
||||
self.completion_signal.clear()
|
||||
self.start_signal.set()
|
||||
|
||||
@ -506,11 +506,11 @@ class LoLLMsAPPI():
|
||||
# =========================================================================================
|
||||
@socketio.on('connect')
|
||||
def connect():
|
||||
ASCIIColors.print(ASCIIColors.color_green,f'Client {request.sid} connected')
|
||||
ASCIIColors.success(f'Client {request.sid} connected')
|
||||
|
||||
@socketio.on('disconnect')
|
||||
def disconnect():
|
||||
ASCIIColors.print(ASCIIColors.color_red,f'Client {request.sid} disconnected')
|
||||
ASCIIColors.error(f'Client {request.sid} disconnected')
|
||||
|
||||
@socketio.on('install_model')
|
||||
def install_model(data):
|
||||
|
2
app.py
2
app.py
@ -1198,7 +1198,7 @@ if __name__ == "__main__":
|
||||
|
||||
if "version" not in config or int(config["version"])<int(default_config["version"]):
|
||||
#Upgrade old configuration files to new format
|
||||
ASCIIColors.print(ASCIIColors.color_red,"Configuration file is very old.\nReplacing with default configuration")
|
||||
ASCIIColors.error("Configuration file is very old.\nReplacing with default configuration")
|
||||
config, added, removed = sync_cfg(default_config, config)
|
||||
print(f"Added entries : {added}, removed entries:{removed}")
|
||||
config.save_config(config_file_path)
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
web/dist/index.html
vendored
4
web/dist/index.html
vendored
@ -6,8 +6,8 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>GPT4All - WEBUI</title>
|
||||
<script type="module" crossorigin src="/assets/index-9a571523.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index-940fed0d.css">
|
||||
<script type="module" crossorigin src="/assets/index-aeb5a3c1.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index-5a7db389.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
0
web/src/components/AddModelDialog.vue
Normal file
0
web/src/components/AddModelDialog.vue
Normal file
@ -209,30 +209,31 @@
|
||||
class="text-2xl hover:text-primary duration-75 p-2 -m-2 w-full text-left active:translate-y-1 flex items-center">
|
||||
<i :data-feather="mzc_collapsed ? 'chevron-right' : 'chevron-down'" class="mr-2 flex-shrink-0"></i>
|
||||
<h3 class="text-lg font-semibold cursor-pointer select-none mr-2">
|
||||
Models zoo</h3>
|
||||
Models zoo</h3>
|
||||
<div class="flex flex-row items-center">
|
||||
<div v-if="!isModelSelected" class="text-base text-red-600 flex gap-3 items-center mr-2">
|
||||
<i data-feather="alert-triangle" class="flex-shrink-0"></i>
|
||||
No model selected!
|
||||
</div>
|
||||
|
||||
<div v-if="configFile.model_name" class="mr-2">|</div>
|
||||
|
||||
<div v-if="configFile.model_name"
|
||||
class=" text-base font-semibold cursor-pointer select-none items-center">
|
||||
|
||||
<div class="flex gap-1 items-center">
|
||||
<img :src="imgModel" class="w-8 h-8 rounded-lg object-fill">
|
||||
<h3 class="font-bold font-large text-lg line-clamp-1">
|
||||
{{ configFile.model_name }}
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
|
||||
<div v-if="!isModelSelected" class="text-base text-red-600 flex gap-3 items-center mr-2">
|
||||
<i data-feather="alert-triangle" class="flex-shrink-0"></i>
|
||||
No model selected!
|
||||
</div>
|
||||
|
||||
<div v-if="configFile.model_name" class="mr-2">|</div>
|
||||
|
||||
<div v-if="configFile.model_name" class="text-base font-semibold cursor-pointer select-none items-center">
|
||||
<div class="flex gap-1 items-center">
|
||||
<img :src="imgModel" class="w-8 h-8 rounded-lg object-fill">
|
||||
<h3 class="font-bold font-large text-lg line-clamp-1">
|
||||
{{ configFile.model_name }}
|
||||
</h3>
|
||||
<button @click.stop="showInputDialog" class="text-base hover:text-primary-dark ml-1 bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-dark-tone duration-200 rounded-lg px-2 py-1">
|
||||
+
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
<div :class="{ 'hidden': mzc_collapsed }" class="flex flex-col mb-2 px-3 pb-0">
|
||||
|
||||
<div v-if="models.length > 0" class="mb-2">
|
||||
@ -587,6 +588,17 @@
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
.bg-primary-light {
|
||||
background-color: aqua
|
||||
}
|
||||
|
||||
.hover:bg-primary-light:hover {
|
||||
background-color: aquamarine
|
||||
}
|
||||
|
||||
.font-bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
import filesize from '../plugins/filesize'
|
||||
@ -619,6 +631,9 @@ export default {
|
||||
data() {
|
||||
|
||||
return {
|
||||
// install custom model
|
||||
showModelInputDialog: false,
|
||||
modelPath: '',
|
||||
// Zoo stuff
|
||||
models: [],
|
||||
personalities: [],
|
||||
@ -661,6 +676,32 @@ export default {
|
||||
created() {
|
||||
|
||||
}, methods: {
|
||||
showInputDialog() {
|
||||
console.log("Input dialog shown")
|
||||
this.showModelInputDialog = true;
|
||||
},
|
||||
closeInputDialog() {
|
||||
this.showModelInputDialog = false;
|
||||
this.modelPath = '';
|
||||
},
|
||||
validateModelPath() {
|
||||
// Perform validation of the model path (e.g., checking if it is a local file or internet link)
|
||||
// ...
|
||||
|
||||
// Trigger the `download_model` endpoint with the path as a POST
|
||||
this.$axios.post('/download_model', { path: this.modelPath })
|
||||
.then(response => {
|
||||
// Handle the response
|
||||
// ...
|
||||
})
|
||||
.catch(error => {
|
||||
// Handle the error
|
||||
// ...
|
||||
});
|
||||
|
||||
// Close the input dialog
|
||||
this.closeInputDialog();
|
||||
},
|
||||
collapseAll(val) {
|
||||
this.bec_collapsed = val
|
||||
this.mzc_collapsed = val
|
||||
|
Loading…
Reference in New Issue
Block a user