mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-12 11:23:42 +08:00
docs: update README to include support for Gemini multimodal output and add relevant images
fix: ensure nil check for content text in token counting function
This commit is contained in:
@@ -103,7 +103,9 @@ func CountTokenMessages(ctx context.Context,
|
||||
for _, content := range contents {
|
||||
switch content.Type {
|
||||
case model.ContentTypeText:
|
||||
tokenNum += getTokenNum(tokenEncoder, content.Text)
|
||||
if content.Text != nil {
|
||||
tokenNum += getTokenNum(tokenEncoder, *content.Text)
|
||||
}
|
||||
case model.ContentTypeImageURL:
|
||||
imageTokens, err := countImageTokens(
|
||||
content.ImageURL.Url,
|
||||
|
||||
Reference in New Issue
Block a user