Skip to content

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

refactor: remove unused contentToText helper from Ollama driver (#17639)

iridescentWen80b23349a9d7
diff --git a/internal/entity/models/ollama.go b/internal/entity/models/ollama.go
index 538034f596..fd188a31bd 100644
--- a/internal/entity/models/ollama.go
+++ b/internal/entity/models/ollama.go
@@ -33,26 +33,6 @@ type OllamaModel struct {
baseModel BaseModel
}
-// contentToText extracts a plain-text string from a Message.Content value.
-// Content may be a raw string or an OpenAI-style multimodal array
-// ([]interface{} where each element is {"type": "text", "text": "..."}).
-// The first non-empty "text" value found is returned; empty string on no match.
-func contentToText(content interface{}) string {
- switch c := content.(type) {
- case string:
- return c
- case []interface{}:
- for _, item := range c {
- if part, ok := item.(map[string]interface{}); ok {
- if text, ok := part["text"].(string); ok && text != "" {
- return text
- }
- }
- }
- }
- return ""
-}
-
// NewOllamaModel creates a new Ollama AI model instance
func NewOllamaModel(baseURL map[string]string, urlSuffix URLSuffix) *OllamaModel {
return &OllamaModel{