Repository navigation
fix: 修复暂停态带图插话丢失图片 - #4
Merged
Merged
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.
问题
暂停态下带图插话时,插件只把草稿文字作为插话放行,图片完全没有进入放行请求。结果是文字先被当插话发走,图片仍留在输入框里,下一次 Enter 才单独发出去;如果只带图不带字,按 Enter 只是继续,图片原样残留。
原因
浏览器侧 release 只读
InputState.draft,忽略InputState.attachmentIds;主机侧 release 也只接受文字,没有把附件准入成持久引用。RPC 请求体上限还是 8 MiB,带图本身也传不过去。改动
serializeDraftAttachments序列化草稿附件,把图片以 base64 随 release 请求提交;放行成功后同时清空草稿与附件,失败则在控件旁显示原因并保持暂停。attachments.admitPromptContent换成持久引用,与文字合成同一条 user 消息并入本次 pre-step。测试
pnpm typecheck、pnpm test38 项全过、pnpm build通过。兼容性
attachments.admitPromptContent与conversation.serializeDraftAttachments,未改 DSH 源码。检查清单