mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2025-02-21 01:31:20 +00:00
fixes
This commit is contained in:
parent
96c62d8e50
commit
b7129933b3
@ -21,7 +21,7 @@
|
||||
<i data-feather="trash" class="w-5"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
<div v-if="installing"
|
||||
class="absolute z-10 -m-4 p-5 shadow-md text-center rounded-lg w-full h-full bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel bg-opacity-70 dark:bg-opacity-70 flex justify-center items-center">
|
||||
<!-- DOWNLOAD MODEL PANEL SPINNER -->
|
||||
<div class="relative flex flex-col items-center justify-center flex-grow h-full">
|
||||
@ -45,10 +45,10 @@
|
||||
|
||||
<div class="flex justify-between mb-1">
|
||||
<span class="text-base font-medium text-blue-700 dark:text-white">Downloading</span>
|
||||
<span class="text-sm font-medium text-blue-700 dark:text-white">45%</span>
|
||||
<span class="text-sm font-medium text-blue-700 dark:text-white">{{ Math.floor(progress) }}%</span>
|
||||
</div>
|
||||
<div class="w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700">
|
||||
<div class="bg-blue-600 h-2.5 rounded-full" style="width: 45%"></div>
|
||||
<div class="bg-blue-600 h-2.5 rounded-full" :style="{ width: progress + '%' }"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -93,7 +93,7 @@
|
||||
</button>
|
||||
<button v-if="!model.isInstalled" type="button" title="Click to install model"
|
||||
class="hover:text-secondary duration-75 active:scale-90 font-medium rounded-lg text-sm p-2 text-center inline-flex items-center "
|
||||
@click.stop="">
|
||||
@click.stop="toggleInstall">
|
||||
<i data-feather="plus-square" class="w-5"></i>
|
||||
<span class="sr-only">Install</span>
|
||||
</button>
|
||||
|
@ -447,7 +447,8 @@
|
||||
Models: ({{ models.length }})
|
||||
</label>
|
||||
|
||||
<div class="overflow-y-auto no-scrollbar p-2 pb-0 grid lg:grid-cols-3 md:grid-cols-2 gap-4" :class="mzl_collapsed ? '' : 'max-h-96'">
|
||||
<div class="overflow-y-auto no-scrollbar p-2 pb-0 grid lg:grid-cols-3 md:grid-cols-2 gap-4"
|
||||
:class="mzl_collapsed ? '' : 'max-h-96'">
|
||||
<TransitionGroup name="list">
|
||||
<model-entry ref="modelZoo" v-for="(model, index) in models"
|
||||
:key="'index-' + index + '-' + model.title" :title="model.title" :icon="model.icon"
|
||||
@ -455,7 +456,8 @@
|
||||
:license="model.license" :description="model.description"
|
||||
:is-installed="model.isInstalled" :on-install="onInstall" :on-uninstall="onUninstall"
|
||||
:on-selected="onSelected" :selected="model.title === configFile.model_name"
|
||||
:model="model" :model_type="model.model_type" :on-copy="onCopy" :on-copy-link="onCopyLink" />
|
||||
:model="model" :model_type="model.model_type" :on-copy="onCopy"
|
||||
:on-copy-link="onCopyLink" />
|
||||
</TransitionGroup>
|
||||
</div>
|
||||
</div>
|
||||
@ -1057,52 +1059,87 @@ export default {
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
async created() {
|
||||
|
||||
socket.on('install_progress', progressListener);
|
||||
//await socket.on('install_progress', this.progressListener);
|
||||
|
||||
}, methods: {
|
||||
async progressListener(response){
|
||||
|
||||
async progressListener(response) {
|
||||
// does not work Still freezes UI
|
||||
console.log("received something");
|
||||
|
||||
if (response.status === 'progress') {
|
||||
console.log(`Progress = ${response.progress}`);
|
||||
model_object.progress = response.progress
|
||||
model_object.installing = true
|
||||
if (model_object.progress == 100) {
|
||||
const index = this.models.findIndex((model) => model.path === path);
|
||||
this.models[index].isInstalled = true;
|
||||
this.showProgress = false;
|
||||
model_object.installing = false
|
||||
|
||||
// Find model
|
||||
|
||||
|
||||
// 'model_name' : model_name,
|
||||
// 'binding_folder' : binding_folder,
|
||||
// 'model_url' : model_url
|
||||
|
||||
|
||||
if (response.status === 'progress') {
|
||||
|
||||
// FInd model
|
||||
if (this.$refs.modelZoo) {
|
||||
const index = this.$refs.modelZoo.findIndex(item => item.model.path == response.model_url && item.model.title == response.model_name && this.configFile.binding_name == response.binding_folder)
|
||||
const modelEntry = this.models[index]
|
||||
|
||||
if (modelEntry) {
|
||||
// Model found
|
||||
console.log('model entry', modelEntry)
|
||||
modelEntry.installing = true
|
||||
modelEntry.progress = response.progress
|
||||
console.log(`Progress = ${response.progress}`);
|
||||
if (response.progress >= 100) {
|
||||
modelEntry.installing = false
|
||||
modelEntry.isInstalled = true
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (response.status === 'succeeded') {
|
||||
console.log("Received succeeded")
|
||||
|
||||
console.log("Installed successfully")
|
||||
|
||||
if (this.$refs.modelZoo) {
|
||||
const index = this.$refs.modelZoo.findIndex(item => item.model.path == response.model_url && item.model.title == response.model_name && this.configFile.binding_name == response.binding_folder)
|
||||
const modelEntry = this.models[index]
|
||||
|
||||
if (modelEntry) {
|
||||
// Model found
|
||||
|
||||
modelEntry.installing = false
|
||||
modelEntry.isInstalled = true
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.$refs.toast.showToast("Model:\n" + model_object.title + "\ninstalled!", 4, true)
|
||||
this.api_get_req("disk_usage").then(response => {
|
||||
this.diskUsage = response
|
||||
})
|
||||
} else if (response.status === 'failed') {
|
||||
|
||||
console.log("Install failed")
|
||||
// Installation failed or encountered an error
|
||||
if (this.$refs.modelZoo) {
|
||||
const index = this.$refs.modelZoo.findIndex(item => item.model.path == response.model_url && item.model.title == response.model_name && this.configFile.binding_name == response.binding_folder)
|
||||
const modelEntry = this.models[index]
|
||||
|
||||
if (modelEntry) {
|
||||
// Model found
|
||||
|
||||
modelEntry.installing = false
|
||||
modelEntry.isInstalled = false
|
||||
|
||||
}
|
||||
} else if (response.status === 'succeeded') {
|
||||
console.log("Received succeeded")
|
||||
socket.off('install_progress', progressListener);
|
||||
console.log("Installed successfully")
|
||||
// Update the isInstalled property of the corresponding model
|
||||
const index = this.models.findIndex((model) => model.path === path);
|
||||
this.models[index].isInstalled = true;
|
||||
this.showProgress = false;
|
||||
model_object.installing = false
|
||||
this.$refs.toast.showToast("Model:\n" + model_object.title + "\ninstalled!", 4, true)
|
||||
this.api_get_req("disk_usage").then(response => {
|
||||
this.diskUsage = response
|
||||
})
|
||||
} else if (response.status === 'failed') {
|
||||
socket.off('install_progress', progressListener);
|
||||
console.log("Install failed")
|
||||
// Installation failed or encountered an error
|
||||
model_object.installing = false;
|
||||
v
|
||||
this.showProgress = false;
|
||||
console.error('Installation failed:', response.error);
|
||||
this.$refs.toast.showToast("Model:\n" + model_object.title + "\nfailed to install!", 4, false)
|
||||
this.api_get_req("disk_usage").then(response => {
|
||||
this.diskUsage = response
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
showAddModelDialog() {
|
||||
this.$refs.addmodeldialog.showDialog("").then(() => {
|
||||
@ -1303,7 +1340,7 @@ export default {
|
||||
console.log("Install failed")
|
||||
// Installation failed or encountered an error
|
||||
model_object.installing = false;
|
||||
v
|
||||
|
||||
this.showProgress = false;
|
||||
console.error('Installation failed:', response.error);
|
||||
this.$refs.toast.showToast("Model:\n" + model_object.title + "\nfailed to install!", 4, false)
|
||||
@ -1455,7 +1492,7 @@ export default {
|
||||
|
||||
console.log('pers sett', res)
|
||||
if (res.data && Object.keys(res.data).length > 0) {
|
||||
|
||||
|
||||
this.$refs.universalForm.showForm(res.data, "Personality settings - " + persEntry.personality.name, "Save changes", "Cancel").then(res => {
|
||||
|
||||
// send new data
|
||||
@ -1527,7 +1564,7 @@ export default {
|
||||
|
||||
if (model.title == response["model_name"]) {
|
||||
model.selected = true;
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
model.selected = false;
|
||||
@ -1560,6 +1597,11 @@ export default {
|
||||
|
||||
|
||||
this.fetchModels();
|
||||
this.api_get_req("list_bindings")
|
||||
then(response => {
|
||||
this.bindings = response
|
||||
this.bindings.sort((a, b) => a.name.localeCompare(b.name))
|
||||
})
|
||||
},
|
||||
// Accordeon stuff
|
||||
toggleAccordion() {
|
||||
@ -1599,7 +1641,12 @@ export default {
|
||||
|
||||
this.update_setting('binding_name', value, (res) => {
|
||||
|
||||
|
||||
const index = this.bindings.findIndex(item => item.folder == value)
|
||||
const item = this.bindings[index]
|
||||
if(item){
|
||||
item.installed=true
|
||||
}
|
||||
|
||||
this.$refs.toast.showToast("Binding changed.", 4, true)
|
||||
this.settingsChanged = true
|
||||
this.isLoading = false
|
||||
|
Loading…
x
Reference in New Issue
Block a user