fix: 修复 aiocqhttp / OneBot 图片消息在图像转述场景下的问题#98
Open
pazmiller wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix: 修复 aiocqhttp / OneBot 图片消息在图像转述场景下的问题
修复 aiocqhttp / OneBot 图片消息在图像转述场景下的两个问题。
在部分平台中,
Image.file可能只是图片文件名,例如xxxx.jpg,不是可直接读取的本地路径。实际可用的图片路径需要通过 AstrBot 消息组件的convert_to_file_path()解析。直接把裸文件名传给提供商时,可能导致图像转述拿到空图片内容,表现为图片被识别为空,被忽略,或者直接报错。实际调试时可以看到后台连续提示收到图片,但图片内容为空。本次修改在图像转述前使用
convert_to_file_path()解析图片路径,避免empty payload当
use_image_caption启用时,预期流程应为:但原逻辑仍会把当前消息图片加入
image_urls,直接发送给主聊天模型。如果主聊天模型不支持图片输入(比如现在流行的DSV4),就可能出现unknown variant image_url, expected text等错误。本次修改在use_image_caption启用时跳过当前的图片直传主模型,让图片走图像转述模型。