





























@@ -94,7 +94,7 @@ export async function dispatchOutbound(
9494const sendErrorMessage = (errorText: string) => sendErrorToTarget(replyCtx, errorText);
95959696// ---- Build ctxPayload ----
97-const ctxPayload = buildCtxPayload(inbound, runtime);
97+const ctxPayload = buildCtxPayload(inbound, runtime, cfg);
98989999// ---- Deliver state ----
100100let hasResponse = false;
@@ -512,11 +512,25 @@ export async function dispatchOutbound(
512512513513// ============ ctxPayload builder ============
514514515+function resolveCommandSource(
516+inbound: InboundContext,
517+runtime: GatewayPluginRuntime,
518+cfg: unknown,
519+): "text" | undefined {
520+const commandBody = inbound.event.content;
521+if (!runtime.channel.commands?.isControlCommandMessage?.(commandBody, cfg)) {
522+return undefined;
523+}
524+return "text";
525+}
526+515527function buildCtxPayload(
516528inbound: InboundContext,
517529runtime: GatewayPluginRuntime,
530+cfg: unknown,
518531): FinalizedMsgContext {
519532const { event } = inbound;
533+const commandSource = resolveCommandSource(inbound, runtime, cfg);
520534return runtime.channel.reply.finalizeInboundContext({
521535Body: inbound.body,
522536BodyForAgent: inbound.agentBody,
@@ -546,6 +560,7 @@ function buildCtxPayload(
546560QQVoiceAsrReferTexts: inbound.uniqueVoiceAsrReferTexts,
547561QQVoiceInputStrategy: "prefer_audio_stt_then_asr_fallback",
548562CommandAuthorized: inbound.commandAuthorized,
563+ ...(commandSource ? { CommandSource: commandSource } : {}),
549564 ...(inbound.voiceMediaTypes.length > 0
550565 ? {
551566MediaTypes: inbound.voiceMediaTypes,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。