diff --git a/src/pages/chats/[id]/index.vue b/src/pages/chats/[id]/index.vue index 4137052..210d022 100644 --- a/src/pages/chats/[id]/index.vue +++ b/src/pages/chats/[id]/index.vue @@ -110,6 +110,18 @@ const fileUpload = ref(); const uploading = ref(false); const imageBaseUrl = config.backend + "/api/v1/files"; +document.addEventListener("paste", function (event) { + const items = event.clipboardData && event.clipboardData.items; + if (items && items.length) { + for (let i = 0; i < items.length; i++) { + if (items[i].type.indexOf("image") !== -1) { + fileUpload.value = items[i].getAsFile(); + break; + } + } + } +}); + function sendMessage() { if (input.value !== "") { toolError.value = false; diff --git a/src/pages/public_chat/index.vue b/src/pages/public_chat/index.vue index f0e0024..16f7a07 100644 --- a/src/pages/public_chat/index.vue +++ b/src/pages/public_chat/index.vue @@ -141,6 +141,18 @@ const toolError = ref(false); const toolCalling = ref(false); const fileUpload = ref(); +document.addEventListener("paste", function (event) { + const items = event.clipboardData && event.clipboardData.items; + if (items && items.length) { + for (let i = 0; i < items.length; i++) { + if (items[i].type.indexOf("image") !== -1) { + fileUpload.value = items[i].getAsFile(); + break; + } + } + } +}); + function sendMessage() { if (input.value !== "") { toolError.value = false;