This commit is contained in:
Saifeddine ALOUI 2023-12-10 14:48:32 +01:00
parent 82e154b7ff
commit 78a90d632e
12 changed files with 262 additions and 243 deletions

View File

@ -16,7 +16,7 @@ from lollms.extension import LOLLMSExtension, ExtensionBuilder
from lollms.personality import AIPersonality, PersonalityBuilder
from lollms.binding import LOLLMSConfig, BindingBuilder, LLMBinding, ModelBuilder, BindingType
from lollms.paths import LollmsPaths
from lollms.helpers import ASCIIColors, trace_exception
from lollms.helpers import ASCIIColors, trace_exception, NotificationType, NotificationDisplayType
from lollms.app import LollmsApplication
from lollms.utilities import File64BitsManager, PromptReshaper
from lollms.media import WebcamImageSender
@ -1497,19 +1497,22 @@ class LoLLMsAPI(LollmsApplication):
def notify(self, content, status=True, duration=4, client_id=None, notification_type=0):
"""
notification type is:
0 : suddle
1 : Critical (shows a message box )
"""
def notify(
self,
content,
notification_type:NotificationType=NotificationType.NOTIF_SUCCESS,
duration=4,
client_id=None,
display_type:NotificationDisplayType=NotificationDisplayType.TOAST
):
self.socketio.emit('notification', {
'content': content,# self.connections[client_id]["generated_text"],
'status': status,
'notification_type': notification_type.value,
"duration": duration,
'notification_type':notification_type
'display_type':display_type.value
}, room=client_id
)
)
self.socketio.sleep(0.01)
def new_message(self,
client_id,

5
app.py
View File

@ -26,6 +26,7 @@ import time
import traceback
import webbrowser
from pathlib import Path
from lollms.helpers import NotificationType, NotificationDisplayType
from lollms.utilities import AdvancedGarbageCollector, reinstall_pytorch_with_cuda
def run_update_script(args=None):
update_script = Path(__file__).parent/"update_script.py"
@ -1646,8 +1647,8 @@ try:
old_bn = self.config.binding_name
self.config.binding_name = data['name']
self.binding = BindingBuilder().build_binding(self.config, self.lollms_paths, InstallOption.FORCE_INSTALL, self.notify)
ASCIIColors.success("Binding reinstalled successfully")
self.notify("Please reboot the application so that the binding installation can be taken into consideration",True, 30, 1)
self.notify("Binding reinstalled successfully")
self.notify("Please reboot the application so that the binding installation can be taken into consideration", NotificationType.NOTIF_INFO , display_type=NotificationDisplayType.MESSAGE_BOX)
self.config.binding_name = old_bn
self.binding = BindingBuilder().build_binding(self.config, self.lollms_paths, self.notify)
self.model = self.binding.build_model()

@ -1 +1 @@
Subproject commit 01ec6b724bcdcda84ca97dfb12ed4b886963ebc6
Subproject commit ad328a8c79f3e522955416b9ab747bdcfd01ab22

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1
web/dist/assets/vscode-b22df1bb.svg vendored Normal file
View File

@ -0,0 +1 @@
<svg height="2455" viewBox="-11.9 -2 1003.9 995.6" width="2500" xmlns="http://www.w3.org/2000/svg"><path d="m12.1 353.9s-24-17.3 4.8-40.4l67.1-60s19.2-20.2 39.5-2.6l619.2 468.8v224.8s-.3 35.3-45.6 31.4z" fill="#2489ca"/><path d="m171.7 498.8-159.6 145.1s-16.4 12.2 0 34l74.1 67.4s17.6 18.9 43.6-2.6l169.2-128.3z" fill="#1070b3"/><path d="m451.9 500 292.7-223.5-1.9-223.6s-12.5-48.8-54.2-23.4l-389.5 354.5z" fill="#0877b9"/><path d="m697.1 976.2c17 17.4 37.6 11.7 37.6 11.7l228.1-112.4c29.2-19.9 25.1-44.6 25.1-44.6v-671.2c0-29.5-30.2-39.7-30.2-39.7l-197.7-95.3c-43.2-26.7-71.5 4.8-71.5 4.8s36.4-26.2 54.2 23.4v887.5c0 6.1-1.3 12.1-3.9 17.5-5.2 10.5-16.5 20.3-43.6 16.2z" fill="#3c99d4"/></svg>

After

Width:  |  Height:  |  Size: 693 B

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg fill="#000000" width="800px" height="800px" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
<path d="M30.865 3.448l-6.583-3.167c-0.766-0.37-1.677-0.214-2.276 0.385l-12.609 11.505-5.495-4.167c-0.51-0.391-1.229-0.359-1.703 0.073l-1.76 1.604c-0.583 0.526-0.583 1.443-0.005 1.969l4.766 4.349-4.766 4.349c-0.578 0.526-0.578 1.443 0.005 1.969l1.76 1.604c0.479 0.432 1.193 0.464 1.703 0.073l5.495-4.172 12.615 11.51c0.594 0.599 1.505 0.755 2.271 0.385l6.589-3.172c0.693-0.333 1.13-1.031 1.13-1.802v-21.495c0-0.766-0.443-1.469-1.135-1.802zM24.005 23.266l-9.573-7.266 9.573-7.266z"/>
</svg>

After

Width:  |  Height:  |  Size: 715 B

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-89dc57b2.js"></script>
<link rel="stylesheet" href="/assets/index-864f3ca4.css">
<script type="module" crossorigin src="/assets/index-f369a711.js"></script>
<link rel="stylesheet" href="/assets/index-3789d6b8.css">
</head>
<body>
<div id="app"></div>

View File

@ -17,11 +17,11 @@
</button>
<button v-if="['python'].includes(language)" @click="openFolderVsCode" title="open code project folder in vscode"
class="px-2 py-1 ml-2 text-left p-2 text-sm font-medium bg-bg-dark-tone-panel dark:bg-bg-dark-tone rounded-lg hover:bg-primary dark:hover:bg-primary text-white text-xs transition-colors duration-200">
<i data-feather="briefcase"></i>
<img src="@/assets/vscode_black.svg" width="25" height="25">
</button>
<button v-if="['python'].includes(language)" @click="openVsCode" title="open code project folder in vscode"
<button v-if="['python'].includes(language)" @click="openVsCode" title="open code in vscode"
class="px-2 py-1 ml-2 text-left p-2 text-sm font-medium bg-bg-dark-tone-panel dark:bg-bg-dark-tone rounded-lg hover:bg-primary dark:hover:bg-primary text-white text-xs transition-colors duration-200">
<i data-feather="briefcase"></i>
<img src="@/assets/vscode.svg" width="25" height="25">
</button>
</div>
<pre class="hljs p-1 rounded-md break-all grid grid-cols-1">

View File

@ -7,15 +7,25 @@
<div class="flex flex-row flex-grow items-center">
<slot>
<div v-if="t.success"
<div v-if="t.log_type==0"
class="inline-flex items-center justify-center flex-shrink-0 w-8 h-8 text-red-500 bg-red-100 rounded-lg dark:bg-red-800 dark:text-red-200">
<i data-feather="x"></i>
<span class="sr-only">Cross icon</span>
</div>
<div v-if="t.log_type==1"
class="inline-flex items-center justify-center flex-shrink-0 w-8 h-8 text-green-500 bg-green-100 rounded-lg dark:bg-green-800 dark:text-green-200">
<i data-feather="check"></i>
<span class="sr-only">Check icon</span>
</div>
<div v-if="!t.success"
class="inline-flex items-center justify-center flex-shrink-0 w-8 h-8 text-red-500 bg-red-100 rounded-lg dark:bg-red-800 dark:text-red-200">
<i data-feather="x"></i>
<span class="sr-only">Cross icon</span>
<div v-if="t.log_type==2"
class="inline-flex items-center justify-center flex-shrink-0 w-8 h-8 text-blue-500 bg-blue-100 rounded-lg dark:bg-blue-800 dark:text-blue-200">
<i data-feather="info"></i>
<span class="sr-only"></span>
</div>
<div v-if="t.log_type==3"
class="inline-flex items-center justify-center flex-shrink-0 w-8 h-8 text-orange-500 bg-orange-100 rounded-lg dark:bg-orange-800 dark:text-orange-200">
<i data-feather="alert-triangle"></i>
<span class="sr-only"></span>
</div>
<div class="ml-3 text-sm font-normal whitespace-pre-wrap line-clamp-3" :title="t.message">{{ t.message }}</div>
@ -61,7 +71,7 @@ export default {
data() {
return {
show: false,
success: true,
log_type: 1, // 0=error, 1=success, 2=info, 3=warning
message: '',
toastArr: []
};
@ -84,11 +94,11 @@ export default {
},
showToast(message, duration_s = 3, success = true) {
showToast(message, duration_s = 3, log_type = true) {
const id = parseInt(((new Date()).getTime() * Math.random()).toString()).toString()
const toastObj = {
id: id,
success: success,
log_type: log_type,
message: message,
show: true,
//copy: this.copyToClipBoard(message)

View File

@ -1201,10 +1201,10 @@ export default {
const msgList = document.getElementById('messages-list')
this.scrollBottom(msgList)
})
if(notif.notification_type==0){
this.$refs.toast.showToast(notif.content, notif.duration, notif.status)
if(notif.display_type==0){
this.$refs.toast.showToast(notif.content, notif.duration, notif.notification_type)
}
else if(notif.notification_type==1){
else if(notif.display_type==1){
this.$refs.messageBox.showMessage(notif.content)
}
this.chime.play()

View File

@ -1894,10 +1894,10 @@ export default {
const msgList = document.getElementById('messages-list')
this.scrollBottom(msgList)
})
if(notif.notification_type==0){
this.$refs.toast.showToast(notif.content, notif.duration, notif.status)
if(notif.display_type==0){
this.$refs.toast.showToast(notif.content, notif.duration, notif.notification_type)
}
else if(notif.notification_type==1){
else if(notif.display_type==1){
this.$refs.messageBox.showMessage(notif.content)
}
},