惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
博客园 - 聂微东
J
Java Code Geeks
Engineering at Meta
Engineering at Meta
Jina AI
Jina AI
D
Docker
B
Blog
S
SegmentFault 最新的问题
宝玉的分享
宝玉的分享
D
DataBreaches.Net
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Y
Y Combinator Blog
N
Netflix TechBlog - Medium
月光博客
月光博客
F
Fortinet All Blogs
爱范儿
爱范儿
H
Help Net Security
腾讯CDC
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
WordPress大学
WordPress大学
The Cloudflare Blog
有赞技术团队
有赞技术团队
T
Tailwind CSS Blog
U
Unit 42

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(feishu): show voice message duration via upload durat...
areslp · 2026-06-23 · via Recent Commits to openclaw:main

@@ -5,7 +5,11 @@ import { Readable } from "node:stream";

55

import type * as Lark from "@larksuiteoapi/node-sdk";

66

import type { MessageReceipt } from "openclaw/plugin-sdk/channel-outbound";

77

import { mediaKindFromMime } from "openclaw/plugin-sdk/media-mime";

8-

import { MEDIA_FFMPEG_MAX_AUDIO_DURATION_SECS, runFfmpeg } from "openclaw/plugin-sdk/media-runtime";

8+

import {

9+

MEDIA_FFMPEG_MAX_AUDIO_DURATION_SECS,

10+

runFfmpeg,

11+

runFfprobe,

12+

} from "openclaw/plugin-sdk/media-runtime";

913

import { saveMediaBuffer, saveMediaStream, type SavedMedia } from "openclaw/plugin-sdk/media-store";

1014

import { readRegularFile, writeExternalFileWithinRoot } from "openclaw/plugin-sdk/security-runtime";

1115

import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";

@@ -471,7 +475,7 @@ export async function uploadFileFeishu(params: {

471475

file: Buffer | string; // Buffer or file path

472476

fileName: string;

473477

fileType: "opus" | "mp4" | "pdf" | "doc" | "xls" | "ppt" | "stream";

474-

duration?: number; // Required for audio/video files, in milliseconds

478+

duration?: number; // Audio/video duration, in milliseconds.

475479

accountId?: string;

476480

}): Promise<UploadFileResult> {

477481

const { cfg, file, fileName, fileType, duration, accountId } = params;

@@ -492,7 +496,7 @@ export async function uploadFileFeishu(params: {

492496

file_type: fileType,

493497

file_name: safeFileName,

494498

file: fileData,

495-

...(duration !== undefined && { duration }),

499+

...(duration !== undefined ? { duration } : {}),

496500

},

497501

}),

498502

"Feishu file upload failed",

@@ -818,6 +822,29 @@ async function prepareFeishuVoiceMedia(params: {

818822

}

819823

}

820824825+

async function probeAudioDurationMs(buffer: Buffer): Promise<number | undefined> {

826+

try {

827+

return await withTempWorkspace(

828+

{ rootDir: resolvePreferredOpenClawTmpDir(), prefix: "feishu-audio-probe-" },

829+

async (workspace) => {

830+

const inputPath = await workspace.write("input.ogg", buffer);

831+

const stdout = await runFfprobe(

832+

["-v", "error", "-show_entries", "format=duration", "-of", "csv=p=0", inputPath],

833+

{ timeoutMs: 5_000 },

834+

);

835+

const seconds = Number.parseFloat(stdout.trim());

836+

if (!Number.isFinite(seconds) || seconds <= 0) {

837+

return undefined;

838+

}

839+

return Math.max(1, Math.round(seconds * 1000));

840+

},

841+

);

842+

} catch (err) {

843+

console.warn("[feishu] failed to probe audio duration; voice bubble will omit it:", err);

844+

return undefined;

845+

}

846+

}

847+821848

/**

822849

* Upload and send media (image or file) from URL, local path, or buffer.

823850

* When mediaUrl is a local path, mediaLocalRoots (from core outbound context)

@@ -903,11 +930,13 @@ export async function sendMediaFeishu(params: {

903930

...(voiceIntentDegradedToFile ? { voiceIntentDegradedToFile: true } : {}),

904931

};

905932

}

933+

const durationMs = routing.msgType === "audio" ? await probeAudioDurationMs(buffer) : undefined;

906934

const { fileKey } = await uploadFileFeishu({

907935

cfg,

908936

file: buffer,

909937

fileName: name,

910938

fileType: routing.fileType ?? "stream",

939+

...(durationMs !== undefined ? { duration: durationMs } : {}),

911940

accountId,

912941

});

913942

const result = await sendFileFeishu({