From b50ca95e049e9fb9112b882a35705df9cf53b440 Mon Sep 17 00:00:00 2001 From: AndzejsP Date: Fri, 16 Jun 2023 13:14:22 +0300 Subject: [PATCH 01/26] some fixes --- web/src/components/Message.vue | 6 +++++- web/src/views/DiscussionsView.vue | 10 +++++++--- web/src/views/SettingsView.vue | 19 +++++++++++++++++-- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/web/src/components/Message.vue b/web/src/components/Message.vue index a00bfbda..84162149 100644 --- a/web/src/components/Message.vue +++ b/web/src/components/Message.vue @@ -19,7 +19,7 @@

--> -
+
{{ created_at }}
@@ -307,6 +307,10 @@ export default { created_at() { return this.prettyDate(this.message.created_at) + }, + parsed_date() { + return new Date(Date.parse(this.message.created_at)).toLocaleString() + } } diff --git a/web/src/views/DiscussionsView.vue b/web/src/views/DiscussionsView.vue index 3b7799b6..932f3dac 100644 --- a/web/src/views/DiscussionsView.vue +++ b/web/src/views/DiscussionsView.vue @@ -560,12 +560,14 @@ export default { }, createUserMsg(msgObj) { + let usrMessage = { content: msgObj.message, id: msgObj.id, //parent: 10, rank: 0, - sender: msgObj.user + sender: msgObj.user, + created_at: msgObj.created_at //type: 0 } this.discussionArr.push(usrMessage) @@ -653,7 +655,9 @@ export default { message: msg, id: 0, rank: 0, - user: "user" + user: "user", + created_at: new Date().toLocaleString(), + }; this.createUserMsg(usrMessage); @@ -887,7 +891,7 @@ export default { this.setDiscussionLoading(this.currentDiscussion.id, this.isGenerating); axios.get('/get_generation_status', {}).then((res) => { if (res) { - //console.log(res.data.status); + console.log(res); if (!res.data.status) { socket.emit('generate_msg_from', { prompt: msg, id: msgId }); diff --git a/web/src/views/SettingsView.vue b/web/src/views/SettingsView.vue index 46a6915c..ed97a7db 100644 --- a/web/src/views/SettingsView.vue +++ b/web/src/views/SettingsView.vue @@ -162,7 +162,8 @@

- {{ configFile.binding_name }} + + {{binding_name}}

@@ -329,6 +330,11 @@
|
+
+ {{active_pesonality }} + +
+
|
@@ -1380,7 +1386,7 @@ export default { const res = await this.mount_personality(pers.personality) console.log('mount_personality res', res) - if (res.status) { + if (res && res.status) { this.configFile.personalities = res.personalities this.$refs.toast.showToast("Personality mounted", 4, true) pers.isMounted = true @@ -1609,6 +1615,15 @@ export default { return defaultModelImgPlaceholder } }, + binding_name(){ + return this.bindingsArr[this.bindingsArr.findIndex(item=>item.folder === this.configFile.binding_name)].name + + }, + active_pesonality(){ + return this.personalities[this.personalities.findIndex(item => item.full_path ===this.configFile.personalities[this.configFile.active_personality_id])].name + + + } // imgPersonality() { // if (!this.isMounted) { // return From 870f49449a405f1ce8f1173461312ef8f428af5f Mon Sep 17 00:00:00 2001 From: AndzejsP Date: Fri, 16 Jun 2023 13:51:04 +0300 Subject: [PATCH 02/26] more fixes --- web/src/views/SettingsView.vue | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/web/src/views/SettingsView.vue b/web/src/views/SettingsView.vue index ed97a7db..74634c32 100644 --- a/web/src/views/SettingsView.vue +++ b/web/src/views/SettingsView.vue @@ -1616,11 +1616,30 @@ export default { } }, binding_name(){ - return this.bindingsArr[this.bindingsArr.findIndex(item=>item.folder === this.configFile.binding_name)].name + if (!this.isMounted) { + return + } + const index =this.bindingsArr.findIndex(item=>item.folder === this.configFile.binding_name) + if(index>-1){ + return this.bindingsArr[index].name + + }else{ + return + } }, active_pesonality(){ - return this.personalities[this.personalities.findIndex(item => item.full_path ===this.configFile.personalities[this.configFile.active_personality_id])].name + if (!this.isMounted) { + return + } + const index =this.personalities.findIndex(item => item.full_path ===this.configFile.personalities[this.configFile.active_personality_id]) + if (index>-1){ + return this.personalities[index].name + }else{ + return + + } + } From 584f70edff911b998c010c78b7106d08377e417b Mon Sep 17 00:00:00 2001 From: AndzejsP Date: Fri, 16 Jun 2023 18:22:39 +0300 Subject: [PATCH 03/26] added copy message infos --- web/src/components/Message.vue | 52 +++++++++++++++++++++-- web/src/views/DiscussionsView.vue | 70 +++++++++++++++++++++++-------- 2 files changed, 102 insertions(+), 20 deletions(-) diff --git a/web/src/components/Message.vue b/web/src/components/Message.vue index 84162149..293c51e2 100644 --- a/web/src/components/Message.vue +++ b/web/src/components/Message.vue @@ -19,7 +19,7 @@

-->
-
+
{{ created_at }}
@@ -105,6 +105,8 @@

Binding: {{ message.binding }}

Model: {{ message.model }}

Seed: {{ message.seed }}

+

Time spent: {{ time_spent }}

@@ -174,7 +176,7 @@ export default { this.expanded = !this.expanded; }, copyContentToClipboard() { - this.$emit('copy', this.message.content) + this.$emit('copy', this) }, deleteMsg() { @@ -308,9 +310,53 @@ export default { return this.prettyDate(this.message.created_at) }, - parsed_date() { + created_at_parsed() { return new Date(Date.parse(this.message.created_at)).toLocaleString() + }, + finished_generating_at_parsed() { + return new Date(Date.parse(this.message.finished_generating_at)).toLocaleString() + + }, + + time_spent() { + const startTime = new Date(Date.parse(this.message.created_at)) + const endTime = new Date(Date.parse(this.message.finished_generating_at)) + //const spentTime = new Date(endTime - startTime) + + + let timeDiff = endTime.getTime() - startTime.getTime(); + const hours = Math.floor(timeDiff / (1000 * 60 * 60)); + + timeDiff -= hours * (1000 * 60 * 60); + + + + const mins = Math.floor(timeDiff / (1000 * 60)); + + timeDiff -= mins * (1000 * 60); + + const secs = Math.floor(timeDiff / 1000) + timeDiff -= secs * 1000; + + + + // let spentTime = Math.floor((endTime.getTime() - startTime.getTime()) / 1000); + // const result = spentTime.getSeconds(); + + function addZero(i) { + if (i < 10) { i = "0" + i } + return i; + } + + // const d = new Date(); + // let h = addZero(spentTime.getHours()); + // let m = addZero(spentTime.getMinutes()); + // let s = addZero(spentTime.getSeconds()); + const time = addZero(hours) + "h:" + addZero(mins) + "m:" + addZero(secs)+'s'; + + return time + } } diff --git a/web/src/views/DiscussionsView.vue b/web/src/views/DiscussionsView.vue index 932f3dac..ec4dfedf 100644 --- a/web/src/views/DiscussionsView.vue +++ b/web/src/views/DiscussionsView.vue @@ -168,15 +168,15 @@ :class="isDragOverChat ? 'pointer-events-none' : ''"> -
+
- - + + @@ -496,7 +496,7 @@ export default { nextTick(() => { - const discussionitem =document.getElementById('dis-'+this.currentDiscussion.id) + const discussionitem = document.getElementById('dis-' + this.currentDiscussion.id) //this.scrollToElement(discussionitem) @@ -517,17 +517,17 @@ export default { } }, scrollToElementInContainer(el, containerId) { - const topPos = el.offsetTop ; //+ el.clientHeight + const topPos = el.offsetTop; //+ el.clientHeight const container = document.getElementById(containerId) - // console.log(el.offsetTop , el.clientHeight, container.clientHeight) + // console.log(el.offsetTop , el.clientHeight, container.clientHeight) container.scrollTo( - { - top: topPos, - behavior: "smooth", - } - ) + { + top: topPos, + behavior: "smooth", + } + ) }, scrollBottom(el) { @@ -603,12 +603,14 @@ export default { if (msgObj["status"] == "generation_started") { this.updateLastUserMsg(msgObj) // Create response message + let responseMessage = { content: "✍ please stand by ...",//msgObj.message, id: msgObj.ai_message_id, parent: msgObj.user_message_id, rank: 0, sender: msgObj.bot, + created_at: new Date().toLocaleString(), //type: msgObj.type } this.discussionArr.push(responseMessage) @@ -656,8 +658,8 @@ export default { id: 0, rank: 0, user: "user", - created_at: new Date().toLocaleString(), - + created_at: new Date().toLocaleString(), + }; this.createUserMsg(usrMessage); @@ -938,9 +940,43 @@ export default { this.setDiscussionLoading(this.currentDiscussion.id, this.isGenerating) this.chime.play() }, - copyToClipBoard(content) { + copyToClipBoard(messageEntry) { this.$refs.toast.showToast("Copied to clipboard successfully", 4, true) - navigator.clipboard.writeText(content); + + let binding ="" + if(messageEntry.message.binding){ + binding= `Binding: ${messageEntry.message.binding}` + } + let personality="" + if(messageEntry.message.personality){ + personality= `\nPersonality: ${messageEntry.message.personality}` + } + let time="" + if(messageEntry.created_at_parsed){ + time= `\nCreated: ${messageEntry.created_at_parsed}` + } + let content="" + if(messageEntry.message.content){ + content= messageEntry.message.content + } + let model="" + if(messageEntry.message.model){ + model= `Model: ${messageEntry.message.model}` + } + let seed="" + if(messageEntry.message.seed){ + seed= `Seed: ${messageEntry.message.seed}` + } + let time_spent="" + if(messageEntry.time_spent){ + time_spent= `\nTime spent: ${messageEntry.time_spent}` + } + let bottomRow = '' + bottomRow = `${binding} ${model} ${seed} ${time_spent}`.trim() + const result = `${messageEntry.message.sender}${personality}${time}\n\n${content}\n\n${bottomRow}` + + + navigator.clipboard.writeText(result); nextTick(() => { feather.replace() @@ -1154,8 +1190,8 @@ export default { }, async activated() { - -console.log('settings changed',this.$store.state.mountedPersonalities) + + //console.log('settings changed', this.$store.state.mountedPersonalities) // This lifecycle hook runs every time you switch from other page back to this page (vue-router) // To fix scrolling back to last message, this hook is needed. // If anyone knows hor to fix scroll issue when changing pages, please do fix it :D From f5468861559796868b80d9379f2caea486ee9b29 Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Fri, 16 Jun 2023 22:19:39 +0200 Subject: [PATCH 04/26] u^dated --- api/__init__.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/api/__init__.py b/api/__init__.py index 5ce25447..98f475d4 100644 --- a/api/__init__.py +++ b/api/__init__.py @@ -876,7 +876,16 @@ class LoLLMsAPPI(): self.socketio.emit('final', { 'data': self.bot_says, 'ai_message_id':self.current_ai_message_id, - 'parent':self.current_user_message_id, 'discussion_id':self.current_discussion.discussion_id + 'parent':self.current_user_message_id, 'discussion_id':self.current_discussion.discussion_id, + "status":'model_not_ready', + "type": "input_message_infos", + 'logo': "", + "bot": self.personality.name, + "user": self.personality.user_name, + "message":self.bot_says, + "user_message_id": self.current_user_message_id, + "ai_message_id": self.current_ai_message_id, + }, room=self.current_room_id ) From 0d2d74fb33cb98744b3297badeef05c9230f9c60 Mon Sep 17 00:00:00 2001 From: AndzejsP Date: Sat, 17 Jun 2023 11:43:31 +0300 Subject: [PATCH 05/26] fixed apply status --- web/src/components/TopBar.vue | 2 +- web/src/views/SettingsView.vue | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/web/src/components/TopBar.vue b/web/src/components/TopBar.vue index 6fdfed30..bca30ec9 100644 --- a/web/src/components/TopBar.vue +++ b/web/src/components/TopBar.vue @@ -6,7 +6,7 @@
Logo -

lollms-webui

+

Lord of Large Language Models: One tool to rule them all

diff --git a/web/src/views/SettingsView.vue b/web/src/views/SettingsView.vue index 74634c32..d3c12f0e 100644 --- a/web/src/views/SettingsView.vue +++ b/web/src/views/SettingsView.vue @@ -1149,19 +1149,12 @@ export default { }) }, applyConfiguration() { - // if (!this.configFile.model_name) { - // this.$refs.toast.showToast("Configuration changed failed.\nPlease select model first", 4, false) - // nextTick(() => { - // feather.replace() - // }) - // return - // } this.isLoading = true; axios.post('/apply_settings').then((res) => { this.isLoading = false; - - if (res.data.status === "succeeded") { + //console.log('apply-res',res) + if (res.data.status) { this.$refs.toast.showToast("Configuration changed successfully.", 4, true) this.settingsChanged = false From 29a3e161940ae63d90a3452d8b734891f4e726e2 Mon Sep 17 00:00:00 2001 From: AndzejsP Date: Sat, 17 Jun 2023 13:53:40 +0300 Subject: [PATCH 06/26] made yesand no upgrades --- web/src/components/Navigation.vue | 35 +++++++-- web/src/components/YesNoDialog.vue | 15 ++-- web/src/main.js | 11 +-- web/src/views/DiscussionsView.vue | 2 +- web/src/views/SettingsView.vue | 112 +++++++++++++++-------------- 5 files changed, 105 insertions(+), 70 deletions(-) diff --git a/web/src/components/Navigation.vue b/web/src/components/Navigation.vue index 9f1f1be0..4dcdf2a6 100644 --- a/web/src/components/Navigation.vue +++ b/web/src/components/Navigation.vue @@ -4,28 +4,33 @@
  • - + Discussions
  • - + Settings
  • - + Extensions
  • - + Training
  • - + Help
  • @@ -35,7 +40,25 @@ + \ No newline at end of file diff --git a/web/src/components/YesNoDialog.vue b/web/src/components/YesNoDialog.vue index 33199a2a..1cc7f9bc 100644 --- a/web/src/components/YesNoDialog.vue +++ b/web/src/components/YesNoDialog.vue @@ -1,7 +1,7 @@