This commit is contained in:
Saifeddine ALOUI 2023-09-02 20:37:06 +02:00
parent c3d4e98c9f
commit bcc7854ed4
6 changed files with 84 additions and 49 deletions

8
app.py
View File

@ -14,7 +14,7 @@ __github__ = "https://github.com/ParisNeo/lollms-webui"
__copyright__ = "Copyright 2023, "
__license__ = "Apache 2.0"
__version__ ="6.0"
__version__ ="6.1"
main_repo = "https://github.com/ParisNeo/lollms-webui.git"
import os
@ -618,7 +618,7 @@ class LoLLMsWebUI(LoLLMsAPPI):
continue
try:
scripts_path = personality_folder / 'scripts'
personality_info['has_scripts'] = scripts_path.is_dir()
personality_info['has_scripts'] = scripts_path.exists()
with open(config_path) as config_file:
config_data = yaml.load(config_file, Loader=yaml.FullLoader)
personality_info['name'] = config_data.get('name',"No Name")
@ -638,6 +638,7 @@ class LoLLMsWebUI(LoLLMsAPPI):
png_logo_path = assets_path / 'logo.png'
jpg_logo_path = assets_path / 'logo.jpg'
jpeg_logo_path = assets_path / 'logo.jpeg'
svg_logo_path = assets_path / 'logo.svg'
bmp_logo_path = assets_path / 'logo.bmp'
gif_logo_path_ = real_assets_path / 'logo.gif'
@ -645,6 +646,7 @@ class LoLLMsWebUI(LoLLMsAPPI):
png_logo_path_ = real_assets_path / 'logo.png'
jpg_logo_path_ = real_assets_path / 'logo.jpg'
jpeg_logo_path_ = real_assets_path / 'logo.jpeg'
svg_logo_path_ = real_assets_path / 'logo.svg'
bmp_logo_path_ = real_assets_path / 'logo.bmp'
if languages_path.exists():
@ -664,6 +666,8 @@ class LoLLMsWebUI(LoLLMsAPPI):
personality_info['avatar'] = str(jpg_logo_path).replace("\\","/")
elif jpeg_logo_path_.exists():
personality_info['avatar'] = str(jpeg_logo_path).replace("\\","/")
elif svg_logo_path_.exists():
personality_info['avatar'] = str(svg_logo_path).replace("\\","/")
elif bmp_logo_path_.exists():
personality_info['avatar'] = str(bmp_logo_path).replace("\\","/")
else:

View File

@ -112,7 +112,7 @@ export default {
if(this.isMounted){
main_menu.push({name:"remount", icon: "feather:refresh-ccw", is_file:false, value:this.reMount})
}
if(this.selected && this.has_scripts){
if(this.selected && this.personality.has_scripts){
main_menu.push({name:"settings", icon: "feather:settings", is_file:false, value:this.toggleSettings})
}
return main_menu

View File

@ -15,6 +15,8 @@ export const store = createStore({
return {
// count: 0,
ready:false,
version : "unknown",
refreshingModelsList:false,
settingsChanged:false,
isConnected: false, // Add the isConnected property
config:null,
@ -111,7 +113,12 @@ export const store = createStore({
},
},
actions: {
async getVersion(){
let res = await axios.get('/get_lollms_webui_version', {});
if (res) {
this.state.version = res.data.version
}
},
async refreshConfig({ commit }) {
console.log("Fetching configuration");
try {
@ -267,6 +274,7 @@ export const store = createStore({
},
async refreshModelsZoo({ commit }) {
console.log("Refreshing models zoo")
this.state.refreshingModelsList=true;
axios.get('/get_available_models')
.then(response => {
console.log("found models")
@ -308,18 +316,16 @@ export const store = createStore({
});
commit('setModelsZoo', models_zoo)
console.log("Models zoo loaded successfully")
this.state.refreshingModelsList=false;
})
.catch(error => {
console.log(error.message, 'fetchModels');
this.state.refreshingModelsList=false;
});
},
fetchCustomModels({ commit }) {
axios.get('/list_models')
.then(response => {
})
.catch(error => {
console.log(error.message, 'fetchCustomModels');
@ -347,9 +353,12 @@ app.mixin({
if (!actionsExecuted) {
actionsExecuted = true;
console.log("Calling")
this.$store.dispatch('refreshConfig').then(() => {
console.log("recovered config")
this.$store.dispatch('refreshPersonalitiesArr').then(() => {
this.$store.dispatch('refreshConfig').then(async () => {
console.log("recovered config");
await this.$store.dispatch('getVersion');
console.log("recovered version");
await this.$store.dispatch('refreshPersonalitiesArr')
this.$store.dispatch('refreshMountedPersonalities');
this.$store.dispatch('refreshBindings');
this.$store.dispatch('refreshModels');
@ -363,8 +372,6 @@ app.mixin({
this.$store.state.ready = true
console.log("done loading data")
});
});
}

View File

@ -10,7 +10,7 @@
<img class="w-24 animate-bounce" title="LoLLMS WebUI" src="@/assets/logo.png" alt="Logo">
<div class="flex flex-col items-start">
<p class="text-2xl ">Lord of Large Language Models v {{ version }} </p>
<p class="text-2xl ">Lord of Large Language Models v {{ store.state.version }} </p>
<p class="text-gray-400 text-base">One tool to rule them all</p>
<p class="text-gray-400 text-base">by ParisNeo</p>
@ -385,7 +385,6 @@ export default {
SENDER_TYPES_AI : 1, // Sent by ai
SENDER_TYPES_SYSTEM : 2, // Sent by athe system
},
version : "5.0",
list : [], // Discussion list
tempList : [], // Copy of Discussion list (used for keeping the original list during filtering discussions/searching action)
currentDiscussion : {}, // Current/selected discussion id
@ -1547,14 +1546,6 @@ export default {
},
async created() {
this.$store.state.isConnected=false;
axios.get('/get_lollms_webui_version', {}).then((res) => {
if (res) {
this.version = res.data.version
}
}).catch((error) => {
console.log("Error: Could not get generation status", error);
});
this.$nextTick(() => {
feather.replace();
});
@ -1725,6 +1716,7 @@ import socket from '@/services/websocket.js'
import { onMounted } from 'vue'
import { initFlowbite } from 'flowbite'
import { store } from '../main'
// initialize components based on data attribute selectors
onMounted(() => {

View File

@ -1,12 +1,13 @@
<template>
<div class="container mx-auto p-4 bg-bg-light-tone dark:bg-bg-dark-tone shadow-lg">
<div>
<Card :disableHoverAnimation="true" :disableFocus="true">
<h2 class="text-2xl font-bold mb-2">About Lord of large Language Models</h2>
<p class="mb-4"> Lollms version {{ lollmsVersion }}</p>
<p class="mb-4"> Lollms version {{ version }}</p>
<p>Discord link: <a class="text-blue-500 hover:text-blue-400 duration-150" href="https://discord.gg/C73K7hjy">https://discord.gg/C73K7hjy</a></p>
</div>
</Card>
<div class="mb-8 overflow-y-auto max-h-96 scrollbar">
<Card :disableHoverAnimation="true" :disableFocus="true">
<h2 class="text-2xl font-bold mb-2">Frequently Asked Questions</h2>
<ul class="list-disc pl-4">
<li v-for="(faq, index) in faqs" :key="index">
@ -14,26 +15,32 @@
<p class="mb-4" v-html="parseMultiline(faq.answer)"></p>
</li>
</ul>
</div>
<div>
</Card>
<Card :disableHoverAnimation="true" :disableFocus="true">
<h2 class="text-2xl font-bold mb-2">Contact Us</h2>
<p class="mb-4">If you have any further questions or need assistance, feel free to reach out to me.</p>
<p>Discord link: <a class="text-blue-500 hover:text-blue-400 duration-150" href="https://discord.gg/C73K7hjy">https://discord.gg/C73K7hjy</a></p>
</div>
<div class="mt-8">
</Card>
<Card :disableHoverAnimation="true" :disableFocus="true">
<h2 class="text-2xl font-bold mb-2">Credits</h2>
<p class="mb-4">This project is developed by <span class="font-bold">ParisNeo</span> With help from the community.</p>
<p class="mb-4"><span class="font-bold"><a href="https://github.com/ParisNeo/lollms-webui/graphs/contributors">Check out the full list of developers here and show them some love.</a></span></p>
<p>Check out the project on <a class="text-blue-500 hover:text-blue-400 duration-150" :href="githubLink" target="_blank" rel="noopener noreferrer">GitHub</a>.</p>
</div>
</Card>
</div>
</template>
<script>
import axios from 'axios';
import Papa from 'papaparse'; // Import the Papa Parse library for CSV parsing
import Card from "@/components/Card.vue"
import { store } from '../main';
export default {
components:{
Card
}
,
name: 'HelpPage',
data() {
return {
@ -44,13 +51,14 @@
},
mounted() {
this.loadFAQs(); // Call the method to load FAQs when the component is mounted
this.fetchLollmsVersion().then((val)=>{this.lollmsVersion=val});
},
computed: {
// This will be triggered whenever lollmsVersion is updated
// but it will not be directly used in the template.
async fetchLollmsVersion() {
return await axios.get("/get_lollms_version");
version: {
get(){
return this.$store.version
}
},
},
async created() {

View File

@ -555,7 +555,7 @@
</div>
<div :class="{ 'hidden': minconf_collapsed }" class="flex flex-col mb-2 px-3 pb-0">
<div class="flex flex-col mb-2 px-3 pb-2">
<Card title="General" is_subcard="True" class="pb-2 m-2">
<Card title="General" :is_subcard="true" class="pb-2 m-2">
<table class="expand-to-fit bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
<tr>
<td style="min-width: 200px;">
@ -678,7 +678,7 @@
</tr>
</table>
</Card>
<Card title="User" is_subcard="True" class="pb-2 m-2">
<Card title="User" :is_subcard="true" class="pb-2 m-2">
<table class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
<tr>
<td style="min-width: 200px;">
@ -742,7 +742,7 @@
</tr>
</table>
</Card>
<Card title="Files Vectorization" is_subcard="True" class="pb-2 m-2">
<Card title="Files Vectorization" :is_subcard="true" class="pb-2 m-2">
<table class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
<tr>
<td style="min-width: 200px;">
@ -896,7 +896,7 @@
</table>
</Card>
<Card title="Audio" is_subcard="True" class="pb-2 m-2">
<Card title="Audio" :is_subcard="true" class="pb-2 m-2">
<table class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
<tr>
<td style="min-width: 200px;">
@ -1123,6 +1123,21 @@
</h3>
</div>
</div>
<!-- SPINNER -->
<div v-if="isModelsLoading" role="status">
<p>{{ loading_text }}</p>
<svg aria-hidden="true" class="w-6 h-6 animate-spin fill-secondary" viewBox="0 0 100 101"
fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
fill="currentColor" />
<path
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
fill="currentFill" />
</svg>
<span class="sr-only">Loading...</span>
</div>
</div>
</button>
</div>
@ -2043,29 +2058,27 @@ export default {
await new Promise((resolve) => setTimeout(resolve, 100)); // Wait for 100ms
}
if (this.configFile.model_name) {
this.isModelSelected = true
}
this.persCatgArr = await this.api_get_req("list_personalities_categories")
this.persArr = await this.api_get_req("list_personalities?category="+this.configFile.personality_category)
this.bindingsArr.sort((a, b) => a.name.localeCompare(b.name))
this.modelsArr.sort()
this.persCatgArr.sort()
this.persArr.sort()
// this.bindingsArr.sort((a, b) => a.name.localeCompare(b.name))
// this.modelsArr.sort()
// this.persCatgArr.sort()
// this.persArr.sort()
//await this.getPersonalitiesArr()
this.personality_category = this.configFile.personality_category
this.personalitiesFiltered = this.personalities.filter((item) => item.category === this.configFile.personality_category)
this.personalitiesFiltered.sort()
// this.personalitiesFiltered.sort()
//mountedPersArr
this.modelsFiltered = this.models
//this.bindings = await this.api_get_req("list_bindings")
this.bindingsArr.sort((a, b) => a.name.localeCompare(b.name))
// this.bindingsArr.sort((a, b) => a.name.localeCompare(b.name))
this.isLoading = false
this.isMounted = true
@ -2581,7 +2594,7 @@ export default {
if (res) {
if(res.status){
this.$refs.toast.showToast("Upgraded to GPU", 4, true)
this.configFile.enable_gpu=True
this.configFile.enable_gpu=true
}
else{
this.$refs.toast.showToast("Could not upgrade to GPU. Endpoint error: " + res.error, 4, false)
@ -2996,6 +3009,8 @@ export default {
return
}
const searchTerm = this.searchModel.toLowerCase()
this.isModelsLoading = true;
console.log("filtering models")
const seachedModels = this.models.filter((item) => {
if (item.title && item.title.toLowerCase().includes(searchTerm) || item.description && item.description.toLowerCase().includes(searchTerm) || item.path && item.path.toLowerCase().includes(searchTerm)) {
@ -3003,6 +3018,7 @@ export default {
}
})
this.isModelsLoading=false;
@ -3259,6 +3275,14 @@ export default {
}
},
computed: {
isModelsLoading:{
get() {
return this.$store.state.isModelsLoading;
},
set(value) {
this.$store.state.isModelsLoading = value;
}
},
audio_out_voice:{
get() {
return this.$store.state.config.audio_out_voice;