mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 13:27:08 +00:00
Enhance image processing logic in message.js
Refactor image handling to support base64 and HTTP URLs.
This commit is contained in:
parent
602e192bff
commit
dc1ab30b6a
1 changed files with 8 additions and 1 deletions
|
|
@ -200,7 +200,14 @@ export async function toYunzai (e, contents) {
|
|||
break
|
||||
}
|
||||
case 'image': {
|
||||
msgs.push(segment.image((/** @type {import('chaite').ImageContent} **/ content).image))
|
||||
const imageContent = (/** @type {import('chaite').ImageContent} **/ content).image
|
||||
if (imageContent.startsWith('http')) {
|
||||
msgs.push(segment.image(imageContent))
|
||||
} else if (!imageContent.startsWith('base64')) {
|
||||
msgs.push(`base64://${imageContent}`)
|
||||
} else {
|
||||
msgs.push(segment.image(imageContent))
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'audio': {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue