Repository navigation
fix: 粘贴图片改经 put_task 传递,不再 monkey-patch backend.ask - #827
Open
ZexinLiang wants to merge 1 commit into
Open
ZexinLiang wants to merge 1 commit into
ZexinLiang wants to merge 1 commit into
Conversation
….ask Patching backend.ask raised AttributeError on MixinSession (read-only .ask). Images now travel as task data: put_task(images=...) -> build_image_content -> agent_runner_loop(initial_user_content=...), with size/count caps so oversized files fall back to path references. Also keep non-text blocks (images) when filtering whitespace-only content in NativeToolClient.chat. Closes lsdefine#824
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.
问题
Fixes #824 —— 桌面端粘贴图片后,当模型后端为
MixinSession时抛出AttributeError(其.ask是节点相关的只读属性,不能被运行时替换)。修改
_patch_chat_for_images(monkey-patch 方案,-41 行),图片改为put_task(prompt, images=...)随任务传递。build_image_content,在首轮用户消息中构造多模态内容;限制单图 10MB、总量 20MB、最多 8 张,超限图片不读入内存,回退为文件路径文本,附件不丢失。NativeToolClient.chat过滤空白文本块时保留图片等非文本块。测试
274 passed, 3 deselected(frontends/tests 全套)