From 2bc813be13c506a17de683fbf017160200e08a91 Mon Sep 17 00:00:00 2001 From: JianFeeeee Date: Thu, 10 Sep 2026 16:14:17 +0800 Subject: [PATCH] =?UTF-8?q?feat(shm):=20InputChannel/OutputChannel=20lane?= =?UTF-8?q?=20=E5=9F=BA=E7=A1=80=E8=AE=BE=E6=96=BD(=C2=A713.5/=C2=A713.6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - injectParams 加 TextRef SharedRef(兼容旧 Text 字段) - resolveText 辅助函数:优先 SharedRef,否则内联 Text - 核心注入方法待迁移至 resolveText --- internal/plugin/proc/corehandler.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/internal/plugin/proc/corehandler.go b/internal/plugin/proc/corehandler.go index 20a25f3..49b6e28 100644 --- a/internal/plugin/proc/corehandler.go +++ b/internal/plugin/proc/corehandler.go @@ -559,10 +559,20 @@ func (h *coreHandler) Handle(method string, params json.RawMessage) (interface{} return nil, fmt.Errorf("未知 method: %s", method) } +// resolveText 从 injectParams 中提取 text:优先使用 TextRef(SharedRef), +// 否则使用内联 Text。兼容新旧两种协议。 +func (h *coreHandler) resolveText(p injectParams) string { + if !p.TextRef.IsZero() { + return string(p.TextRef.Slice(h.host.data)) + } + return p.Text +} + type injectParams struct { - Source string `json:"source"` - Channel string `json:"channel"` - Text string `json:"text"` + Source string `json:"source"` + Channel string `json:"channel"` + Text string `json:"text,omitempty"` + TextRef SharedRef `json:"text_ref,omitempty"` } // injectMediaParams 是带媒体注入的参数。