upgraded ui

This commit is contained in:
Saifeddine ALOUI
2024-03-24 15:39:42 +01:00
parent fb66c9c179
commit 8aa3c4eb40
7 changed files with 19 additions and 9 deletions

View File

@ -14,7 +14,7 @@ from starlette.responses import StreamingResponse
from lollms.types import MSG_TYPE from lollms.types import MSG_TYPE
from lollms.main_config import BaseConfig from lollms.main_config import BaseConfig
from lollms.utilities import detect_antiprompt, remove_text_from_string, trace_exception, show_yes_no_dialog from lollms.utilities import detect_antiprompt, remove_text_from_string, trace_exception, show_yes_no_dialog
from lollms.security import sanitize_path from lollms.security import sanitize_path, forbid_remote_access
from ascii_colors import ASCIIColors from ascii_colors import ASCIIColors
from lollms.databases.discussions_database import DiscussionsDB from lollms.databases.discussions_database import DiscussionsDB
from pathlib import Path from pathlib import Path
@ -146,6 +146,7 @@ async def open_file(file_path: FilePath):
if not show_yes_no_dialog("Validation","Do you validate the opening of a file?"): if not show_yes_no_dialog("Validation","Do you validate the opening of a file?"):
return {"status":False,"error":"User refused the opeining file!"} return {"status":False,"error":"User refused the opeining file!"}
forbid_remote_access(lollmsElfServer)
try: try:
# Validate the 'path' parameter # Validate the 'path' parameter
path = sanitize_path(file_path.path) path = sanitize_path(file_path.path)

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"> <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-f9b7f9cd.js"></script> <script type="module" crossorigin src="/assets/index-6b4f7455.js"></script>
<link rel="stylesheet" href="/assets/index-7711d71f.css"> <link rel="stylesheet" href="/assets/index-a9383c4e.css">
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>

View File

@ -675,19 +675,25 @@ export default {
console.log("Setting binding to "+selectedBinding.name); console.log("Setting binding to "+selectedBinding.name);
this.selecting_binding=true this.selecting_binding=true
this.selectedModel = selectedBinding this.selectedModel = selectedBinding
this.$store.state.messa
this.$store.state.messageBox.showBlockingMessage("Loading binding")
axios.post("/update_setting", { axios.post("/update_setting", {
client_id: this.$store.state.client_id, client_id: this.$store.state.client_id,
setting_name: "binding_name", setting_name: "binding_name",
setting_value: selectedBinding.name setting_value: selectedBinding.name
}).then(async (response) => { }).then(async (response) => {
this.$store.state.messageBox.hideBlockingMessage()
console.log("UPDATED"); console.log("UPDATED");
console.log(response); console.log(response);
await this.$store.dispatch('refreshConfig');
await this.$store.dispatch('refreshBindings'); await this.$store.dispatch('refreshBindings');
await this.$store.dispatch('refreshModelsZoo');
await this.$store.dispatch('refreshModels'); await this.$store.dispatch('refreshModels');
await this.$store.dispatch('refreshConfig');
this.$store.state.toast.showToast(`Binding changed to ${this.currentBinding.name}`,4,true) this.$store.state.toast.showToast(`Binding changed to ${this.currentBinding.name}`,4,true)
this.selecting_binding=false this.selecting_binding=false
}).catch(err=>{ }).catch(err=>{
this.$store.state.messageBox.hideBlockingMessage()
this.$store.state.toast.showToast(`Error ${err}`,4,true) this.$store.state.toast.showToast(`Error ${err}`,4,true)
this.selecting_binding=false this.selecting_binding=false
}); });
@ -696,11 +702,13 @@ export default {
console.log("Setting model to "+selectedModel.name); console.log("Setting model to "+selectedModel.name);
this.selecting_model=true this.selecting_model=true
this.selectedModel = selectedModel this.selectedModel = selectedModel
this.$store.state.messageBox.showBlockingMessage("Loading model")
axios.post("/update_setting", { axios.post("/update_setting", {
client_id: this.$store.state.client_id, client_id: this.$store.state.client_id,
setting_name: "model_name", setting_name: "model_name",
setting_value: selectedModel.name setting_value: selectedModel.name
}).then(async (response) => { }).then(async (response) => {
this.$store.state.messageBox.hideBlockingMessage()
console.log("UPDATED"); console.log("UPDATED");
console.log(response); console.log(response);
await this.$store.dispatch('refreshConfig'); await this.$store.dispatch('refreshConfig');
@ -708,6 +716,7 @@ export default {
this.$store.state.toast.showToast(`Model changed to ${this.currentModel.name}`,4,true) this.$store.state.toast.showToast(`Model changed to ${this.currentModel.name}`,4,true)
this.selecting_model=false this.selecting_model=false
}).catch(err=>{ }).catch(err=>{
this.$store.state.messageBox.hideBlockingMessage()
this.$store.state.toast.showToast(`Error ${err}`,4,true) this.$store.state.toast.showToast(`Error ${err}`,4,true)
this.selecting_model=false this.selecting_model=false
}); });