Added loads of functionalities

This commit is contained in:
Saifeddine ALOUI 2023-12-27 12:32:58 +01:00
parent ac5889c964
commit cfcb925f58
11 changed files with 192 additions and 128 deletions

View File

@ -51,6 +51,7 @@ if not PackageManager.check_package_installed("requests"):
if not PackageManager.check_package_installed("bs4"):
PackageManager.install_package("beautifulsoup4")
import requests
from flask_socketio import SocketIO
from bs4 import BeautifulSoup
@ -132,10 +133,10 @@ def parse_requirements_file(requirements_path):
class LoLLMsAPI(LollmsApplication):
def __init__(self, config:LOLLMSConfig, socketio, config_file_path:str, lollms_paths: LollmsPaths) -> None:
def __init__(self, config:LOLLMSConfig, socketio:SocketIO, config_file_path:str, lollms_paths: LollmsPaths) -> None:
self.socketio = socketio
super().__init__("Lollms_webui",config, lollms_paths, callback=self.process_chunk)
super().__init__("Lollms_webui",config, lollms_paths, callback=self.process_chunk, socketio=socketio)
self.busy = False
@ -1152,6 +1153,7 @@ class LoLLMsAPI(LollmsApplication):
else:
if output["text"].lower()=="lollms":
self.summoned = True
def scrape_and_save(self, url, file_path):
# Send a GET request to the URL
response = requests.get(url)

2
app.py
View File

@ -1116,7 +1116,7 @@ try:
per.model = self.model
except Exception as ex:
trace_exception(ex)
self.InfoMessage("It looks like you we couldn't load the model.\nThis can hapen when you don't have enough VRAM. Please restart the program.",duration=30)
self.InfoMessage(f"It looks like you we couldn't load the model.\nHere is the error message:\n{ex}",duration=30)
else:

@ -1 +1 @@
Subproject commit 26c1b62f04db6405b7d6ff5f495e70caeeff62be
Subproject commit 91093246d27c4c8ba98a718b8cae6ea0c8af6cfd

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
View File

@ -6,8 +6,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LoLLMS WebUI - Welcome</title>
<script type="module" crossorigin src="/assets/index-2ca0499e.js"></script>
<link rel="stylesheet" href="/assets/index-5d2d92a4.css">
<script type="module" crossorigin src="/assets/index-eb3c4aa9.js"></script>
<link rel="stylesheet" href="/assets/index-00b65516.css">
</head>
<body>
<div id="app"></div>

View File

@ -94,6 +94,8 @@
<p class="text-2xl animate-pulse mt-2 text-white">{{ loading_infos }} ...</p>
</div>
<UniversalForm ref="universalForm" class="z-20" />
<YesNoDialog ref="yesNoDialog" class="z-20" />
</header>
<body>
@ -107,6 +109,7 @@ import Toast from '../components/Toast.vue'
import MessageBox from "@/components/MessageBox.vue";
import ProgressBar from "@/components/ProgressBar.vue";
import UniversalForm from '../components/UniversalForm.vue';
import YesNoDialog from './YesNoDialog.vue';
import { RouterLink } from 'vue-router'
@ -139,6 +142,7 @@ export default {
MessageBox,
ProgressBar,
UniversalForm,
YesNoDialog
},
watch:{
isConnected(){
@ -170,6 +174,8 @@ export default {
this.$store.state.toast = this.$refs.toast
this.$store.state.messageBox = this.$refs.messageBox
this.$store.state.universalForm = this.$refs.universalForm
this.$store.state.yesNoDialog = this.$refs.yesNoDialog
this.sunIcon = document.querySelector(".sun");
this.moonIcon = document.querySelector(".moon");
this.userTheme = localStorage.getItem("theme");

View File

@ -24,6 +24,7 @@ export const store = createStore({
state () {
return {
// count: 0,
yesNoDialog:null,
universalForm:null,
toast:null,
messageBox:null,
@ -506,47 +507,100 @@ app.mixin({
this.$store.state.api_get_req = api_get_req
actionsExecuted = true;
console.log("Calling")
this.$store.state.loading_infos = "Loading Configuration"
this.$store.state.loading_progress = 10
try{
this.$store.state.loading_infos = "Loading Configuration"
this.$store.state.loading_progress = 10
await this.$store.dispatch('refreshConfig');
console.log("Config ready")
}
catch{
}
catch
await this.$store.dispatch('refreshConfig');
console.log("Config ready")
this.$store.state.loading_infos = "Loading Database"
this.$store.state.loading_progress = 20
await this.$store.dispatch('refreshDatabase');
this.$store.state.loading_infos = "Getting version"
this.$store.state.loading_progress = 30
await this.$store.dispatch('getVersion');
this.$store.state.loading_infos = "Getting Bindings list"
this.$store.state.loading_progress = 40
await this.$store.dispatch('refreshBindings');
await refreshHardwareUsage(this.$store);
this.$store.state.loading_infos = "Getting extensions zoo"
this.$store.state.loading_progress = 50
await this.$store.dispatch('refreshExtensionsZoo');
this.$store.state.loading_infos = "Getting mounted extensions"
this.$store.state.loading_progress = 60
await this.$store.dispatch('refreshmountedExtensions');
this.$store.state.loading_infos = "Getting personalities zoo"
this.$store.state.loading_progress = 70
await this.$store.dispatch('refreshPersonalitiesZoo')
this.$store.state.loading_infos = "Getting mounted personalities"
this.$store.state.loading_progress = 80
await this.$store.dispatch('refreshMountedPersonalities');
try{
this.$store.state.loading_infos = "Loading Database"
this.$store.state.loading_progress = 20
await this.$store.dispatch('refreshDatabase');
}
catch{
this.$store.state.loading_infos = "Getting models zoo"
this.$store.state.loading_progress = 90
await this.$store.dispatch('refreshModelsZoo');
this.$store.state.loading_infos = "Getting active models"
this.$store.state.loading_progress = 100
await this.$store.dispatch('refreshModels');
await this.$store.dispatch('refreshModelStatus');
}
try{
this.$store.state.loading_infos = "Getting version"
this.$store.state.loading_progress = 30
await this.$store.dispatch('getVersion');
}
catch{
}
try{
this.$store.state.loading_infos = "Getting Bindings list"
this.$store.state.loading_progress = 40
await this.$store.dispatch('refreshBindings');
}
catch{
}
try{
this.$store.state.loading_infos = "Getting Hardware usage"
await refreshHardwareUsage(this.$store);
}
catch{
}
try{
this.$store.state.loading_infos = "Getting extensions zoo"
this.$store.state.loading_progress = 50
await this.$store.dispatch('refreshExtensionsZoo');
}
catch{
}
try{
this.$store.state.loading_infos = "Getting mounted extensions"
this.$store.state.loading_progress = 60
await this.$store.dispatch('refreshmountedExtensions');
}
catch{
}
try{
this.$store.state.loading_infos = "Getting personalities zoo"
this.$store.state.loading_progress = 70
await this.$store.dispatch('refreshPersonalitiesZoo')
}
catch{
}
try{
this.$store.state.loading_infos = "Getting mounted personalities"
this.$store.state.loading_progress = 80
await this.$store.dispatch('refreshMountedPersonalities');
}
catch{
}
try{
this.$store.state.loading_infos = "Getting models zoo"
this.$store.state.loading_progress = 90
await this.$store.dispatch('refreshModelsZoo');
}
catch{
}
try{
this.$store.state.loading_infos = "Getting active models"
this.$store.state.loading_progress = 100
await this.$store.dispatch('refreshModels');
await this.$store.dispatch('refreshModelStatus');
}
catch{
}
this.$store.state.ready = true;
}

View File

@ -1226,6 +1226,11 @@ export default {
else if(notif.display_type==1){
this.$store.state.messageBox.showMessage(notif.content)
}
else if(notif.display_type==2){
this.$store.state.yesNoDialog.askQuestion(notif.content, 'Yes', 'Cancel').then(yesRes => {
socket.emit("yesNoRes",{yesRes:yesRes})
})
}
this.chime.play()
},
streamMessageContent(msgObj) {

View File

@ -1683,7 +1683,6 @@
</div>
</div>
</div>
<YesNoDialog ref="yesNoDialog" class="z-20" />
<AddModelDialog ref="addmodeldialog" />
<ChoiceDialog class="z-20"
:show="variantSelectionDialogVisible"
@ -1779,7 +1778,6 @@ import filesize from '../plugins/filesize'
import axios from "axios";
import feather from 'feather-icons'
import { nextTick, TransitionGroup } from 'vue'
import YesNoDialog from "@/components/YesNoDialog.vue";
import ModelEntry from '@/components/ModelEntry.vue';
import PersonalityViewer from '@/components/PersonalityViewer.vue';
import PersonalityEntry from "@/components/PersonalityEntry.vue";
@ -1807,7 +1805,6 @@ axios.defaults.baseURL = import.meta.env.VITE_LOLLMS_API_BASEURL
export default {
components: {
AddModelDialog,
YesNoDialog,
ModelEntry,
// eslint-disable-next-line vue/no-unused-components
PersonalityViewer,
@ -2552,7 +2549,7 @@ export default {
},
onUninstall(model_object) {
this.$refs.yesNoDialog.askQuestion("Are you sure you want to delete this model?\n [" + model_object.name + "]", 'Yes', 'Cancel').then(yesRes => {
this.$store.state.yesNoDialog.askQuestion("Are you sure you want to delete this model?\n [" + model_object.name + "]", 'Yes', 'Cancel').then(yesRes => {
if (yesRes) {
console.log("uninstalling model...")
const progressListener = (response) => {
@ -2623,7 +2620,7 @@ export default {
this.isLoading = true
if (binding_object.disclaimer){
this.$refs.yesNoDialog.askQuestion(binding_object.disclaimer, 'Proceed', 'Cancel')
this.$store.state.yesNoDialog.askQuestion(binding_object.disclaimer, 'Proceed', 'Cancel')
}
axios.post('/install_binding', { name: binding_object.binding.folder }).then((res) => {
@ -3200,7 +3197,7 @@ export default {
},
reset_configuration() {
this.$refs.yesNoDialog.askQuestion("Are you sure?\nThis will delete all your configurations and get back to default configuration.").then(response => {
this.$store.state.yesNoDialog.askQuestion("Are you sure?\nThis will delete all your configurations and get back to default configuration.").then(response => {
if (response) {
// User clicked Yes
axios.post('/reset_settings', {})
@ -4237,7 +4234,7 @@ export default {
// console.log('did settings?',this.settingsChanged)
await this.$router.isReady()
if (this.settingsChanged) {
const res = await this.$refs.yesNoDialog.askQuestion("Did You forget to apply changes?\nYou need to apply changes before you leave, or else.", 'Apply configuration', 'Cancel')
const res = await this.$store.state.yesNoDialog.askQuestion("Did You forget to apply changes?\nYou need to apply changes before you leave, or else.", 'Apply configuration', 'Cancel')
if (res) {
this.applyConfiguration()

@ -1 +1 @@
Subproject commit 5f12891d580f71b2fa7613897f2e545c5c7804d4
Subproject commit c98cb1098bd3d05049f557563b37fdb1ceebe8cc