mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 21:37:11 +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
|
break
|
||||||
}
|
}
|
||||||
case 'image': {
|
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
|
break
|
||||||
}
|
}
|
||||||
case 'audio': {
|
case 'audio': {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue