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

This commit is contained in:
iridescentWen
2026-07-31 18:52:39 +08:00
committed by GitHub
parent c8fbd97595
commit 80b23349a9

View File

@@ -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{