mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2025-02-20 09:16:15 +00:00
updated
This commit is contained in:
parent
9327c49c98
commit
2c15c559a1
4
app.py
4
app.py
@ -610,6 +610,7 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
|||||||
return jsonify({"personality":self.personality.as_dict()})
|
return jsonify({"personality":self.personality.as_dict()})
|
||||||
|
|
||||||
def get_all_personalities(self):
|
def get_all_personalities(self):
|
||||||
|
ASCIIColors.yellow("Listing all personalities")
|
||||||
personalities_folder = self.lollms_paths.personalities_zoo_path
|
personalities_folder = self.lollms_paths.personalities_zoo_path
|
||||||
personalities = {}
|
personalities = {}
|
||||||
|
|
||||||
@ -1025,7 +1026,7 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
|||||||
try:
|
try:
|
||||||
models = self.binding.list_models(self.config)
|
models = self.binding.list_models(self.config)
|
||||||
index = models.index(self.config.model_name)
|
index = models.index(self.config.model_name)
|
||||||
ASCIIColors.yellow("Listing models")
|
ASCIIColors.yellow("Listing active models")
|
||||||
return jsonify({"model":models[index],"index":index})
|
return jsonify({"model":models[index],"index":index})
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
return jsonify(None)
|
return jsonify(None)
|
||||||
@ -1041,7 +1042,6 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
|||||||
category = request.args.get('category')
|
category = request.args.get('category')
|
||||||
if not category:
|
if not category:
|
||||||
return jsonify([])
|
return jsonify([])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
personalities_dir = self.lollms_paths.personalities_zoo_path/f'{category}' # replace with the actual path to the models folder
|
personalities_dir = self.lollms_paths.personalities_zoo_path/f'{category}' # replace with the actual path to the models folder
|
||||||
personalities = [f.stem for f in personalities_dir.iterdir() if f.is_dir() and not f.name.startswith(".")]
|
personalities = [f.stem for f in personalities_dir.iterdir() if f.is_dir() and not f.name.startswith(".")]
|
||||||
|
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">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>LoLLMS WebUI - Welcome</title>
|
<title>LoLLMS WebUI - Welcome</title>
|
||||||
<script type="module" crossorigin src="/assets/index-210a2834.js"></script>
|
<script type="module" crossorigin src="/assets/index-a5d4fd66.js"></script>
|
||||||
<link rel="stylesheet" href="/assets/index-5acc5bc6.css">
|
<link rel="stylesheet" href="/assets/index-5e4931f7.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
@ -87,9 +87,11 @@ import PersonalityEntry from './PersonalityEntry.vue'
|
|||||||
import Toast from './Toast.vue'
|
import Toast from './Toast.vue'
|
||||||
import UniversalForm from './UniversalForm.vue';
|
import UniversalForm from './UniversalForm.vue';
|
||||||
import feather from 'feather-icons'
|
import feather from 'feather-icons'
|
||||||
|
import {logObjectProperties} from "../main.js"
|
||||||
|
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { nextTick } from "vue";
|
import { nextTick } from "vue";
|
||||||
|
import markdownItAttrs from "markdown-it-attrs";
|
||||||
|
|
||||||
const bUrl = import.meta.env.VITE_LOLLMS_API_BASEURL
|
const bUrl = import.meta.env.VITE_LOLLMS_API_BASEURL
|
||||||
axios.defaults.baseURL = import.meta.env.VITE_LOLLMS_API_BASEURL
|
axios.defaults.baseURL = import.meta.env.VITE_LOLLMS_API_BASEURL
|
||||||
@ -239,17 +241,14 @@ export default {
|
|||||||
async onPersonalitySelected(pers) {
|
async onPersonalitySelected(pers) {
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
feather.replace()
|
feather.replace()
|
||||||
console.log('ppa', pers)
|
console.log('Selected personality : ', JSON.stringify(pers.personality))
|
||||||
if (pers) {
|
if (pers) {
|
||||||
|
|
||||||
if (pers.selected) {
|
if (pers.selected) {
|
||||||
this.$refs.toast.showToast("Personality already selected", 4, true)
|
this.$refs.toast.showToast("Personality already selected", 4, true)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (pers.isMounted) {
|
if (pers.isMounted) {
|
||||||
|
|
||||||
const res = await this.select_personality(pers)
|
const res = await this.select_personality(pers)
|
||||||
if (res) {
|
if (res) {
|
||||||
if (res.status) {
|
if (res.status) {
|
||||||
@ -389,14 +388,12 @@ export default {
|
|||||||
},
|
},
|
||||||
async select_personality(pers) {
|
async select_personality(pers) {
|
||||||
if (!pers) { return { 'status': false, 'error': 'no personality - select_personality' } }
|
if (!pers) { return { 'status': false, 'error': 'no personality - select_personality' } }
|
||||||
const id = this.configFile.personalities.findIndex(item => item === pers.full_path || item === pers.full_path+':'+pers.language)
|
const id = this.configFile.personalities.findIndex(item => item === pers.full_path || item.split(':')[0] === pers.full_path)
|
||||||
|
if(id>-1){
|
||||||
console.log('id', JSON.stringify(id))
|
console.log('Selecting personality with id:', JSON.stringify(id))
|
||||||
const obj = {
|
const obj = {
|
||||||
id: id
|
id: id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await axios.post('/select_personality', obj);
|
const res = await axios.post('/select_personality', obj);
|
||||||
|
|
||||||
@ -416,6 +413,12 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
console.log('Personalituy id is wrong')
|
||||||
|
this.$refs.toast.showToast("Personality id is wrong!", 4, false)
|
||||||
|
return { 'status': false, 'error': 'Personality id is wrong' }
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async mountPersonality(pers) {
|
async mountPersonality(pers) {
|
||||||
|
|
||||||
|
@ -200,9 +200,11 @@ export const store = createStore({
|
|||||||
// console.log('perrs listo',this.state.personalities)
|
// console.log('perrs listo',this.state.personalities)
|
||||||
for (let i = 0; i < this.state.config.personalities.length; i++) {
|
for (let i = 0; i < this.state.config.personalities.length; i++) {
|
||||||
const full_path_item = this.state.config.personalities[i]
|
const full_path_item = this.state.config.personalities[i]
|
||||||
const index = this.state.personalities.findIndex(item => item.full_path == full_path_item || item.full_path+':'+item.language == full_path_item)
|
|
||||||
|
|
||||||
|
const index = this.state.personalities.findIndex(item => item.full_path == full_path_item || item.full_path+':'+item.language == full_path_item)
|
||||||
|
if(index>=0){
|
||||||
const pers = this.state.personalities[index]
|
const pers = this.state.personalities[index]
|
||||||
|
console.log("Found personality : ", JSON.stringify(pers))
|
||||||
// console.log(`Personality : ${JSON.stringify(pers)}`)
|
// console.log(`Personality : ${JSON.stringify(pers)}`)
|
||||||
if (pers) {
|
if (pers) {
|
||||||
mountedPersArr.push(pers)
|
mountedPersArr.push(pers)
|
||||||
@ -211,6 +213,10 @@ export const store = createStore({
|
|||||||
mountedPersArr.push(this.state.personalities[this.state.personalities.findIndex(item => item.full_path == "generic/lollms")])
|
mountedPersArr.push(this.state.personalities[this.state.personalities.findIndex(item => item.full_path == "generic/lollms")])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
console.log("Couldn't load personality : ",full_path_item)
|
||||||
|
}
|
||||||
|
}
|
||||||
commit('setMountedPersArr', mountedPersArr);
|
commit('setMountedPersArr', mountedPersArr);
|
||||||
|
|
||||||
this.state.mountedPers = this.state.personalities[this.state.personalities.findIndex(item => item.full_path == this.state.config.personalities[this.state.config.active_personality_id] || item.full_path+':'+item.language ==this.state.config.personalities[this.state.config.active_personality_id])]
|
this.state.mountedPers = this.state.personalities[this.state.personalities.findIndex(item => item.full_path == this.state.config.personalities[this.state.config.active_personality_id] || item.full_path+':'+item.language ==this.state.config.personalities[this.state.config.active_personality_id])]
|
||||||
@ -395,14 +401,6 @@ export const store = createStore({
|
|||||||
this.state.refreshingModelsList=false;
|
this.state.refreshingModelsList=false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
fetchCustomModels({ commit }) {
|
|
||||||
axios.get('/list_models')
|
|
||||||
.then(response => {
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.log(error.message, 'fetchCustomModels');
|
|
||||||
});
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
async function api_get_req(endpoint) {
|
async function api_get_req(endpoint) {
|
||||||
@ -429,18 +427,17 @@ app.mixin({
|
|||||||
console.log("recovered config : ${}");
|
console.log("recovered config : ${}");
|
||||||
await this.$store.dispatch('getVersion');
|
await this.$store.dispatch('getVersion');
|
||||||
console.log("recovered version");
|
console.log("recovered version");
|
||||||
await this.$store.dispatch('refreshPersonalitiesArr')
|
|
||||||
|
|
||||||
this.$store.dispatch('refreshMountedPersonalities');
|
|
||||||
this.$store.dispatch('refreshBindings');
|
this.$store.dispatch('refreshBindings');
|
||||||
this.$store.dispatch('refreshModels');
|
|
||||||
|
|
||||||
this.$store.dispatch('refreshDiskUsage');
|
this.$store.dispatch('refreshDiskUsage');
|
||||||
this.$store.dispatch('refreshRamUsage');
|
this.$store.dispatch('refreshRamUsage');
|
||||||
this.$store.dispatch('refreshVramUsage');
|
this.$store.dispatch('refreshVramUsage');
|
||||||
this.$store.dispatch('refreshModelsZoo');
|
this.$store.dispatch('refreshModelsZoo');
|
||||||
this.$store.dispatch('refreshExtensionsZoo');
|
this.$store.dispatch('refreshExtensionsZoo');
|
||||||
|
this.$store.dispatch('refreshModels');
|
||||||
|
|
||||||
|
await this.$store.dispatch('refreshPersonalitiesArr')
|
||||||
|
this.$store.dispatch('refreshMountedPersonalities');
|
||||||
|
|
||||||
this.$store.state.ready = true
|
this.$store.state.ready = true
|
||||||
console.log("done loading data")
|
console.log("done loading data")
|
||||||
@ -451,7 +448,26 @@ app.mixin({
|
|||||||
beforeMount() {
|
beforeMount() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function logObjectProperties(obj) {
|
||||||
|
if (typeof obj !== 'object' || obj === null) {
|
||||||
|
console.log('Invalid object');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let logString = "Object parameters and values:\n";
|
||||||
|
|
||||||
|
for (const key in obj) {
|
||||||
|
if (Object.prototype.hasOwnProperty.call(obj, key) && typeof obj[key] !== 'function') {
|
||||||
|
logString += `${key}: ${obj[key]}\n`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(logString);
|
||||||
|
}
|
||||||
|
|
||||||
app.use(router)
|
app.use(router)
|
||||||
app.use(store)
|
app.use(store)
|
||||||
app.mount('#app')
|
app.mount('#app')
|
||||||
|
|
||||||
|
export{logObjectProperties}
|
@ -1971,7 +1971,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
async selectSortOption(index){
|
async selectSortOption(index){
|
||||||
this.$store.state.sort_type=index
|
this.$store.state.sort_type=index
|
||||||
this.$store.dispatch('refreshModelsZoo');
|
//this.$store.dispatch('refreshModelsZoo');
|
||||||
this.modelsFiltered = this.models
|
this.modelsFiltered = this.models
|
||||||
console.log(`Selected sorting:${index}`)
|
console.log(`Selected sorting:${index}`)
|
||||||
},
|
},
|
||||||
@ -2876,9 +2876,6 @@ export default {
|
|||||||
console.log("updating binding_name")
|
console.log("updating binding_name")
|
||||||
this.update_setting('binding_name', value, (res) => {
|
this.update_setting('binding_name', value, (res) => {
|
||||||
console.log("updated binding_name")
|
console.log("updated binding_name")
|
||||||
this.$store.dispatch('refreshModels');
|
|
||||||
|
|
||||||
|
|
||||||
const index = this.bindingsArr.findIndex(item => item.folder == value)
|
const index = this.bindingsArr.findIndex(item => item.folder == value)
|
||||||
const item = this.bindingsArr[index]
|
const item = this.bindingsArr[index]
|
||||||
if (item) {
|
if (item) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user