fix(voice): reuse preflight transcripts across channels

This commit is contained in:
Peter Steinberger
2026-04-26 05:29:24 +01:00
parent 46b9044c3f
commit 6a67f65568
30 changed files with 586 additions and 64 deletions

View File

@@ -1512,6 +1512,7 @@ describe("handleFeishuMessage command authorization", () => {
Transcript: "voice transcript",
MediaPaths: ["/tmp/inbound-voice.ogg"],
MediaTypes: ["audio/ogg"],
MediaTranscribedIndexes: [0],
}),
);
const finalized = mockFinalizeInboundContext.mock.calls[0]?.[0];

View File

@@ -759,6 +759,10 @@ export async function handleFeishuMessage(params: {
chatType: isGroup ? "group" : "direct",
log,
});
const preflightAudioIndex =
audioTranscript === undefined
? -1
: mediaList.findIndex((media) => media.contentType?.startsWith("audio/"));
const agentFacingContent = audioTranscript ?? ctx.content;
const agentFacingCtx =
audioTranscript === undefined
@@ -1078,6 +1082,7 @@ export async function handleFeishuMessage(params: {
OriginatingTo: feishuTo,
GroupSystemPrompt: isGroup ? normalizeOptionalString(groupConfig?.systemPrompt) : undefined,
...mediaPayload,
...(preflightAudioIndex >= 0 ? { MediaTranscribedIndexes: [preflightAudioIndex] } : {}),
});
};