Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

fix(agent): process all configured Message inputs (#20936)

Sbaaoui Idriss405d67c83991
diff --git a/internal/agent/component/message.go b/internal/agent/component/message.go
index cd7c98b8ed..d3f55ff476 100644
--- a/internal/agent/component/message.go
+++ b/internal/agent/component/message.go
@@ -123,8 +123,7 @@ func extractAudioConfig(params map[string]any) (audio.Engine, string, string) {
// extractMessageText reads text / content from params in the v1 / v2
// order documented on NewMessageComponent. Returns the empty string
-// when neither key is present or the value is not a string-shaped
-// scalar.
+// when neither key is present or content has no string entries.
func extractMessageText(params map[string]any) string {
if v, ok := params["text"].(string); ok {
return v
@@ -134,15 +133,15 @@ func extractMessageText(params map[string]any) string {
case string:
return x
case []string:
- if len(x) > 0 {
- return x[0]
- }
+ return strings.Join(x, "")
case []any:
- if len(x) > 0 {
- if s, ok := x[0].(string); ok {
- return s
+ content := make([]string, 0, len(x))
+ for _, item := range x {
+ if s, ok := item.(string); ok && strings.TrimSpace(s) != "" {
+ content = append(content, s)
}
}
+ return strings.Join(content, "")
}
}
return ""