mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 13:27:08 +00:00
fix: add mimetype for claude
This commit is contained in:
parent
f8591eba03
commit
66281fc53e
1 changed files with 6 additions and 2 deletions
|
|
@ -44,9 +44,11 @@ export async function intoUserMessage (e, options = {}) {
|
|||
if (val.type === 'image' && handleReplyImage) {
|
||||
const res = await fetch(val.url)
|
||||
if (res.ok) {
|
||||
const mimeType = res.headers.get('content-type') || 'image/jpeg'
|
||||
contents.push({
|
||||
type: 'image',
|
||||
image: Buffer.from(await res.arrayBuffer()).toString('base64')
|
||||
image: Buffer.from(await res.arrayBuffer()).toString('base64'),
|
||||
mimeType
|
||||
})
|
||||
} else {
|
||||
logger.warn(`fetch image ${val.url} failed: ${res.status}`)
|
||||
|
|
@ -83,9 +85,11 @@ export async function intoUserMessage (e, options = {}) {
|
|||
for (let element of e.message?.filter(element => element.type === 'image')) {
|
||||
const res = await fetch(element.url)
|
||||
if (res.ok) {
|
||||
const mimeType = res.headers.get('content-type') || 'image/jpeg'
|
||||
contents.push({
|
||||
type: 'image',
|
||||
image: Buffer.from(await res.arrayBuffer()).toString('base64')
|
||||
image: Buffer.from(await res.arrayBuffer()).toString('base64'),
|
||||
mimeType
|
||||
})
|
||||
} else {
|
||||
logger.warn(`fetch image ${element.url} failed: ${res.status}`)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue