From b50ca95e049e9fb9112b882a35705df9cf53b440 Mon Sep 17 00:00:00 2001
From: AndzejsP
Date: Fri, 16 Jun 2023 13:14:22 +0300
Subject: [PATCH 1/3] 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 2/3] 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 3/3] 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