fix: robust parameter mapping for inbound pico messages
This commit is contained in:
parent
86c81f666f
commit
6ee2bf02e3
1 changed files with 13 additions and 0 deletions
|
|
@ -559,6 +559,19 @@ func (c *PicoChannel) handleMessage(pc *picoConn, msg PicoMessage) {
|
||||||
// handleMessageSend processes an inbound message.send from a client.
|
// handleMessageSend processes an inbound message.send from a client.
|
||||||
func (c *PicoChannel) handleMessageSend(pc *picoConn, msg PicoMessage) {
|
func (c *PicoChannel) handleMessageSend(pc *picoConn, msg PicoMessage) {
|
||||||
content, _ := msg.Payload["content"].(string)
|
content, _ := msg.Payload["content"].(string)
|
||||||
|
|
||||||
|
// Robust parameter mapping for HDN compatibility
|
||||||
|
if content == "" {
|
||||||
|
// Fallback to other common field names used by different HDN versions
|
||||||
|
if c, ok := msg.Payload["prompt"].(string); ok {
|
||||||
|
content = c
|
||||||
|
} else if m, ok := msg.Payload["message"].(string); ok {
|
||||||
|
content = m
|
||||||
|
} else if q, ok := msg.Payload["query"].(string); ok {
|
||||||
|
content = q
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
media, err := parseInlineImageMedia(msg.Payload)
|
media, err := parseInlineImageMedia(msg.Payload)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errMsg := newErrorWithPayload("invalid_media", err.Error(), map[string]any{
|
errMsg := newErrorWithPayload("invalid_media", err.Error(), map[string]any{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue