fix(feishu): fix video upload failure by using correct message type a…#1577
Closed
BlackLLII wants to merge 1 commit intosipeed:mainfrom
Closed
fix(feishu): fix video upload failure by using correct message type a…#1577BlackLLII wants to merge 1 commit intosipeed:mainfrom
BlackLLII wants to merge 1 commit intosipeed:mainfrom
Conversation
…nd metadata Previously, video files were sent using MsgTypeFile instead of MsgTypeMedia, causing upload to succeed but message display to fail. This fix: - Uses MsgTypeMedia for video and MsgTypeAudio for audio messages - Extracts video thumbnail and duration via ffmpeg/ffprobe before upload - Includes image_key (thumbnail) and duration in video message content
Author
|
Correction: the log I pasted in the description above was wrong. Here is the correct log: The key error: send_file used the wrong upload type for video. Feishu API returned code=230055 — the file upload type does not match the message type being sent. |
This was referenced Mar 15, 2026
|
@BlackLLII Hi! This PR has had no activity for over 2 weeks, so I'm closing it for now to keep things tidy. If it's still relevant, feel free to reopen it anytime and we'll pick it back up. |
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.
…nd metadata
Previously, video files were sent using MsgTypeFile instead of MsgTypeMedia, causing upload to succeed but message display to fail. This fix:
📝 Description
Fix video file upload to Feishu failing to display properly. Previously, video files were sent using
MsgTypeFileinstead ofMsgTypeMedia, causing the upload to succeed but the message to display incorrectly. This PR also extracts video thumbnail and durationmetadata before upload to ensure proper rendering.
🗣️ Type of Change
🤖 AI Code Generation
🔗 Related Issue
📚 Technical Context (Skip for Docs)
MsgTypeMedia(notMsgTypeFile) per Feishu API specMsgTypeMediarequiresimage_key(thumbnail) anddurationfieldsffmpegto extract thumbnail at 0.5s andffprobeto get video duration🧪 Test Environment
📸 Evidence (Optional)
Click to view Logs/Screenshots
2026/03/14 21:15:18 [2026-03-14T13:15:18Z] [INFO] feishu: Feishu message received {sender_id=5ac85cg3, chat_id=oc_3d30ec03d888531a998b06d80d70eca5, message_id=om_x100b5461b89600a4c12c42c6959784d, preview=拍个照}
2026/03/14 21:15:18 [2026-03-14T13:15:18Z] [INFO] agent: Processing message from feishu:feishu:5ac85cg3: 拍个照 {chat_id=oc_3d30ec03d888531a998b06d80d70eca5, sender_id=feishu:5ac85cg3, session_key=, channel=feishu}
2026/03/14 21:15:18 [2026-03-14T13:15:18Z] [INFO] agent: Routed message {agent_id=main, scope_key=agent:main:feishu:direct:5ac85cg3, session_key=agent:main:feishu:direct:5ac85cg3, matched_by=default, route_agent=main, route_channel=feishu}
2026/03/14 21:15:20 [2026-03-14T13:15:20Z] [INFO] agent: LLM requested tool calls {agent_id=main, tools=[exec], count=1, iteration=1}
2026/03/14 21:15:21 [2026-03-14T13:15:21Z] [INFO] agent: Tool call: exec({"command":"libcamera-still -o /tmp/photo.jpg --width 1280 --height 720 --timeout 1 2\u003e\u00261"}) {iteration=1, agent_id=main, tool=exec}
2026/03/14 21:15:21 [2026-03-14T13:15:21Z] [INFO] tool: Tool execution started {tool=exec, args=map[command:libcamera-still -o /tmp/photo.jpg --width 1280 --height 720 --timeout 1 2>&1]}
2026/03/14 21:15:21 [2026-03-14T13:15:21Z] [ERROR] tool: Tool execution failed {tool=exec, duration=4, error=sh: 1: libcamera-still: not found
Exit code: exit status 127}
2026/03/14 21:15:22 [2026-03-14T13:15:22Z] [INFO] agent: LLM requested tool calls {tools=[exec], count=1, iteration=2, agent_id=main}
2026/03/14 21:15:23 [2026-03-14T13:15:23Z] [INFO] agent: Tool call: exec({"command":"fswebcam -r 1280x720 --no-banner /tmp/photo.jpg 2\u003e\u00261"}) {agent_id=main, tool=exec, iteration=2}
2026/03/14 21:15:23 [2026-03-14T13:15:23Z] [INFO] tool: Tool execution started {tool=exec, args=map[command:fswebcam -r 1280x720 --no-banner /tmp/photo.jpg 2>&1]}
2026/03/14 21:15:23 [2026-03-14T13:15:23Z] [ERROR] tool: Tool execution failed {tool=exec, duration=2, error=sh: 1: fswebcam: not found
Exit code: exit status 127}
2026/03/14 21:15:24 [2026-03-14T13:15:24Z] [INFO] agent: LLM requested tool calls {iteration=3, agent_id=main, tools=[exec], count=1}
2026/03/14 21:15:24 [2026-03-14T13:15:24Z] [INFO] agent: Tool call: exec({"command":"ffmpeg -f v4l2 -i /dev/video0 -frames:v 1 -y /tmp/photo.jpg 2\u003e\u00261 | head -20"}) {agent_id=main, tool=exec, iteration=3}
2026/03/14 21:15:24 [2026-03-14T13:15:24Z] [INFO] tool: Tool execution started {tool=exec, args=map[command:ffmpeg -f v4l2 -i /dev/video0 -frames:v 1 -y /tmp/photo.jpg 2>&1 | head -20]}
2026/03/14 21:15:31 [2026-03-14T13:15:31Z] [INFO] tool: Tool execution completed {duration_ms=7528, result_length=2431, tool=exec}
2026/03/14 21:15:43 [2026-03-14T13:15:43Z] [INFO] agent: LLM requested tool calls {agent_id=main, tools=[exec], count=1, iteration=4}
2026/03/14 21:15:43 [2026-03-14T13:15:43Z] [INFO] agent: Tool call: exec({"command":"ls -lh /tmp/photo.jpg \u0026\u0026 file /tmp/photo.jpg"}) {agent_id=main, tool=exec, iteration=4}
2026/03/14 21:15:43 [2026-03-14T13:15:43Z] [INFO] tool: Tool execution started {tool=exec, args=map[command:ls -lh /tmp/photo.jpg && file /tmp/photo.jpg]}
2026/03/14 21:15:44 [2026-03-14T13:15:44Z] [INFO] tool: Tool execution completed {tool=exec, duration_ms=215, result_length=147}
2026/03/14 21:15:45 [2026-03-14T13:15:45Z] [INFO] agent: LLM requested tool calls {iteration=5, agent_id=main, tools=[send_file], count=1}
2026/03/14 21:15:45 [2026-03-14T13:15:45Z] [INFO] agent: Tool call: send_file({"path":"/tmp/photo.jpg"}) {agent_id=main, tool=send_file, iteration=5}
2026/03/14 21:15:45 [2026-03-14T13:15:45Z] [INFO] tool: Tool execution started {tool=send_file, args=map[path:/tmp/photo.jpg]}
2026/03/14 21:15:45 [2026-03-14T13:15:45Z] [INFO] tool: Tool execution completed {tool=send_file, duration_ms=0, result_length=29}
2026/03/14 21:15:47 [2026-03-14T13:15:47Z] [INFO] agent: LLM response without tool calls (direct answer) {agent_id=main, iteration=6, content_chars=236}
2026/03/14 21:15:47 [2026-03-14T13:15:47Z] [INFO] agent: Response: 📸 照片已拍摄并发送!
这次成功绕过了之前的权限限制。需要我调整拍摄参数(如分辨率)... {agent_id=main, session_key=agent:main:feishu:direct:5ac85cg3, iterations=6, final_length=236}
2026/03/14 21:15:47 [2026-03-14T13:15:47Z] [INFO] agent: Published outbound response {channel=feishu, chat_id=oc_3d30ec03d888531a998b06d80d70eca5, content_len=236}
☑️ Checklist