renamed and some stuff

This commit is contained in:
AndzejsP
2023-06-17 16:55:45 +03:00
parent 0970456793
commit ad2229ccd7
3 changed files with 71 additions and 72 deletions

View File

@ -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() {

View File

@ -1,5 +1,4 @@
<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">
@ -7,7 +6,7 @@
<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)">
@ -36,7 +35,6 @@
</div> </div>
</div> </div>
</template> </template>
<script> <script>
@ -46,37 +44,37 @@ 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:{ methods: {
async constructor(){ async constructor() {
this.configFile = await this.api_get_req("get_config") this.configFile = await this.api_get_req("get_config")
let personality_path_infos = await this.api_get_req("get_current_personality_path_infos") 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_language = personality_path_infos["personality_language"]
this.configFile.personality_category = personality_path_infos["personality_category"] this.configFile.personality_category = personality_path_infos["personality_category"]
this.configFile.personality_folder = personality_path_infos["personality_name"] this.configFile.personality_folder = personality_path_infos["personality_name"]
await this.getPersonalitiesArr().then(()=>{ await this.getPersonalitiesArr().then(() => {
this.getMountedPersonalities() this.getMountedPersonalities()
this.$forceUpdate() this.$forceUpdate()
}) })
@ -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) {
@ -207,7 +205,7 @@ export default {
}) })
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")])
} }
} }

View File

@ -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() {