mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2025-04-15 14:46:34 +00:00
Upgraded ui
This commit is contained in:
parent
b910d254e7
commit
1b3f0601a8
98
app.py
98
app.py
@ -511,6 +511,39 @@ try:
|
||||
self.add_endpoint(
|
||||
"/open_file", "open_file", self.open_file, methods=["GET"]
|
||||
)
|
||||
|
||||
self.add_endpoint(
|
||||
"/update_binding_settings", "update_binding_settings", self.update_binding_settings, methods=["GET"]
|
||||
)
|
||||
|
||||
|
||||
def update_binding_settings(self):
|
||||
if self.binding:
|
||||
self.binding.settings_updated()
|
||||
ASCIIColors.green("Binding setting updated successfully")
|
||||
return jsonify({"status":True})
|
||||
else:
|
||||
return jsonify({"status":False, 'error':"no binding found"})
|
||||
|
||||
def reload_binding(self, data):
|
||||
print(f"Roloading binding selected : {data['binding_name']}")
|
||||
self.config["binding_name"]=data['binding_name']
|
||||
try:
|
||||
if self.binding:
|
||||
self.binding.destroy_model()
|
||||
self.binding = None
|
||||
self.model = None
|
||||
for per in self.mounted_personalities:
|
||||
per.model = None
|
||||
gc.collect()
|
||||
self.binding = BindingBuilder().build_binding(self.config, self.lollms_paths, InstallOption.INSTALL_IF_NECESSARY, lollmsCom=self)
|
||||
self.model = None
|
||||
self.config.save_config()
|
||||
ASCIIColors.green("Binding loaded successfully")
|
||||
except Exception as ex:
|
||||
ASCIIColors.error(f"Couldn't build binding: [{ex}]")
|
||||
trace_exception(ex)
|
||||
return jsonify({"status":False, 'error':str(ex)})
|
||||
|
||||
def get_model_status(self):
|
||||
return jsonify({"status":self.model is not None})
|
||||
@ -1764,17 +1797,9 @@ try:
|
||||
return jsonify({'update_availability':False})
|
||||
|
||||
def restart_program(self):
|
||||
ASCIIColors.info("")
|
||||
ASCIIColors.info("")
|
||||
ASCIIColors.info("")
|
||||
ASCIIColors.info(" ╔══════════════════════════════════════════════════╗")
|
||||
ASCIIColors.info(" ║ Restarting backend ║")
|
||||
ASCIIColors.info(" ╚══════════════════════════════════════════════════╝")
|
||||
ASCIIColors.info("")
|
||||
ASCIIColors.info("")
|
||||
ASCIIColors.info("")
|
||||
socketio.reboot=True
|
||||
self.socketio.stop()
|
||||
run_restart_script(self.args)
|
||||
self.socketio.sleep(1)
|
||||
|
||||
|
||||
def update_software(self):
|
||||
@ -1833,46 +1858,6 @@ try:
|
||||
version = __version__
|
||||
ASCIIColors.yellow("Lollms webui version : "+ version)
|
||||
return jsonify({"version":version})
|
||||
|
||||
|
||||
def reload_binding(self):
|
||||
try:
|
||||
data = request.get_json()
|
||||
# Further processing of the data
|
||||
except Exception as e:
|
||||
print(f"Error occurred while parsing JSON: {e}")
|
||||
return jsonify({"status":False, 'error':str(e)})
|
||||
ASCIIColors.info(f"- Reloading binding {data['name']}...")
|
||||
try:
|
||||
ASCIIColors.info("Unmounting binding and model")
|
||||
self.binding = None
|
||||
self.model = None
|
||||
for personality in self.mounted_personalities:
|
||||
personality.model = None
|
||||
gc.collect()
|
||||
ASCIIColors.info("Reloading binding")
|
||||
self.binding = BindingBuilder().build_binding(self.config, self.lollms_paths, lollmsCom=self)
|
||||
ASCIIColors.info("Binding loaded successfully")
|
||||
|
||||
try:
|
||||
ASCIIColors.info("Reloading model")
|
||||
self.model = self.binding.build_model()
|
||||
ASCIIColors.info("Model reloaded successfully")
|
||||
except Exception as ex:
|
||||
print(f"Couldn't build model: [{ex}]")
|
||||
trace_exception(ex)
|
||||
try:
|
||||
self.rebuild_personalities(reload_all=True)
|
||||
except Exception as ex:
|
||||
print(f"Couldn't reload personalities: [{ex}]")
|
||||
return jsonify({"status": True})
|
||||
except Exception as ex:
|
||||
ASCIIColors.error(f"Couldn't build binding: [{ex}]")
|
||||
trace_exception(ex)
|
||||
return jsonify({"status":False, 'error':str(ex)})
|
||||
|
||||
|
||||
|
||||
|
||||
def p_mount_personality(self):
|
||||
print("- Mounting personality")
|
||||
@ -2639,9 +2624,22 @@ try:
|
||||
|
||||
|
||||
try:
|
||||
socketio.reboot = False
|
||||
socketio.run(app, host=config["host"], port=config["port"],
|
||||
# prevent error: The Werkzeug web server is not designed to run in production
|
||||
allow_unsafe_werkzeug=True)
|
||||
if socketio.reboot:
|
||||
ASCIIColors.info("")
|
||||
ASCIIColors.info("")
|
||||
ASCIIColors.info("")
|
||||
ASCIIColors.info(" ╔══════════════════════════════════════════════════╗")
|
||||
ASCIIColors.info(" ║ Restarting backend ║")
|
||||
ASCIIColors.info(" ╚══════════════════════════════════════════════════╝")
|
||||
ASCIIColors.info("")
|
||||
ASCIIColors.info("")
|
||||
ASCIIColors.info("")
|
||||
run_restart_script(args)
|
||||
|
||||
except Exception as ex:
|
||||
trace_exception(ex)
|
||||
# http_server = WSGIServer((config["host"], config["port"]), app, handler_class=WebSocketHandler)
|
||||
|
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">
|
||||
<title>LoLLMS WebUI - Welcome</title>
|
||||
<script type="module" crossorigin src="/assets/index-3aea4c30.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index-a331d591.css">
|
||||
<script type="module" crossorigin src="/assets/index-e963577c.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index-7674c890.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
@ -88,6 +88,7 @@
|
||||
<ProgressBar ref="progress" :progress="progress_value" class="w-full h-4"></ProgressBar>
|
||||
<p class="text-2xl animate-pulse mt-2 text-white">{{ loading_infos }} ...</p>
|
||||
</div>
|
||||
<UniversalForm ref="universalForm" class="z-20" />
|
||||
</header>
|
||||
|
||||
<body>
|
||||
@ -100,6 +101,7 @@ import Discussion from '../components/Discussion.vue'
|
||||
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 { RouterLink } from 'vue-router'
|
||||
@ -131,6 +133,7 @@ export default {
|
||||
Toast,
|
||||
MessageBox,
|
||||
ProgressBar,
|
||||
UniversalForm,
|
||||
},
|
||||
watch:{
|
||||
isConnected(){
|
||||
@ -160,6 +163,8 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
this.$store.state.toast = this.$refs.toast
|
||||
this.$store.state.messageBox = this.$refs.messageBox
|
||||
this.$store.state.universalForm = this.$refs.universalForm
|
||||
this.sunIcon = document.querySelector(".sun");
|
||||
this.moonIcon = document.querySelector(".moon");
|
||||
this.userTheme = localStorage.getItem("theme");
|
||||
|
@ -24,6 +24,9 @@ export const store = createStore({
|
||||
state () {
|
||||
return {
|
||||
// count: 0,
|
||||
universalForm:null,
|
||||
toast:null,
|
||||
messageBox:null,
|
||||
api_get_req:null,
|
||||
startSpeechRecognition:null,
|
||||
ready:false,
|
||||
|
@ -277,7 +277,6 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<MessageBox ref="messageBox" />
|
||||
<ChoiceDialog reference="database_selector" class="z-20"
|
||||
:show="database_selectorDialogVisible"
|
||||
:choices="databases"
|
||||
@ -485,7 +484,7 @@ export default {
|
||||
|
||||
// open form
|
||||
|
||||
this.$refs.universalForm.showForm(res.data, "Binding settings - " + bindingEntry.binding.name, "Save changes", "Cancel").then(res => {
|
||||
this.$store.state.universalForm.showForm(res.data, "Binding settings - " + bindingEntry.binding.name, "Save changes", "Cancel").then(res => {
|
||||
// send new data
|
||||
try {
|
||||
axios.post('/set_active_binding_settings',
|
||||
@ -576,13 +575,13 @@ export default {
|
||||
this.$store.state.toast.showToast("Settings saved!",4,true)
|
||||
}
|
||||
else
|
||||
this.$refs.messageBox.showMessage("Error: Couldn't save settings!")
|
||||
this.$store.state.messageBox.showMessage("Error: Couldn't save settings!")
|
||||
return res.data;
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error.message, 'save_configuration')
|
||||
this.$refs.messageBox.showMessage("Couldn't save settings!")
|
||||
this.$store.state.messageBox.showMessage("Couldn't save settings!")
|
||||
return { 'status': false }
|
||||
});
|
||||
|
||||
@ -1228,7 +1227,7 @@ export default {
|
||||
this.$store.state.toast.showToast(notif.content, notif.duration, notif.notification_type)
|
||||
}
|
||||
else if(notif.display_type==1){
|
||||
this.$refs.messageBox.showMessage(notif.content)
|
||||
this.$store.state.messageBox.showMessage(notif.content)
|
||||
}
|
||||
this.chime.play()
|
||||
},
|
||||
@ -1951,7 +1950,6 @@ export default {
|
||||
ChatBox,
|
||||
WelcomeComponent,
|
||||
ChoiceDialog,
|
||||
MessageBox,
|
||||
ProgressBar,
|
||||
InputBox
|
||||
},
|
||||
@ -2085,7 +2083,6 @@ export default {
|
||||
<script setup>
|
||||
import Discussion from '../components/Discussion.vue'
|
||||
import ChoiceDialog from '@/components/ChoiceDialog.vue'
|
||||
import MessageBox from "@/components/MessageBox.vue";
|
||||
import ProgressBar from "@/components/ProgressBar.vue";
|
||||
import InputBox from "@/components/input_box.vue";
|
||||
|
||||
|
@ -1651,8 +1651,6 @@
|
||||
</div>
|
||||
<YesNoDialog ref="yesNoDialog" class="z-20" />
|
||||
<AddModelDialog ref="addmodeldialog" />
|
||||
<MessageBox ref="messageBox" />
|
||||
<UniversalForm ref="universalForm" class="z-20" />
|
||||
<ChoiceDialog class="z-20"
|
||||
:show="variantSelectionDialogVisible"
|
||||
:choices="variant_choices"
|
||||
@ -1747,7 +1745,6 @@ import filesize from '../plugins/filesize'
|
||||
import axios from "axios";
|
||||
import feather from 'feather-icons'
|
||||
import { nextTick, TransitionGroup } from 'vue'
|
||||
import MessageBox from "@/components/MessageBox.vue";
|
||||
import YesNoDialog from "@/components/YesNoDialog.vue";
|
||||
import ModelEntry from '@/components/ModelEntry.vue';
|
||||
import PersonalityViewer from '@/components/PersonalityViewer.vue';
|
||||
@ -1761,7 +1758,6 @@ import defaultExtensionImgPlaceholder from "../assets/extension.png"
|
||||
import defaultImgPlaceholder from "../assets/default_model.png"
|
||||
|
||||
import AddModelDialog from "@/components/AddModelDialog.vue";
|
||||
import UniversalForm from '../components/UniversalForm.vue';
|
||||
|
||||
import ChoiceDialog from "@/components/ChoiceDialog.vue";
|
||||
import Card from "@/components/Card.vue"
|
||||
@ -1777,14 +1773,12 @@ axios.defaults.baseURL = import.meta.env.VITE_LOLLMS_API_BASEURL
|
||||
export default {
|
||||
components: {
|
||||
AddModelDialog,
|
||||
MessageBox,
|
||||
YesNoDialog,
|
||||
ModelEntry,
|
||||
// eslint-disable-next-line vue/no-unused-components
|
||||
PersonalityViewer,
|
||||
PersonalityEntry,
|
||||
BindingEntry,
|
||||
UniversalForm,
|
||||
ChoiceDialog,
|
||||
Card,
|
||||
RadioOptions,
|
||||
@ -1880,23 +1874,10 @@ export default {
|
||||
async created() {
|
||||
socket.on('loading_text',this.on_loading_text);
|
||||
this.updateHasUpdates();
|
||||
socket.on('notification', this.notify)
|
||||
//await socket.on('install_progress', this.progressListener);
|
||||
//refreshHardwareUsage()
|
||||
},
|
||||
methods: {
|
||||
notify(notif){
|
||||
nextTick(() => {
|
||||
const msgList = document.getElementById('messages-list')
|
||||
this.scrollBottom(msgList)
|
||||
})
|
||||
if(notif.display_type==0){
|
||||
this.$store.state.toast.showToast(notif.content, notif.duration, notif.notification_type)
|
||||
}
|
||||
else if(notif.display_type==1){
|
||||
this.$refs.messageBox.showMessage(notif.content)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
load_more_models(){
|
||||
if(this.models_zoo_initialLoadCount+10<this.models_zoo.length){
|
||||
this.models_zoo_initialLoadCount+=10
|
||||
@ -2616,13 +2597,7 @@ export default {
|
||||
console.log('install_binding', res)
|
||||
if (res.data.status) {
|
||||
this.$store.state.toast.showToast("Binding installed successfully!", 4, true)
|
||||
this.update_binding(binding_object.binding.folder);
|
||||
this.$store.state.api_get_req('restart_program')
|
||||
this.$store.state.toast.showToast("Rebooting the app. Please wait...", 410, false)
|
||||
console.log("this.$store.state.api_get_req",this.$store.state.api_get_req)
|
||||
setTimeout(()=>{
|
||||
window.close();
|
||||
},2000)
|
||||
this.$store.state.messageBox.showMessage("It is advised to reboot the application after installing a binding")
|
||||
} else {
|
||||
this.$store.state.toast.showToast("Could not reinstall binding", 4, false)
|
||||
}
|
||||
@ -2691,12 +2666,8 @@ export default {
|
||||
console.log('reinstall_binding', res)
|
||||
if (res.data.status) {
|
||||
this.$store.state.toast.showToast("Binding reinstalled successfully!", 4, true)
|
||||
this.$store.state.api_get_req('restart_program')
|
||||
this.$store.state.toast.showToast("Rebooting the app. Please wait...", 410, false)
|
||||
console.log("this.$store.state.api_get_req",this.$store.state.api_get_req)
|
||||
setTimeout(()=>{
|
||||
window.close();
|
||||
},2000)
|
||||
this.$store.state.messageBox.showMessage("It is advised to reboot the application after installing a binding")
|
||||
|
||||
} else {
|
||||
this.$store.state.toast.showToast("Could not reinstall binding", 4, false)
|
||||
}
|
||||
@ -2743,7 +2714,7 @@ export default {
|
||||
console.log('ext sett', res)
|
||||
if (res.data && Object.keys(res.data).length > 0) {
|
||||
|
||||
this.$refs.universalForm.showForm(res.data, "Extension settings - " + extensionEntry.extension.name, "Save changes", "Cancel").then(res => {
|
||||
this.$store.state.universalForm.showForm(res.data, "Extension settings - " + extensionEntry.extension.name, "Save changes", "Cancel").then(res => {
|
||||
|
||||
// send new data
|
||||
try {
|
||||
@ -2793,22 +2764,21 @@ export default {
|
||||
|
||||
// open form
|
||||
|
||||
this.$refs.universalForm.showForm(res.data, "Binding settings - " + bindingEntry.binding.name, "Save changes", "Cancel").then(res => {
|
||||
this.$store.state.universalForm.showForm(res.data, "Binding settings - " + bindingEntry.binding.name, "Save changes", "Cancel").then(res => {
|
||||
// send new data
|
||||
try {
|
||||
axios.post('/set_active_binding_settings',
|
||||
res).then(response => {
|
||||
|
||||
if (response && response.data) {
|
||||
console.log('binding set with new settings', response.data)
|
||||
this.$store.state.toast.showToast("Binding settings updated successfully!", 4, true)
|
||||
|
||||
axios.get('/update_binding_settings').then((res) => {
|
||||
this.$store.state.toast.showToast("Binding settings committed successfully!", 4, true)
|
||||
})
|
||||
} else {
|
||||
this.$store.state.toast.showToast("Did not get binding settings responses.\n" + response, 4, false)
|
||||
this.isLoading = false
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
} catch (error) {
|
||||
this.$store.state.toast.showToast("Did not get binding settings responses.\n Endpoint error: " + error.message, 4, false)
|
||||
@ -2866,7 +2836,7 @@ export default {
|
||||
console.log('pers sett', res)
|
||||
if (res.data && Object.keys(res.data).length > 0) {
|
||||
|
||||
this.$refs.universalForm.showForm(res.data, "Personality settings - " + persEntry.personality.name, "Save changes", "Cancel").then(res => {
|
||||
this.$store.state.universalForm.showForm(res.data, "Personality settings - " + persEntry.personality.name, "Save changes", "Cancel").then(res => {
|
||||
|
||||
// send new data
|
||||
try {
|
||||
@ -3180,16 +3150,16 @@ export default {
|
||||
.then((res) => {
|
||||
if (res) {
|
||||
if (res.status) {
|
||||
// this.$refs.messageBox.showMessage("Settings saved!")
|
||||
// this.$store.state.messageBox.showMessage("Settings saved!")
|
||||
}
|
||||
else
|
||||
this.$refs.messageBox.showMessage("Error: Couldn't save settings!")
|
||||
this.$store.state.messageBox.showMessage("Error: Couldn't save settings!")
|
||||
return res.data;
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error.message, 'save_configuration')
|
||||
this.$refs.messageBox.showMessage("Couldn't save settings!")
|
||||
this.$store.state.messageBox.showMessage("Couldn't save settings!")
|
||||
return { 'status': false }
|
||||
});
|
||||
|
||||
@ -3202,15 +3172,15 @@ export default {
|
||||
.then((res) => {
|
||||
if (res) {
|
||||
if (res.status)
|
||||
this.$refs.messageBox.showMessage("Settings have been reset correctly")
|
||||
this.$store.state.messageBox.showMessage("Settings have been reset correctly")
|
||||
else
|
||||
this.$refs.messageBox.showMessage("Couldn't reset settings!")
|
||||
this.$store.state.messageBox.showMessage("Couldn't reset settings!")
|
||||
return res.data;
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error.message, 'reset_configuration')
|
||||
this.$refs.messageBox.showMessage("Couldn't reset settings!")
|
||||
this.$store.state.messageBox.showMessage("Couldn't reset settings!")
|
||||
return { 'status': false }
|
||||
});
|
||||
// Perform delete operation
|
||||
@ -3486,7 +3456,7 @@ export default {
|
||||
console.log('mount pers', pers)
|
||||
|
||||
if(pers.personality.disclaimer!=""){
|
||||
this.$refs.messageBox.showMessage(pers.personality.disclaimer)
|
||||
this.$store.state.messageBox.showMessage(pers.personality.disclaimer)
|
||||
}
|
||||
|
||||
if (!pers) { return }
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit d1d90b57585ec74647de8e5e4ed6a62282a46032
|
||||
Subproject commit ca8d633c10ddcf67210a3fddae8bac99fe13244f
|
Loading…
x
Reference in New Issue
Block a user