enhanced ui

This commit is contained in:
Saifeddine ALOUI 2024-06-26 01:27:29 +02:00
parent 17b9429b1d
commit 95f0bae21f
11 changed files with 76 additions and 24 deletions

View File

@ -1,5 +1,5 @@
# =================== Lord Of Large Language Multimodal Systems Configuration file ===========================
version: 118
version: 120
binding_name: null
model_name: null
model_variant: null
@ -249,6 +249,8 @@ rag_clean_chunks: true #Removed all uinecessary spaces and line returns
rag_follow_subfolders: true #if true the vectorizer will vectorize the content of subfolders too
rag_check_new_files_at_startup: false #if true, the vectorizer will automatically check for any new files in the folder and adds it to the database
rag_preprocess_chunks: false #if true, an LLM will preprocess the content of the chunk before writing it in a simple format
rag_activate_multi_hops: false #if true, we use multi hops algorithm to do multiple researches until the AI has enough data
rag_min_nb_tokens_in_chunk: 10 #this removed any useless junk ith less than x tokens
activate_skills_lib: false # Activate vectorizing previous conversations
skills_lib_database_name: "default" # Default skills database

@ -1 +1 @@
Subproject commit 09d80f12da1107af16ffbdbd862e939f82f968e3
Subproject commit cb32fcb4742beb3e56dc4e61fdde965f7726bafc

View File

@ -1087,6 +1087,14 @@ class LOLLMSWebUI(LOLLMSElfServer):
# Stream the generated text to the main process
elif message_type == MSG_TYPE.MSG_TYPE_FULL:
if self.nb_received_tokens==0:
self.start_time = datetime.now()
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")
client.generated_text = chunk
antiprompt = self.personality.detect_antiprompt(client.generated_text)
if antiprompt:
@ -1308,11 +1316,34 @@ class LOLLMSWebUI(LOLLMSElfServer):
print()
self.cancel_gen = False
sources_text = ""
if len(context_details["documentation_entries"]) > 0:
sources_text += '<div class="text-gray-400 mr-10px">Sources:</div>'
sources_text += '<div class="mt-4 flex flex-col items-start gap-x-2 gap-y-1.5 text-sm" style="max-height: 500px; overflow-y: auto;">'
for source in context_details["documentation_entries"]:
title = source["document_title"]
path = source["document_path"]
content = source["chunk_content"]
size = source["chunk_size"]
distance = source["distance"]
sources_text += f'''
<div class="source-item">
<button onclick="var details = document.getElementById('source-details-{title}'); details.style.display = details.style.display === 'none' ? 'block' : 'none';" style="text-align: left; font-weight: bold;"><strong>{title}</strong></button>
<div id="source-details-{title}" style="display:none;">
<p><strong>Path:</strong> {path}</p>
<p><strong>Content:</strong> {content}</p>
<p><strong>Size:</strong> {size}</p>
<p><strong>Distance:</strong> {distance}</p>
</div>
</div>
'''
sources_text += '</div>'
self.personality.ui(sources_text)
# Send final message
if self.config.activate_internet_search or force_using_internet or generation_type == "full_context_with_internet":
from lollms.internet import get_favicon_url, get_root_url
sources_text = '<div class="mt-4 flex flex-wrap items-center gap-x-2 gap-y-1.5 text-sm ">'
sources_text += '<div class="mt-4 flex flex-wrap items-center gap-x-2 gap-y-1.5 text-sm ">'
sources_text += '<div class="text-gray-400 mr-10px">Sources:</div>'
for source in internet_search_infos:
url = source["url"]
@ -1329,11 +1360,13 @@ class LOLLMSWebUI(LOLLMSElfServer):
f'</a>',
])
sources_text += '</div>'
client.generated_text=client.generated_text.split(f"{start_header_id_template}")[0] + "\n" + sources_text
self.personality.full(client.generated_text)
self.personality.ui(sources_text)
except Exception as ex:
trace_exception(ex)
self.update_message(client_id, "Generating ...", msg_type=MSG_TYPE.MSG_TYPE_STEP_END)
try:
self.update_message(client_id, "Generating ...", msg_type=MSG_TYPE.MSG_TYPE_STEP_END, parameters= {'status':True})
except Exception as ex:
ASCIIColors.warning("Couldn't send status update to client")
self.close_message(client_id)
client.processing=False

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-fcacc2dd.js"></script>
<link rel="stylesheet" href="/assets/index-f9292296.css">
<script type="module" crossorigin src="/assets/index-be013c6f.js"></script>
<link rel="stylesheet" href="/assets/index-9de3a734.css">
</head>
<body>
<div id="app"></div>

View File

@ -17,8 +17,7 @@ export default {
watch: {
code: {
handler(newCode) {
// Extract and evaluate script tags from the new code
console.log("Code changed")
console.log("Code changed");
this.evaluateScriptTags(newCode);
this.componentKey++;
},
@ -44,7 +43,11 @@ export default {
// Set the evaluated code to the modified HTML
this.evaluatedCode = tempDiv.innerHTML;
console.log("evaluated code: " + this.evaluatedCode)
// Force a re-render by updating the component key
this.$nextTick(() => {
this.componentKey++;
});
},
},
};

View File

@ -765,7 +765,6 @@ export default {
},
'message.ui': function (newContent) {
console.log("ui changed")
console.log(this.message.ui)
},
showConfirmation() {
nextTick(() => {

View File

@ -47,7 +47,10 @@
:on-settings="onSettingsPersonality"
:on-reinstall="onPersonalityReinstall"
:on-talk="handleOnTalk"
:on-copy-personality-name="onCopyPersonalityName"
:on-copy-to_custom="onCopyToCustom"
:on-open-folder="handleOpenFolder"
/>
</TransitionGroup>
</div>
@ -165,6 +168,14 @@ export default {
},
},
methods: {
async onCopyToCustom(pers) {
await axios.post("/copy_to_custom_personas",{client_id:this.$store.state.client_id, category: pers.personality.category, name: pers.personality.name})
},
onCopyPersonalityName(personality) {
this.$store.state.toast.showToast("Copied name to clipboard!", 4, true)
navigator.clipboard.writeText(personality.name);
},
toggleShowPersList() {
//this.show = !this.show
this.onShowPersList()

View File

@ -3598,6 +3598,7 @@
:on-reinstall="onPersonalityReinstall"
:on-settings="onSettingsPersonality"
:on-copy-personality-name="onCopyPersonalityName"
:on-copy-to_custom="onCopyToCustom"
:on-open-folder="handleOpenFolder"
/>
</TransitionGroup>
@ -4845,6 +4846,9 @@ export default {
this.$store.state.toast.showToast("Copied name to clipboard!", 4, true)
navigator.clipboard.writeText(personality.name);
},
async onCopyToCustom(pers) {
await axios.post("/copy_to_custom_personas",{client_id:this.$store.state.client_id, category: pers.personality.category, name: pers.personality.name})
},
async handleOpenFolder(pers){
await axios.post("/open_personality_folder",{client_id:this.$store.state.client_id, personality_folder: pers.personality.folder})
},

@ -1 +1 @@
Subproject commit 161c404533a2bbbe3058441b6a01c17c26a53b11
Subproject commit 89331b2f72d19592fcac564c627c1b38b7be05f0