fixed bugs

This commit is contained in:
Saifeddine ALOUI 2024-02-11 18:29:24 +01:00
parent b57abf4e34
commit a5417591f8
10 changed files with 64 additions and 42 deletions

View File

@ -85,7 +85,7 @@ lollms_base_url: http://0.0.0.0:1234
# elastic search service
elastic_search_service: false
elastic_search_url: http://0.0.0.0:9606
elastic_search_url: http://0.0.0.0:9200
# vll service
vllm_service: false

@ -1 +1 @@
Subproject commit 62677f4ee5e6c01ab83a25abf9e90182acd48487
Subproject commit 2f13ea8fa954049e01abc6b2ec1ba363bf269dd4

View File

@ -416,6 +416,7 @@ class LOLLMSWebUI(LOLLMSElfServer):
app=self,
selected_language=personality.split(":")[1] if ":" in personality else None,
run_scripts=True)
mounted_personalities.append(personality)
if self.config.enable_voice_service and self.config.auto_read and len(personality.audio_samples)>0:
try:
@ -658,15 +659,6 @@ class LOLLMSWebUI(LOLLMSElfServer):
return title[0]
def prepare_reception(self, client_id):
if not self.connections[client_id]["continuing"]:
self.connections[client_id]["generated_text"] = ""
self.connections[client_id]["first_chunk"]=True
self.nb_received_tokens = 0
self.start_time = datetime.now()
def recover_discussion(self,client_id, message_index=-1):
messages = self.connections[client_id]["current_discussion"].get_messages()
discussion=""
@ -1222,9 +1214,11 @@ class LOLLMSWebUI(LOLLMSElfServer):
if self.nb_received_tokens==0:
self.start_time = datetime.now()
self.update_message(client_id, "✍ warming up ...", msg_type=MSG_TYPE.MSG_TYPE_STEP_END, parameters= {'status':True})
self.update_message(client_id, "Generating ...", msg_type=MSG_TYPE.MSG_TYPE_STEP_START)
try:
self.update_message(client_id, "✍ warming up ...", msg_type=MSG_TYPE.MSG_TYPE_STEP_END, parameters= {'status':True})
self.update_message(client_id, "Generating ...", msg_type=MSG_TYPE.MSG_TYPE_STEP_START)
except Exception as ex:
ASCIIColors.warning("Couldn't send status update to client")
dt =(datetime.now() - self.start_time).seconds
if dt==0:
dt=1

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-3b9f838e.js"></script>
<link rel="stylesheet" href="/assets/index-5f320cbc.css">
<script type="module" crossorigin src="/assets/index-a227e0a5.js"></script>
<link rel="stylesheet" href="/assets/index-4c3fd048.css">
</head>
<body>
<div id="app"></div>

View File

@ -237,7 +237,7 @@
</div>
<div class="group relative w-max">
<input type="file" ref="fileDialog" style="display: none" @change="addFiles" multiple />
<button type="button" @click.stop="$refs.fileDialog.click()"
<button type="button" @click.prevent="add_file"
class="w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90">
<i data-feather="file-plus"></i>
</button>
@ -680,6 +680,7 @@ export default {
},
send_file(file, next) {
console.log("Send file triggered")
const fileReader = new FileReader();
const chunkSize = 24 * 1024; // Chunk size in bytes (e.g., 1MB)
let offset = 0;
@ -819,6 +820,28 @@ export default {
console.log("Emitting addWebLink")
this.$emit('addWebLink')
},
add_file(){
// Create a new hidden input element
const input = document.createElement('input');
input.type = 'file';
input.style.display = 'none';
input.multiple = true;
// Append the input to the body
document.body.appendChild(input);
// Listen for the change event
input.addEventListener('change', () => {
// Call the add file function
console.log("Calling Add file...")
this.addFiles(input.files);
// Remove the input element from the DOM
document.body.removeChild(input);
});
// Trigger the file dialog
input.click();
},
takePicture(){
socket.emit('take_picture')
socket.on('picture_taken',()=>{
@ -855,9 +878,9 @@ export default {
stopGenerating() {
this.$emit('stopGenerating')
},
addFiles(event) {
addFiles(files) {
console.log("Adding files");
const newFiles = [...event.target.files];
const newFiles = [...files];
let index = 0;
const sendNextFile = () => {
if (index >= newFiles.length) {

View File

@ -410,7 +410,7 @@ export default {
},
async select_personality(pers) {
if (!pers) { return { 'status': false, 'error': 'no personality - select_personality' } }
if (!pers || !pers.personality) { return { 'status': false, 'error': 'no personality - select_personality' } }
let id = -1
console.log("Personality full path : ",pers.full_path)
console.log("Personality language : ",pers.personality.language)

View File

@ -1264,24 +1264,29 @@ export default {
messageItem.status_message = msgObj.content
messageItem.steps.push({"message":msgObj.content,"done":false, "status":true, "type": "start_end" })
} else if (msgObj.message_type == this.msgTypes.MSG_TYPE_STEP_END) {
console.log("received step end")
// Find the step with the matching message and update its 'done' property to true
const matchingStep = messageItem.steps.find(step => step.message === msgObj.content);
console.log("received step end", msgObj)
try{
// Find the step with the matching message and update its 'done' property to true
const matchingStep = messageItem.steps.find(step => step.message === msgObj.content);
if (matchingStep) {
matchingStep.done = true;
try {
console.log(msgObj.parameters)
const parameters = msgObj.parameters;
if(parameters!=undefined){
matchingStep.status=parameters.status
console.log(parameters);
if (matchingStep) {
matchingStep.done = true;
try {
console.log(msgObj.parameters)
const parameters = msgObj.parameters;
if(parameters!=undefined){
matchingStep.status=parameters.status
console.log(parameters);
}
} catch (error) {
console.error('Error parsing JSON:', error.message);
}
} catch (error) {
console.error('Error parsing JSON:', error.message);
}
}
catch{
console.log("error")
}
} else if (msgObj.message_type == this.msgTypes.MSG_TYPE_JSON_INFOS) {
console.log("JSON message")
console.log(msgObj.metadata)

@ -1 +1 @@
Subproject commit b72f3c1ad2384a56b99bb7dc6656d30353f213c0
Subproject commit 8627e9a34e279555a734c99520e7f4681eb94583