mirror of
https://github.com/songquanpeng/one-api.git
synced 2026-02-03 04:35:57 +08:00
feat:gemini file
This commit is contained in:
@@ -4,5 +4,5 @@ const (
|
||||
ContentTypeText = "text"
|
||||
ContentTypeImageURL = "image_url"
|
||||
ContentTypeInputAudio = "input_audio"
|
||||
ContentTypeInputPdf = "application/pdf"
|
||||
ContentTypeInputFile = "file"
|
||||
)
|
||||
|
||||
@@ -121,6 +121,15 @@ func (m Message) ParseContent() []MessageContent {
|
||||
},
|
||||
})
|
||||
}
|
||||
case ContentTypeInputFile:
|
||||
if subObj, ok := contentMap["file"].(map[string]any); ok {
|
||||
contentList = append(contentList, MessageContent{
|
||||
Type: ContentTypeInputFile,
|
||||
File: &File{
|
||||
FileData: subObj["file_data"].(string),
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
return contentList
|
||||
@@ -137,4 +146,10 @@ type MessageContent struct {
|
||||
Type string `json:"type,omitempty"`
|
||||
Text string `json:"text"`
|
||||
ImageURL *ImageURL `json:"image_url,omitempty"`
|
||||
File *File `json:"file,omitempty"`
|
||||
}
|
||||
|
||||
type File struct {
|
||||
FileData string `json:"file_data,omitempty"`
|
||||
FileName string `json:"filename,omitempty"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user