Repository navigation
飞书:收件箱显示头像、读图把图片直接给模型、渠道能发图 - #22
Merged
Merged
Conversation
… the channel sends pictures - Inbox rows and conversation pages carry the chat's picture (InboxThing.avatar, nwverse/persona#10923): a group's own, a direct chat's other person's, as Feishu's https address by its key. The core asks a backend with has_avatars in the background, once a day per chat, and tells the Inbox when one changed. Kept in a table of its own; another account's sign-in forgets them. WeChat's backend says none: nothing asked, rows as before. - matefeishu_media hands the pictures themselves to the model when the hub lists tool_images (nwverse/persona#8511), within the hub's limits (modelimages: drawn again smaller with Pillow or sips, else left out and said so). - The Feishu channel declares images_out (nwverse/persona#11986): channel.send's pictures follow the text, where it was asked, each once. The backend uploads a picture as the web client does (the file host's /api/image, its cryptoToken) and sends it where a text would go; an /agent reply's picture goes where its text went. A picture's echo in the channel chat is never the user's line. - The guard that an answer goes only under a line handed over (larkx 0.2.1, nwverse/persona-extensions#533) holds; a regression test covers the cases of #531. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… a ref only to its chat, pictures checked whole - send_image posts only with the session that uploaded the picture (another account's sign-in meanwhile: nothing sent); pictures take to_chat as their text does. - channel.send: a picture's journal key is a namespace of its own (no text ref can share it); what is left of a ref goes only to the chat its first part went to; a replay answers the same id; pictures that are all no PNG or JPEG with no text are invalid_params; no answer under a line Persona refused. - A picture's echo is marked only where the channel sends pictures (WeChat's: never), and only while it is sent. - matefeishu_media gives the bytes it downloaded (never read back from the file), and nothing fetched while another account signed in. - modelimages: with Pillow, a picture goes as it is only when it decodes whole, has one frame and no EXIF turn; a huge one is not drawn again; one drawn again stays upright. - Avatars: a record without the field (or a direct chat whose other person is not known) says nothing, so a known picture stays; a list's row asks nothing of the service. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…once, WeChat's echo ids as before - An /agent reply's picture is keyed by the request the reply names, as its text is: asked again after it went under a follow-up, it is not sent a second time under the first request. - A channel picture's journal key is its bytes (Persona may give a ref's pictures again in another order); in a group showing topics, the pictures of a push go into the topic its first part opened. - A picture's echo id is written as before on every platform; only the standing-in while it is sent is the channel's with images_out, and an outcome not known keeps it standing. - The reply guard is as it was (WeChat unchanged). - The Feishu session is taken before the file is read; matefeishu_media writes nothing for an account signed out meanwhile; a page opened asks for its chat's picture; a direct chat kept from a list asks for its person's picture on its own read; a picture too big for Pillow is not handed to sips either. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e is two, pictures checked to their end - An /agent reply's picture is keyed by its reply (the request it names and its text) and its bytes: the same reply asked again never sends it twice, another reply's picture is its own. - A channel.send's pictures are keyed by their bytes and their turn among equal ones (the same picture twice is sent twice); a picture whose outcome is not known stands for its echo two minutes, not ten. - No picture goes, and matefeishu_media fetches nothing, while a sign-in is being taken in. - The core asks a chat's picture of the service now (chat_picture), never of a row kept from a list. - modelimages: a PNG or JPEG cut before its end is not sent as it is; Pillow's refusal of a huge picture keeps it from sips too; a 16-bit picture drawn again keeps its levels. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t as before) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he Inbox, pictures straight to the model, the Feishu channel sends pictures Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
线上实测(openmate-feishu 0.11.44 / openmate-wechat 0.1.42)
🤖 Generated with Claude Code |
Merged
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.
做了什么
对齐 Persona 上游的三项新能力(只改飞书;微信扩展因为 core 改动跟着升版本,行为不变)。
1. 头像(nwverse/persona#10923、#11627)
InboxThing.avatar:群用群头像,私聊用对方的头像;会话页thread.page的chat.avatar也带上。{file_host}/static-resource/v1/<key>~?image_size=240x240…。这个地址不用登录态就能取到(实测匿名返回 200 和 240×240 的 JPEG),Persona 自己去抓、缓存,不经过扩展的thread.media。chats.PullChatsByIdsRequest返回的avatar.key;私聊如果会话本身没有头像,就用chatters.PullChattersByIdsRequest查对方的avatar.key。has_avatars后,收件箱读到还没有头像、或头像已经超过一天的会话,就在后台去问(每轮最多 30 个,失败的一小时后再问),收件箱的读取不会等它。connector.changed(inbox),让 hub 重新读这些行。avatars表里,不改旧表,回滚也安全;换账号时一起清掉;后台刷新只写头像,不动会话的其他字段(比如静音)。has_avatars,所以不问、不带头像。2. 读图时把图片直接给模型(nwverse/persona#8511)
initialize时记下hub.capabilities。hub 列出tool_images时,matefeishu_media的结果会多带images,模型直接看到图片,本地文件路径照常给出。core/openmate_core/modelimages.py,按 hub 的限制处理图片:单张 1 MiB、单边 2000px,每次合计最多 16 张、4 MiB、800 万像素。tool_images时,只回文字,和以前一样。3. 渠道发图(nwverse/persona#11986,
images_out)send_image,流程照飞书网页端:{file_host}/api/image(multipart 字段image,带会话 cookie),拿到pan.PutImageResponse.cryptoToken。PutMessageRequest(type=5,content.cryptoToken)发出。send()。SendRejected,什么都没发。images_out: true,channel.send的images跟在文字后面发,落在文字所在的位置:/agent回复带的图片也改成跟文字落在同一处(只在后端声明image_threads时)。微信不声明,仍然发到会话里。核实:只回 /agent 请求的守卫(larkx 0.2.1,nwverse/persona-extensions#533)
channel.send带reply_to时,被回复的消息必须是从渠道会话转交过的行(channel_msgs.dir == "in"),否则就是cannot_send。test_an_answer_only_to_a_line_handed_over_not_to_any_line_of_the_users。回复以下几类消息都会被拒:渠道之前发出的回答、工具发出去的回显、别的 AI 写的行。怎么验证的
bash scripts/test.sh全部通过;另外用OPENMATE_LARKX_PYTHON指向真实的 LarkAgentX,冒烟测试也通过:用真 protobuf 核对了 IMAGE 包、上传回包里的长 token、头像地址。tests/test_avatars.pytests/test_modelimages.pytests/test_feishu_media.py(3 条)tests/test_channel.py(PicturesOutTest5 条,守卫 1 条)tests/test_agent_image.py(1 条)extensions/openmate-feishu/tests/test_larkagentx.py(PictureTest4 条)没做什么
🤖 Generated with Claude Code