From 80b23349a9d7832df2e20cba8c6b12fcd6ce5da0 Mon Sep 17 00:00:00 2001 From: iridescentWen <66297467+iridescentWen@users.noreply.github.com> Date: Fri, 31 Jul 2026 18:52:39 +0800 Subject: [PATCH] refactor: remove unused contentToText helper from Ollama driver (#17639) --- internal/entity/models/ollama.go | 20 -------------------- 1 file changed, 20 deletions(-) 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{