diff --git a/web/src/components/Toast.vue b/web/src/components/Toast.vue
index 48bd600b..3ae73388 100644
--- a/web/src/components/Toast.vue
+++ b/web/src/components/Toast.vue
@@ -5,6 +5,16 @@
role="alert">
+
+
+ Check icon
+
+
+
+ Cross icon
+
+ {{ message }}
@@ -19,6 +29,7 @@
clip-rule="evenodd">
+
@@ -34,12 +45,23 @@ export default {
data() {
return {
show: false,
+ success: true,
+ message: ''
};
},
methods: {
close() {
this.$emit('close')
this.show = false
+ },
+ showToast(message, duration_s=3, success= true){
+ this.success = success;
+ this.message = message;
+ this.show = true;
+ setTimeout(() => {
+ this.$emit('close')
+ this.show = false
+ }, duration_s*1000);
}
},
watch: {
diff --git a/web/src/views/DiscussionsView.vue b/web/src/views/DiscussionsView.vue
index 3f3159a9..d19eea40 100644
--- a/web/src/views/DiscussionsView.vue
+++ b/web/src/views/DiscussionsView.vue
@@ -131,13 +131,7 @@
-
-
-
- Check icon
-
- Message content copied to clipboard!
+
@@ -166,7 +160,7 @@ export default {
isSelectAll: false,
showConfirmation: false,
chime: new Audio("chime_aud.wav"),
- isCopiedToClipboard: false,
+ showToast: false,
isSearch: false,
isDiscussionBottom: false,
}
@@ -434,7 +428,8 @@ export default {
// "message":message,#markdown.markdown(message),
// "user_message_id": self.current_user_message_id,
// "ai_message_id": self.current_ai_message_id,
- if(msg["status"]=="generation_started"){
+ console.log(msgObj);
+ if(msgObj["status"]=="generation_started"){
this.updateLastUserMsg(msgObj)
// Create response message
let responseMessage = {
@@ -463,7 +458,10 @@ export default {
console.log("infos", msgObj)
}
else{
- alert("It seems that no model has been loaded. Please download and install a model first, then try again.");
+ this.$refs.toast.showToast("It seems that no model has been loaded. Please download and install a model first, then try again.",4, false)
+ this.isGenerating = false
+ this.setDiscussionLoading(this.currentDiscussion.id, this.isGenerating)
+ this.chime.play()
}
},
sendMsg(msg) {
@@ -750,15 +748,14 @@ export default {
this.chime.play()
},
copyToClipBoard(content) {
-
- this.isCopiedToClipboard = true
+ this.$refs.toast.showToast("Copied to clipboard successfully")
nextTick(() => {
feather.replace()
})
},
closeToast() {
- this.isCopiedToClipboard = false
+ this.showToast = false
},