mirror of
https://gitcode.com/JianFeeeee/HomeAgent.git
synced 2026-10-04 00:03:59 +00:00
feat(shm): InputChannel/OutputChannel lane 基础设施(§13.5/§13.6)
- injectParams 加 TextRef SharedRef(兼容旧 Text 字段) - resolveText 辅助函数:优先 SharedRef,否则内联 Text - 核心注入方法待迁移至 resolveText
This commit is contained in:
@ -559,10 +559,20 @@ func (h *coreHandler) Handle(method string, params json.RawMessage) (interface{}
|
|||||||
return nil, fmt.Errorf("未知 method: %s", method)
|
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 {
|
type injectParams struct {
|
||||||
Source string `json:"source"`
|
Source string `json:"source"`
|
||||||
Channel string `json:"channel"`
|
Channel string `json:"channel"`
|
||||||
Text string `json:"text"`
|
Text string `json:"text,omitempty"`
|
||||||
|
TextRef SharedRef `json:"text_ref,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// injectMediaParams 是带媒体注入的参数。
|
// injectMediaParams 是带媒体注入的参数。
|
||||||
|
|||||||
Reference in New Issue
Block a user