mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2025-01-29 15:44:12 +00:00
made yesand no upgrades
This commit is contained in:
parent
0d2d74fb33
commit
29a3e16194
@ -4,28 +4,33 @@
|
||||
<ul class="flex flex-col font-medium p-4 md:p-0 mt-4 md:flex-row md:space-x-8 md:mt-0 ">
|
||||
|
||||
<li>
|
||||
<RouterLink :to="{ name: 'discussions' }" class="p-2" active-class="p-2 bg-bg-light-tone dark:bg-bg-dark-tone rounded-t-lg ">
|
||||
<RouterLink :to="{ name: 'discussions' }" class="p-2"
|
||||
active-class="p-2 bg-bg-light-tone dark:bg-bg-dark-tone rounded-t-lg ">
|
||||
<a href="#" class=" hover:text-primary duration-150">Discussions</a>
|
||||
</RouterLink>
|
||||
</li>
|
||||
<li>
|
||||
<RouterLink :to="{ name: 'settings' }" class="p-2" active-class="p-2 bg-bg-light-tone dark:bg-bg-dark-tone rounded-t-lg ">
|
||||
<RouterLink :to="{ name: 'settings' }" class="p-2"
|
||||
active-class="p-2 bg-bg-light-tone dark:bg-bg-dark-tone rounded-t-lg ">
|
||||
<a href="#" class=" hover:text-primary duration-150">Settings</a>
|
||||
</RouterLink>
|
||||
</li>
|
||||
<li>
|
||||
<RouterLink :to="{ name: 'extensions' }" class="p-2" active-class="p-2 bg-bg-light-tone dark:bg-bg-dark-tone rounded-t-lg ">
|
||||
<RouterLink :to="{ name: 'extensions' }" class="p-2"
|
||||
active-class="p-2 bg-bg-light-tone dark:bg-bg-dark-tone rounded-t-lg ">
|
||||
<a href="#" class=" hover:text-primary duration-150">Extensions</a>
|
||||
</RouterLink>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<RouterLink :to="{ name: 'training' }" class="p-2" active-class="p-2 bg-bg-light-tone dark:bg-bg-dark-tone rounded-t-lg ">
|
||||
<RouterLink :to="{ name: 'training' }" class="p-2"
|
||||
active-class="p-2 bg-bg-light-tone dark:bg-bg-dark-tone rounded-t-lg ">
|
||||
<a href="#" class=" hover:text-primary duration-150">Training</a>
|
||||
</RouterLink>
|
||||
</li>
|
||||
<li>
|
||||
<RouterLink :to="{ name: 'help' }" class="p-2" active-class="p-2 bg-bg-light-tone dark:bg-bg-dark-tone rounded-t-lg ">
|
||||
<RouterLink :to="{ name: 'help' }" class="p-2"
|
||||
active-class="p-2 bg-bg-light-tone dark:bg-bg-dark-tone rounded-t-lg ">
|
||||
<a href="#" class=" hover:text-primary duration-150">Help</a>
|
||||
</RouterLink>
|
||||
</li>
|
||||
@ -35,7 +40,25 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {nextTick} from 'vue'
|
||||
import { nextTick } from 'vue'
|
||||
import feather from 'feather-icons'
|
||||
import { RouterLink } from 'vue-router'
|
||||
|
||||
|
||||
</script>
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
},
|
||||
activated() {
|
||||
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
},
|
||||
};
|
||||
</script>
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div v-if="show" class="fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center bg-black bg-opacity-50">
|
||||
<div class="relative w-full max-w-md max-h-full">
|
||||
<div class="relative bg-white rounded-lg shadow dark:bg-gray-700">
|
||||
<div class="relative w-full max-w-md max-h-full ">
|
||||
<div class="relative bg-white rounded-lg shadow dark:bg-gray-700 ">
|
||||
<button type="button" @click="hide(false)"
|
||||
class="absolute top-3 right-2.5 text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-800 dark:hover:text-white">
|
||||
<svg aria-hidden="true" class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20"
|
||||
@ -21,11 +21,10 @@
|
||||
<h3 class="mb-5 text-lg font-normal text-gray-500 dark:text-gray-400 select-none">{{ message }}</h3>
|
||||
<button @click="hide(true)" type="button"
|
||||
class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 dark:focus:ring-red-800 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2">
|
||||
Yes, I'm sure
|
||||
{{ConfirmButtonText}}
|
||||
</button>
|
||||
<button @click="hide(false)" type="button"
|
||||
class="text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 rounded-lg border border-gray-200 text-sm font-medium px-5 py-2.5 hover:text-gray-900 focus:z-10 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600">No,
|
||||
cancel</button>
|
||||
class="text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 rounded-lg border border-gray-200 text-sm font-medium px-5 py-2.5 hover:text-gray-900 focus:z-10 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600">{{DenyButtonText}}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -39,6 +38,8 @@ export default {
|
||||
show: false,
|
||||
message: "",
|
||||
resolve: null,
|
||||
ConfirmButtonText: "Yes, I'm sure",
|
||||
DenyButtonText: "No, cancel",
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
@ -49,7 +50,9 @@ export default {
|
||||
this.resolve = null;
|
||||
}
|
||||
},
|
||||
askQuestion(message) {
|
||||
askQuestion(message, ConfirmButtonText, DenyButtonText) {
|
||||
this.ConfirmButtonText =ConfirmButtonText || this.ConfirmButtonText
|
||||
this.DenyButtonText =DenyButtonText || this.DenyButtonText
|
||||
return new Promise((resolve) => {
|
||||
this.message = message;
|
||||
this.show = true;
|
||||
|
@ -11,14 +11,15 @@ const app = createApp(App)
|
||||
const store = createStore({
|
||||
state () {
|
||||
return {
|
||||
count: 0,
|
||||
mountedPersonalities: {}
|
||||
// count: 0,
|
||||
mountedPersonalities: {},
|
||||
settingsChanged:false
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
increment (state) {
|
||||
state.count++
|
||||
}
|
||||
// increment (state) {
|
||||
// state.count++
|
||||
// }
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -1196,7 +1196,7 @@ export default {
|
||||
// To fix scrolling back to last message, this hook is needed.
|
||||
// If anyone knows hor to fix scroll issue when changing pages, please do fix it :D
|
||||
console.log("Websocket connected (activated)", this.socketConnected)
|
||||
|
||||
console.log('settings changed acc', this.$store.state.settingsChanged)
|
||||
await this.getPersonalityAvatars()
|
||||
|
||||
if (this.isCreated) {
|
||||
|
@ -163,7 +163,7 @@
|
||||
<img :src="imgBinding" class="w-8 h-8 rounded-full object-fill text-blue-700">
|
||||
<h3 class="font-bold font-large text-lg line-clamp-1">
|
||||
<!-- {{ configFile.binding_name }} -->
|
||||
{{binding_name}}
|
||||
{{ binding_name }}
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
@ -331,17 +331,18 @@
|
||||
<div v-if="configFile.personalities" class="mr-2">|</div>
|
||||
<!-- LIST OF MOUNTED PERSONALITIES -->
|
||||
<div class="mr-2 font-bold font-large text-lg line-clamp-1">
|
||||
{{active_pesonality }}
|
||||
{{ active_pesonality }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="configFile.personalities" class="mr-2">|</div>
|
||||
<div v-if="configFile.personalities"
|
||||
class=" text-base font-semibold cursor-pointer select-none items-center flex flex-row">
|
||||
<!-- LIST -->
|
||||
<div class="flex -space-x-4 items-center " v-if="mountedPersArr.length > 0" >
|
||||
<div class="flex -space-x-4 items-center " v-if="mountedPersArr.length > 0">
|
||||
<!-- ITEM -->
|
||||
<div class="relative hover:-translate-y-2 duration-300 hover:z-10 shrink-0 "
|
||||
v-for="(item, index) in mountedPersArr" :key="index + '-' + item.name" ref="mountedPersonalities">
|
||||
v-for="(item, index) in mountedPersArr" :key="index + '-' + item.name"
|
||||
ref="mountedPersonalities">
|
||||
<div class="group items-center flex flex-row">
|
||||
<button @click.stop="onPersonalitySelected(item)">
|
||||
|
||||
@ -620,7 +621,7 @@
|
||||
</div>
|
||||
|
||||
|
||||
<YesNoDialog ref="yesNoDialog" />
|
||||
<YesNoDialog ref="yesNoDialog" class="z-20"/>
|
||||
<AddModelDialog ref="addmodeldialog" />
|
||||
<MessageBox ref="messageBox" />
|
||||
<Toast ref="toast" />
|
||||
@ -837,12 +838,13 @@ export default {
|
||||
if (this.isLoading) {
|
||||
this.$refs.toast.showToast("Loading... please wait", 4, false)
|
||||
}
|
||||
this.isLoading=true
|
||||
console.log('ppa',pers)
|
||||
this.isLoading = true
|
||||
console.log('ppa', pers)
|
||||
if (pers) {
|
||||
|
||||
if (pers.selected) {
|
||||
this.$refs.toast.showToast("Personality already selected", 4, true)
|
||||
this.isLoading = false
|
||||
return
|
||||
}
|
||||
|
||||
@ -868,7 +870,7 @@ export default {
|
||||
feather.replace()
|
||||
|
||||
})
|
||||
this.isLoading=false
|
||||
this.isLoading = false
|
||||
}
|
||||
|
||||
},
|
||||
@ -1158,7 +1160,7 @@ export default {
|
||||
|
||||
this.$refs.toast.showToast("Configuration changed successfully.", 4, true)
|
||||
this.settingsChanged = false
|
||||
this.save_configuration()
|
||||
//this.save_configuration()
|
||||
} else {
|
||||
|
||||
this.$refs.toast.showToast("Configuration change failed.", 4, false)
|
||||
@ -1367,12 +1369,14 @@ export default {
|
||||
|
||||
},
|
||||
async mountPersonality(pers) {
|
||||
this.isLoading=true
|
||||
this.isLoading = true
|
||||
console.log('mount pers', pers)
|
||||
if (!pers) { return }
|
||||
|
||||
if (this.configFile.personalities.includes(pers.personality.full_path)) {
|
||||
this.isLoading = false
|
||||
this.$refs.toast.showToast("Personality already mounted", 4, false)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@ -1394,11 +1398,11 @@ export default {
|
||||
pers.isMounted = false
|
||||
this.$refs.toast.showToast("Could not mount personality\nError: " + res.error, 4, false)
|
||||
}
|
||||
this.isLoading=false
|
||||
this.isLoading = false
|
||||
|
||||
},
|
||||
async unmountPersonality(pers) {
|
||||
this.isLoading=true
|
||||
this.isLoading = true
|
||||
if (!pers) { return }
|
||||
|
||||
const res = await this.unmount_personality(pers.personality || pers)
|
||||
@ -1443,7 +1447,7 @@ export default {
|
||||
this.$refs.toast.showToast("Could not unmount personality\nError: " + res.error, 4, false)
|
||||
}
|
||||
|
||||
this.isLoading=false
|
||||
this.isLoading = false
|
||||
},
|
||||
getMountedPersonalities() {
|
||||
|
||||
@ -1453,13 +1457,13 @@ export default {
|
||||
for (let i = 0; i < this.configFile.personalities.length; i++) {
|
||||
const full_path_item = this.configFile.personalities[i]
|
||||
const index = this.personalities.findIndex(item => item.full_path == full_path_item)
|
||||
console.log('index',index)
|
||||
console.log("i:",i)
|
||||
console.log('index', index)
|
||||
console.log("i:", i)
|
||||
const pers = this.personalities[index]
|
||||
if (pers) {
|
||||
mountedPersArr.push(pers)
|
||||
}
|
||||
else{
|
||||
else {
|
||||
mountedPersArr.push(this.personalities[this.personalities.findIndex(item => item.full_path == "english/generic/lollms")])
|
||||
}
|
||||
}
|
||||
@ -1468,14 +1472,14 @@ export default {
|
||||
//this.mountedPersArr = mountedPersArr
|
||||
console.log('getMountedPersonalities', mountedPersArr)
|
||||
console.log('fig', this.configFile.personality_category)
|
||||
nextTick(()=>{
|
||||
console.log('accc',this.$refs.mountedPersonalities)
|
||||
//this.$store.state.mountedPersonalities = this.$refs.mountedPersonalities
|
||||
nextTick(() => {
|
||||
console.log('accc', this.$refs.mountedPersonalities)
|
||||
//this.$store.state.mountedPersonalities = this.$refs.mountedPersonalities
|
||||
})
|
||||
|
||||
},
|
||||
onPersonalityMounted(persItem) {
|
||||
this.isLoading=true
|
||||
this.isLoading = true
|
||||
console.log('on sel ', persItem)
|
||||
|
||||
if (this.configFile.personalities.includes(persItem.full_path)) {
|
||||
@ -1495,7 +1499,7 @@ export default {
|
||||
|
||||
}
|
||||
|
||||
this.isLoading=true
|
||||
this.isLoading = false
|
||||
},
|
||||
personalityImgPlacehodler(event) {
|
||||
event.target.src = defaultPersonalityImgPlaceholder
|
||||
@ -1503,7 +1507,7 @@ export default {
|
||||
|
||||
|
||||
}, async mounted() {
|
||||
|
||||
|
||||
//this.$refs.mountedPersonalities
|
||||
this.isLoading = true
|
||||
nextTick(() => {
|
||||
@ -1550,12 +1554,11 @@ export default {
|
||||
this.ramUsage = await this.api_get_req("ram_usage")
|
||||
this.getMountedPersonalities()
|
||||
this.isMounted = true
|
||||
|
||||
|
||||
|
||||
},
|
||||
activated(){
|
||||
// console.log('accc',this.$refs.mountedPersonalities)
|
||||
// this.$store.state.mountedPersonalities = this.$refs.mountedPersonalities
|
||||
activated() {
|
||||
|
||||
},
|
||||
computed: {
|
||||
disk_available_space() {
|
||||
@ -1608,45 +1611,34 @@ export default {
|
||||
return defaultModelImgPlaceholder
|
||||
}
|
||||
},
|
||||
binding_name(){
|
||||
binding_name() {
|
||||
if (!this.isMounted) {
|
||||
return
|
||||
}
|
||||
const index =this.bindingsArr.findIndex(item=>item.folder === this.configFile.binding_name)
|
||||
if(index>-1){
|
||||
const index = this.bindingsArr.findIndex(item => item.folder === this.configFile.binding_name)
|
||||
if (index > -1) {
|
||||
return this.bindingsArr[index].name
|
||||
|
||||
}else{
|
||||
} else {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
active_pesonality(){
|
||||
active_pesonality() {
|
||||
if (!this.isMounted) {
|
||||
return
|
||||
}
|
||||
const index =this.personalities.findIndex(item => item.full_path ===this.configFile.personalities[this.configFile.active_personality_id])
|
||||
if (index>-1){
|
||||
const index = this.personalities.findIndex(item => item.full_path === this.configFile.personalities[this.configFile.active_personality_id])
|
||||
if (index > -1) {
|
||||
return this.personalities[index].name
|
||||
}else{
|
||||
} else {
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
// imgPersonality() {
|
||||
// if (!this.isMounted) {
|
||||
// return
|
||||
// }
|
||||
// try {
|
||||
// return this.$refs.personalitiesZoo[this.$refs.personalitiesZoo.findIndex(item => item.personality.folder == this.configFile.personality_folder)].$refs.imgElement.src
|
||||
// }
|
||||
// catch (error) {
|
||||
// return defaultPersonalityImgPlaceholder
|
||||
// }
|
||||
// },
|
||||
|
||||
|
||||
},
|
||||
@ -1711,8 +1703,8 @@ export default {
|
||||
})
|
||||
},
|
||||
settingsChanged(val) {
|
||||
|
||||
//this.$store.settingsChanged=val
|
||||
|
||||
this.$store.state.settingsChanged = val
|
||||
nextTick(() => {
|
||||
feather.replace()
|
||||
|
||||
@ -1725,7 +1717,23 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
}
|
||||
},
|
||||
async beforeRouteLeave(to) {
|
||||
// console.log('did settings?',this.settingsChanged)
|
||||
await this.$router.isReady()
|
||||
if (this.settingsChanged){
|
||||
const res = await this.$refs.yesNoDialog.askQuestion("You forgot to apply changes?\nYou need to apply changes before you leave, or else.",'Apply configuration','Cancel')
|
||||
if(res){
|
||||
this.applyConfiguration()
|
||||
|
||||
}
|
||||
|
||||
return false
|
||||
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user