steps can fail now

This commit is contained in:
Saifeddine ALOUI 2023-07-28 01:16:26 +02:00
parent 0c22ce20da
commit c720b10e36
13 changed files with 176 additions and 67 deletions

View File

@ -684,9 +684,9 @@ class LoLLMsAPPI(LollmsApplication):
else:
break
link_text = self.personality.link_text
link_text = "\n" #self.personality.link_text
if not is_continue:
self.full_message_list.append("\n"+self.config.discussion_prompt_separator +message["sender"].replace(":","")+": "+message["content"].strip()+self.personality.link_text+self.personality.ai_message_prefix)
self.full_message_list.append("\n"+self.config.discussion_prompt_separator +message["sender"].replace(":","")+": "+message["content"].strip()+link_text+self.personality.ai_message_prefix)
else:
self.full_message_list.append("\n"+self.config.discussion_prompt_separator +message["sender"].replace(":","")+": "+message["content"].strip())
@ -706,6 +706,7 @@ class LoLLMsAPPI(LollmsApplication):
if self.config["debug"]:
ASCIIColors.yellow(discussion_messages)
ASCIIColors.yellow(f"prompt size:{len(tokens)} tokens")
return discussion_messages, message["content"], tokens
@ -722,7 +723,7 @@ class LoLLMsAPPI(LollmsApplication):
else:
self.full_message_list.append(ump + message["content"])
link_text = self.personality.link_text
link_text = "\n"# self.personality.link_text
if len(self.full_message_list) > self.config["nb_messages_to_remember"]:
discussion_messages = self.personality.personality_conditioning+ link_text.join(self.full_message_list[-self.config["nb_messages_to_remember"]:])
@ -785,6 +786,7 @@ class LoLLMsAPPI(LollmsApplication):
"user_message_id": self.current_user_message_id,
"ai_message_id": self.current_ai_message_id,
'finished_generating_at': self.current_discussion.current_message_finished_generating_at,
'metadata':metadata
}, room=client_id
)
return False
@ -798,6 +800,7 @@ class LoLLMsAPPI(LollmsApplication):
"user_message_id": self.current_user_message_id,
"ai_message_id": self.current_ai_message_id,
'finished_generating_at': self.current_discussion.current_message_finished_generating_at,
'metadata':metadata
}, room=client_id
)
self.socketio.sleep(0.01)
@ -822,6 +825,7 @@ class LoLLMsAPPI(LollmsApplication):
'discussion_id':self.current_discussion.discussion_id,
'message_type': message_type.value,
'finished_generating_at': self.current_discussion.current_message_finished_generating_at,
'metadata':metadata
}, room=client_id
)
self.socketio.sleep(0.01)
@ -835,6 +839,7 @@ class LoLLMsAPPI(LollmsApplication):
'discussion_id':self.current_discussion.discussion_id,
'message_type': message_type.value,
'finished_generating_at': self.current_discussion.current_message_finished_generating_at,
'metadata':metadata
}, room=client_id
)
self.socketio.sleep(0.01)

View File

@ -1,5 +1,5 @@
# =================== Lord Of Large Language Models Configuration file ===========================
version: 15
version: 16
binding_name: null
model_name: null
@ -45,4 +45,5 @@ auto_update: false
audio_in_language: 'en-US'
audio_out_voice: null
auto_speak: false
audio_pitch: 1
silenceTimer: 5000

View File

@ -2,8 +2,8 @@ import os
import sys
def main():
if len(sys.argv) != 2:
print("Usage: python restart_script.py <repo_path>")
if len(sys.argv) != 1:
print("Usage: python restart_script.py")
sys.exit(1)
# Reload the main script with the original arguments

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-b5959380.js"></script>
<link rel="stylesheet" href="/assets/index-3a2a1b2d.css">
<script type="module" crossorigin src="/assets/index-04dfca4a.js"></script>
<link rel="stylesheet" href="/assets/index-2dff239f.css">
</head>
<body>
<div id="app"></div>

View File

@ -217,9 +217,9 @@ import MountedPersonalitiesComponent from './MountedPersonalitiesComponent.vue'
import { nextTick, ref, TransitionGroup } from 'vue'
import feather from 'feather-icons'
import filesize from '../plugins/filesize'
import MountedPersonalities from './MountedPersonalities.vue'
import MountedPersonalitiesList from './MountedPersonalitiesList.vue'
import PersonalitiesCommands from './PersonalitiesCommands.vue';
import MountedPersonalities from '@/components/MountedPersonalities.vue'
import MountedPersonalitiesList from '@/components/MountedPersonalitiesList.vue'
import PersonalitiesCommands from '@/components/PersonalitiesCommands.vue';
import { useStore } from 'vuex'; // Import the useStore function
import { inject } from 'vue';
export default {

View File

@ -131,7 +131,7 @@
<!-- MESSAGE CONTENT -->
<div class="flex flex-col items-start w-full">
<div v-for="(step, index) in message.steps" :key="'step-' + message.id + '-' + index" class="step font-bold" :style="{ backgroundColor: step.done ? 'transparent' : 'inherit' }">
<Step :done="step.done" :message="step.message" />
<Step :done="step.done" :message="step.message" :status="step.status" />
</div>
</div>
@ -252,6 +252,7 @@ export default {
// Create a new SpeechSynthesisUtterance instance
this.msg = new SpeechSynthesisUtterance();
this.msg.pitch = this.$store.state.config.audio_pitch;
// Optionally, set the voice and other parameters as before
if (this.voices.length > 0) {
@ -275,7 +276,9 @@ export default {
lastIndex = markerIndex;
}
});
return lastIndex+startIndex;
if(lastIndex==-1){lastIndex=txt.length}
console.log(lastIndex)
return lastIndex+startIndex+1;
};
// Function to speak a chunk of text

View File

@ -7,7 +7,7 @@
<div class="flex -space-x-4 " v-if="mountedPersArr.length > 1">
<img :src="bUrl + mountedPers.avatar" @error="personalityImgPlacehodler"
class="w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:z-20 hover:-translate-y-2 duration-150 border-secondary cursor-pointer"
:title="'Active personality: '+mountedPers.name" >
:title="'Active personality: '+mountedPers.name" @click="onSettingsPersonality(mountedPers)">
<div class="flex items-center justify-center w-8 h-8 cursor-pointer text-xs font-medium bg-bg-light dark:bg-bg-dark border-2 hover:border-secondary rounded-full hover:bg-bg-light-tone dark:hover:bg-bg-dark-tone dark:border-gray-800 hover:z-20 hover:-translate-y-2 duration-150 active:scale-90"
@click.stop="toggleShowPersList" title="Click to show more">+{{ mountedPersArr.length - 1 }}</div>
@ -34,11 +34,14 @@
</div>
</div>
<UniversalForm ref="universalForm" class="z-20" />
</template>
<script>
import axios from "axios";
import defaultPersonalityImgPlaceholder from "../assets/logo.svg"
import UniversalForm from '@/components/UniversalForm.vue';
import { nextTick } from "vue";
import { useStore } from 'vuex'; // Import the useStore function
import { computed } from 'vue'; // Import the computed function
@ -56,6 +59,9 @@ export default {
onShowPersList: Function,
onReady:Function,
},
components: {
UniversalForm
},
data() {
return {
bUrl: bUrl,
@ -112,6 +118,54 @@ export default {
},
methods: {
onSettingsPersonality(persEntry) {
try {
axios.get('/get_active_personality_settings').then(res => {
if (res) {
console.log('pers sett', res)
if (res.data && Object.keys(res.data).length > 0) {
this.$refs.universalForm.showForm(res.data, "Personality settings - " + persEntry.name, "Save changes", "Cancel").then(res => {
// send new data
try {
axios.post('/set_active_personality_settings',
res).then(response => {
if (response && response.data) {
console.log('personality set with new settings', response.data)
this.$refs.toast.showToast("Personality settings updated successfully!", 4, true)
} else {
this.$refs.toast.showToast("Did not get Personality settings responses.\n" + response, 4, false)
}
})
} catch (error) {
this.$refs.toast.showToast("Did not get Personality settings responses.\n Endpoint error: " + error.message, 4, false)
}
})
} else {
this.$refs.toast.showToast("Personality has no settings", 4, false)
}
}
})
} catch (error) {
this.$refs.toast.showToast("Could not open personality settings. Endpoint error: " + error.message, 4, false)
}
},
toggleShowPersList() {
//this.show = !this.show
this.onShowPersList()

View File

@ -7,12 +7,18 @@
class="text-gray-400 w-4 h-4"
></i>
</div>
<div v-if="done">
<div v-if="done && status">
<i
data-feather="check-square"
class="text-green-500 w-4 h-4"
></i>
</div>
<div v-if="done && !status">
<i
data-feather="x-square"
class="text-red-500 w-4 h-4"
></i>
</div>
</div>
<div v-if="!done" role="status">
<svg aria-hidden="true" class="w-6 h-6 animate-spin fill-secondary" viewBox="0 0 100 101"
@ -43,7 +49,12 @@
message: {
type: String,
required: true
}
},
status: {
type: Boolean,
required: true
},
}
};
</script>

View File

@ -1,7 +1,7 @@
<template>
<div v-if="show"
class="fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center bg-black bg-opacity-50 p-4">
<div class="relative w-full max-w-md ">
<div class="relative w-full max-w-md">
<div
class="flex flex-col rounded-lg bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel duration-150 shadow-lg max-h-screen">
@ -197,7 +197,7 @@
{{ ConfirmButtonText }}
</button>
<button @click.stop="hide(false)" type="button"
class="text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 rounded-lg border border-gray-200 text-sm font-medium px-5 py-2.5 hover:text-gray-900 focus:z-10 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600">
class="text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 rounded-lg border border-gray-200 text-sm font-medium px-5 py-2.5 hover:text-gray-900 focus:z-11 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600">
{{ DenyButtonText }}
</button>
</div>

View File

@ -47,7 +47,7 @@
<!-- LEFT SIDE PANEL -->
<div id="leftPanel" class="flex flex-col flex-grow overflow-y-scroll no-scrollbar "
@dragover.stop.prevent="setDropZoneDiscussion()">
<div class=" sticky z-10 top-0 bg-bg-light-tone dark:bg-bg-dark-tone shadow-md ">
<div class=" sticky z-5 top-0 bg-bg-light-tone dark:bg-bg-dark-tone shadow-md ">
@ -187,11 +187,11 @@
</div>
</div>
<div class="z-20">
<div class="z-5">
<DragDrop ref="dragdropDiscussion" @panelDrop="setFileListDiscussion">Drop your discussion file here
</DragDrop>
</div>
<div class="relative flex flex-row flex-grow mb-10 ">
<div class="relative flex flex-row flex-grow mb-10 z-0">
<!-- DISCUSSION LIST -->
<div class="mx-4 flex flex-col flex-grow " :class="isDragOverDiscussion ? 'pointer-events-none' : ''">
@ -967,13 +967,15 @@ export default {
else if(messageItem && msgObj.message_type==this.msgTypes.MSG_TYPE_CHUNK){
messageItem.content += msgObj.data
} else if (msgObj.message_type == this.msgTypes.MSG_TYPE_STEP_START){
messageItem.steps.push({"message":msgObj.data,"done":false})
console.log(msgObj.metadata)
messageItem.steps.push({"message":msgObj.data,"done":false, "status":true })
} else if (msgObj.message_type == this.msgTypes.MSG_TYPE_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.data);
if (matchingStep) {
matchingStep.done = true;
matchingStep.status=msgObj.metadata.status
}
} else if (msgObj.message_type == this.msgTypes.MSG_TYPE_EXCEPTION) {
this.$refs.toast.showToast(msgObj.data, 5, false)

View File

@ -697,6 +697,28 @@
</button>
</td>
</tr>
<tr>
<td style="min-width: 200px;">
<label for="audio_pitch" class="text-sm font-bold" style="margin-right: 1rem;">audio pitch:</label>
</td>
<td>
<input id="audio_pitch" v-model="audio_pitch"
type="range" min="0" max="10" step="0.1"
class="flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500">
<p
class="mt-1 px-2 py-1 border border-gray-300 rounded"
>{{ audio_pitch }}</p>
</td>
<td>
<button
class="hover:text-secondary bg-blue-100 m-2 p-2 duration-75 flex justify-center w-full hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg"
@click="update_setting('audio_pitch', audio_pitch)"
>
<i data-feather="check"></i>
</button>
</td>
</tr>
<tr>
<td style="min-width: 200px;">
@ -3110,6 +3132,15 @@ export default {
this.$store.state.config.auto_speak = value
},
},
audio_pitch:{
get() {
return this.$store.state.config.audio_pitch;
},
set(value) {
// You should not set the value directly here; use the updateSetting method instead
this.$store.state.config.audio_pitch = value
},
},
audio_in_language:{
get() {
return this.$store.state.config.audio_in_language;