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

@@ -39,22 +39,22 @@ M.parse_message = function(opts)
table.insert(message_content, selected_code_obj)
end
table.insert(message_content, {
type = "text",
text = string.format("<question>%s</question>", opts.question),
})
if Config.behaviour.support_paste_from_clipboard and Clipboard.has_content() then
if Clipboard.support_paste_image() and opts.image_path then
table.insert(message_content, {
type = "image",
source = {
type = "base64",
media_type = "image/png",
data = Clipboard.get_base64_content(),
data = Clipboard.get_base64_content(opts.image_path),
},
})
end
table.insert(message_content, {
type = "text",
text = string.format("<question>%s</question>", opts.question),
})
local user_prompt = opts.base_prompt
local user_prompt_obj = {