mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2025-06-11 12:01:34 +00:00
renamed and some stuff
This commit is contained in:
parent
0970456793
commit
ad2229ccd7
@ -89,7 +89,7 @@
|
|||||||
<!-- CHAT BOX -->
|
<!-- CHAT BOX -->
|
||||||
<div class="flex flex-row flex-grow items-center gap-2 ">
|
<div class="flex flex-row flex-grow items-center gap-2 ">
|
||||||
<!-- <div class="w-24">
|
<!-- <div class="w-24">
|
||||||
<MountedPersonalitiesComponent />
|
<MountedPersonalities />
|
||||||
|
|
||||||
</div> -->
|
</div> -->
|
||||||
|
|
||||||
@ -166,15 +166,15 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script setup>
|
<!-- <script setup>
|
||||||
import MountedPersonalitiesComponent from './MountedPersonalitiesComponent.vue'
|
import MountedPersonalitiesComponent from './MountedPersonalitiesComponent.vue'
|
||||||
|
|
||||||
</script>
|
</script> -->
|
||||||
<script>
|
<script>
|
||||||
import { nextTick, TransitionGroup } from 'vue'
|
import { nextTick, TransitionGroup } from 'vue'
|
||||||
import feather from 'feather-icons'
|
import feather from 'feather-icons'
|
||||||
import filesize from '../plugins/filesize'
|
import filesize from '../plugins/filesize'
|
||||||
|
import MountedPersonalities from './MountedPersonalities.vue'
|
||||||
export default {
|
export default {
|
||||||
name: 'ChatBox',
|
name: 'ChatBox',
|
||||||
emits: ["messageSentEvent", "stopGenerating"],
|
emits: ["messageSentEvent", "stopGenerating"],
|
||||||
@ -183,9 +183,9 @@ export default {
|
|||||||
loading: false
|
loading: false
|
||||||
|
|
||||||
},
|
},
|
||||||
// components: {
|
components: {
|
||||||
// //MountedPersonalitiesComponent
|
MountedPersonalities
|
||||||
// },
|
},
|
||||||
setup() {
|
setup() {
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,42 +1,40 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<!-- LIST OF MOUNTED PERSONALITIES -->
|
||||||
<!-- LIST OF MOUNTED PERSONALITIES -->
|
<div
|
||||||
<div
|
class=" text-base font-semibold cursor-pointer select-none items-center flex flex-row overflow-visible overflow-x-auto scrollbar-thin scrollbar-track-bg-light scrollbar-thumb-bg-light-tone hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark dark:scrollbar-thumb-bg-dark-tone dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary">
|
||||||
class=" text-base font-semibold cursor-pointer select-none items-center flex flex-row overflow-visible overflow-x-auto scrollbar-thin scrollbar-track-bg-light scrollbar-thumb-bg-light-tone hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark dark:scrollbar-thumb-bg-dark-tone dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary">
|
<!-- LIST -->
|
||||||
<!-- LIST -->
|
<div class="flex -space-x-4 items-center ">
|
||||||
<div class="flex -space-x-4 items-center ">
|
<!-- ITEM -->
|
||||||
<!-- ITEM -->
|
<div class="relative hover:-translate-y-2 duration-300 hover:z-10 shrink-0 "
|
||||||
<div class="relative hover:-translate-y-2 duration-300 hover:z-10 shrink-0 "
|
v-for="(item, index) in mountedPersArr" :key="index + '-' + item.name">
|
||||||
v-for="(item, index) in mountedPersArr" :key="index + '-' + item.name" >
|
<div class="group items-center flex flex-row">
|
||||||
<div class="group items-center flex flex-row">
|
<button @click.stop="onPersonalitySelected(item)">
|
||||||
<button @click.stop="onPersonalitySelected(item)">
|
|
||||||
|
|
||||||
<img :src="bUrl + item.avatar" @error="personalityImgPlacehodler"
|
<img :src="bUrl + item.avatar" @error="personalityImgPlacehodler"
|
||||||
class="w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 group-hover:border-secondary "
|
class="w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 group-hover:border-secondary "
|
||||||
:class="configFile.active_personality_id == configFile.personalities.indexOf(item.full_path) ? 'border-secondary' : 'border-transparent z-0'"
|
:class="configFile.active_personality_id == configFile.personalities.indexOf(item.full_path) ? 'border-secondary' : 'border-transparent z-0'"
|
||||||
:title="item.name">
|
:title="item.name">
|
||||||
</button>
|
</button>
|
||||||
<button @click.stop="onPersonalityMounted(item)">
|
<button @click.stop="onPersonalityMounted(item)">
|
||||||
|
|
||||||
<span
|
<span
|
||||||
class="hidden group-hover:block top-0 left-7 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2 border-transparent"
|
class="hidden group-hover:block top-0 left-7 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2 border-transparent"
|
||||||
title="Unmount personality">
|
title="Unmount personality">
|
||||||
<!-- UNMOUNT BUTTON -->
|
<!-- UNMOUNT BUTTON -->
|
||||||
<svg aria-hidden="true" class="w-4 h-4 text-red-600 hover:text-red-500 " fill="currentColor"
|
<svg aria-hidden="true" class="w-4 h-4 text-red-600 hover:text-red-500 " fill="currentColor"
|
||||||
viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
||||||
<path fill-rule="evenodd"
|
<path fill-rule="evenodd"
|
||||||
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
|
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
|
||||||
clip-rule="evenodd"></path>
|
clip-rule="evenodd"></path>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -46,40 +44,40 @@ import defaultPersonalityImgPlaceholder from "../assets/logo.svg"
|
|||||||
const bUrl = import.meta.env.VITE_GPT4ALL_API_BASEURL
|
const bUrl = import.meta.env.VITE_GPT4ALL_API_BASEURL
|
||||||
axios.defaults.baseURL = import.meta.env.VITE_GPT4ALL_API_BASEURL
|
axios.defaults.baseURL = import.meta.env.VITE_GPT4ALL_API_BASEURL
|
||||||
export default {
|
export default {
|
||||||
name: 'MountedPersonalitiesComponent',
|
name: 'MountedPersonalities',
|
||||||
setup() {
|
setup() {
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
configFile: {},
|
configFile: {},
|
||||||
mountedPersArr:[],
|
mountedPersArr: [],
|
||||||
personalities:[],
|
personalities: [],
|
||||||
bUrl:bUrl,
|
bUrl: bUrl,
|
||||||
isMounted:false
|
isMounted: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async mounted(){
|
async mounted() {
|
||||||
await this.constructor()
|
await this.constructor()
|
||||||
this.isMounted=true
|
this.isMounted = true
|
||||||
},
|
},
|
||||||
async activated(){
|
async activated() {
|
||||||
if(this.isMounted){
|
if (this.isMounted) {
|
||||||
await this.constructor()
|
await this.constructor()
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
|
||||||
methods:{
|
|
||||||
async constructor(){
|
|
||||||
this.configFile = await this.api_get_req("get_config")
|
|
||||||
let personality_path_infos = await this.api_get_req("get_current_personality_path_infos")
|
|
||||||
this.configFile.personality_language = personality_path_infos["personality_language"]
|
|
||||||
this.configFile.personality_category = personality_path_infos["personality_category"]
|
|
||||||
this.configFile.personality_folder = personality_path_infos["personality_name"]
|
|
||||||
|
|
||||||
await this.getPersonalitiesArr().then(()=>{
|
},
|
||||||
this.getMountedPersonalities()
|
methods: {
|
||||||
this.$forceUpdate()
|
async constructor() {
|
||||||
})
|
this.configFile = await this.api_get_req("get_config")
|
||||||
|
let personality_path_infos = await this.api_get_req("get_current_personality_path_infos")
|
||||||
|
this.configFile.personality_language = personality_path_infos["personality_language"]
|
||||||
|
this.configFile.personality_category = personality_path_infos["personality_category"]
|
||||||
|
this.configFile.personality_folder = personality_path_infos["personality_name"]
|
||||||
|
|
||||||
|
await this.getPersonalitiesArr().then(() => {
|
||||||
|
this.getMountedPersonalities()
|
||||||
|
this.$forceUpdate()
|
||||||
|
})
|
||||||
},
|
},
|
||||||
async api_get_req(endpoint) {
|
async api_get_req(endpoint) {
|
||||||
try {
|
try {
|
||||||
@ -169,15 +167,15 @@ export default {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isLoading=true
|
this.isLoading = true
|
||||||
},
|
},
|
||||||
async onPersonalitySelected(pers) {
|
async onPersonalitySelected(pers) {
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
if (this.isLoading) {
|
if (this.isLoading) {
|
||||||
this.$refs.toast.showToast("Loading... please wait", 4, false)
|
this.$refs.toast.showToast("Loading... please wait", 4, false)
|
||||||
}
|
}
|
||||||
this.isLoading=true
|
this.isLoading = true
|
||||||
console.log('ppa',pers)
|
console.log('ppa', pers)
|
||||||
if (pers) {
|
if (pers) {
|
||||||
|
|
||||||
if (pers.selected) {
|
if (pers.selected) {
|
||||||
@ -204,10 +202,10 @@ export default {
|
|||||||
|
|
||||||
|
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
this.isLoading=false
|
this.isLoading = false
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -290,7 +288,7 @@ export default {
|
|||||||
|
|
||||||
},
|
},
|
||||||
async mountPersonality(pers) {
|
async mountPersonality(pers) {
|
||||||
this.isLoading=true
|
this.isLoading = true
|
||||||
console.log('mount pers', pers)
|
console.log('mount pers', pers)
|
||||||
if (!pers) { return }
|
if (!pers) { return }
|
||||||
|
|
||||||
@ -317,11 +315,11 @@ export default {
|
|||||||
pers.isMounted = false
|
pers.isMounted = false
|
||||||
this.$refs.toast.showToast("Could not mount personality\nError: " + res.error, 4, false)
|
this.$refs.toast.showToast("Could not mount personality\nError: " + res.error, 4, false)
|
||||||
}
|
}
|
||||||
this.isLoading=false
|
this.isLoading = false
|
||||||
|
|
||||||
},
|
},
|
||||||
async unmountPersonality(pers) {
|
async unmountPersonality(pers) {
|
||||||
this.isLoading=true
|
this.isLoading = true
|
||||||
if (!pers) { return }
|
if (!pers) { return }
|
||||||
|
|
||||||
const res = await this.unmount_personality(pers.personality || pers)
|
const res = await this.unmount_personality(pers.personality || pers)
|
||||||
@ -366,7 +364,7 @@ export default {
|
|||||||
this.$refs.toast.showToast("Could not unmount personality\nError: " + res.error, 4, false)
|
this.$refs.toast.showToast("Could not unmount personality\nError: " + res.error, 4, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isLoading=false
|
this.isLoading = false
|
||||||
},
|
},
|
||||||
getMountedPersonalities() {
|
getMountedPersonalities() {
|
||||||
|
|
||||||
@ -381,7 +379,7 @@ export default {
|
|||||||
if (pers) {
|
if (pers) {
|
||||||
mountedPersArr.push(pers)
|
mountedPersArr.push(pers)
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
mountedPersArr.push(this.personalities[this.personalities.findIndex(item => item.full_path == "english/generic/lollms")])
|
mountedPersArr.push(this.personalities[this.personalities.findIndex(item => item.full_path == "english/generic/lollms")])
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -198,6 +198,7 @@
|
|||||||
|
|
||||||
<Toast ref="toast">
|
<Toast ref="toast">
|
||||||
</Toast>
|
</Toast>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
@ -1196,7 +1197,7 @@ export default {
|
|||||||
|
|
||||||
},
|
},
|
||||||
mounted(){
|
mounted(){
|
||||||
//console.log('chatbox mnt',this.$refs)
|
console.log('chatbox mnt',this.$refs)
|
||||||
},
|
},
|
||||||
async activated() {
|
async activated() {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user