feat: pasting image within buffer (#331)

Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
This commit is contained in:
Aaron Pham
2024-08-28 14:43:14 -04:00
committed by GitHub
parent 46a621e9de
commit c635f73748
12 changed files with 166 additions and 295 deletions

View File

@@ -63,12 +63,12 @@ end
M.parse_message = function(opts)
---@type string | OpenAIMessage[]
local user_content
if Config.behaviour.support_paste_from_clipboard and Clipboard.has_content() then
if Config.behaviour.support_paste_from_clipboard and opts.image_path then
user_content = {}
table.insert(user_content, {
type = "image_url",
image_url = {
url = "data:image/png;base64," .. Clipboard.get_base64_content(),
url = "data:image/png;base64," .. Clipboard.get_base64_content(opts.image_path),
},
})
table.insert(user_content, { type = "text", text = M.get_user_message(opts) })