mirror of
				https://github.com/songquanpeng/one-api.git
				synced 2025-11-04 07:43:41 +08:00 
			
		
		
		
	fix: text filed check for 4v request (#1634)
This commit is contained in:
		@@ -97,7 +97,11 @@ func CountTokenMessages(messages []model.Message, model string) int {
 | 
			
		||||
				m := it.(map[string]any)
 | 
			
		||||
				switch m["type"] {
 | 
			
		||||
				case "text":
 | 
			
		||||
					tokenNum += getTokenNum(tokenEncoder, m["text"].(string))
 | 
			
		||||
					if textValue, ok := m["text"]; ok {
 | 
			
		||||
						if textString, ok := textValue.(string); ok {
 | 
			
		||||
							tokenNum += getTokenNum(tokenEncoder, textString)
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				case "image_url":
 | 
			
		||||
					imageUrl, ok := m["image_url"].(map[string]any)
 | 
			
		||||
					if ok {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user