mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-01 13:33:48 +08:00
refactor: remove unused contentToText helper from Ollama driver (#17639)
This commit is contained in:
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user