Browse Source

🔧 refactor(endpoint types): comment out unused endpoint types in constants

CaIon 6 months ago
parent
commit
6ac7878863
4 changed files with 12 additions and 21 deletions
  1. 0 3
      README.md
  2. 8 8
      common/endpoint_type.go
  3. 4 4
      constant/endpoint_type.go
  4. 0 6
      service/token_counter.go

+ 0 - 3
README.md

@@ -27,9 +27,6 @@
   <a href="https://goreportcard.com/report/github.com/Calcium-Ion/new-api">
     <img src="https://goreportcard.com/badge/github.com/Calcium-Ion/new-api" alt="GoReportCard">
   </a>
-  <a href="https://coderabbit.ai">
-    <img src="https://img.shields.io/coderabbit/prs/github/QuantumNous/new-api?utm_source=oss&utm_medium=github&utm_campaign=QuantumNous%2Fnew-api&labelColor=171717&color=FF570A&link=https%3A%2F%2Fcoderabbit.ai&label=CodeRabbit+Reviews" alt="CodeRabbit Pull Request Reviews">
-  </a>
 </p>
 </div>
 

+ 8 - 8
common/endpoint_type.go

@@ -8,14 +8,14 @@ func GetEndpointTypesByChannelType(channelType int, modelName string) []constant
 	switch channelType {
 	case constant.ChannelTypeJina:
 		endpointTypes = []constant.EndpointType{constant.EndpointTypeJinaRerank}
-	case constant.ChannelTypeMidjourney, constant.ChannelTypeMidjourneyPlus:
-		endpointTypes = []constant.EndpointType{constant.EndpointTypeMidjourney}
-	case constant.ChannelTypeSunoAPI:
-		endpointTypes = []constant.EndpointType{constant.EndpointTypeSuno}
-	case constant.ChannelTypeKling:
-		endpointTypes = []constant.EndpointType{constant.EndpointTypeKling}
-	case constant.ChannelTypeJimeng:
-		endpointTypes = []constant.EndpointType{constant.EndpointTypeJimeng}
+	//case constant.ChannelTypeMidjourney, constant.ChannelTypeMidjourneyPlus:
+	//	endpointTypes = []constant.EndpointType{constant.EndpointTypeMidjourney}
+	//case constant.ChannelTypeSunoAPI:
+	//	endpointTypes = []constant.EndpointType{constant.EndpointTypeSuno}
+	//case constant.ChannelTypeKling:
+	//	endpointTypes = []constant.EndpointType{constant.EndpointTypeKling}
+	//case constant.ChannelTypeJimeng:
+	//	endpointTypes = []constant.EndpointType{constant.EndpointTypeJimeng}
 	case constant.ChannelTypeAws:
 		fallthrough
 	case constant.ChannelTypeAnthropic:

+ 4 - 4
constant/endpoint_type.go

@@ -8,8 +8,8 @@ const (
 	EndpointTypeAnthropic      EndpointType = "anthropic"
 	EndpointTypeGemini         EndpointType = "gemini"
 	EndpointTypeJinaRerank     EndpointType = "jina-rerank"
-	EndpointTypeMidjourney     EndpointType = "midjourney-proxy"
-	EndpointTypeSuno           EndpointType = "suno-proxy"
-	EndpointTypeKling          EndpointType = "kling"
-	EndpointTypeJimeng         EndpointType = "jimeng"
+	//EndpointTypeMidjourney     EndpointType = "midjourney-proxy"
+	//EndpointTypeSuno           EndpointType = "suno-proxy"
+	//EndpointTypeKling          EndpointType = "kling"
+	//EndpointTypeJimeng         EndpointType = "jimeng"
 )

+ 0 - 6
service/token_counter.go

@@ -172,9 +172,6 @@ func CountTokenChatRequest(info *relaycommon.RelayInfo, request dto.GeneralOpenA
 			}
 		}
 		toolTokens := CountTokenInput(countStr, request.Model)
-		if err != nil {
-			return 0, err
-		}
 		tkm += 8
 		tkm += toolTokens
 	}
@@ -195,9 +192,6 @@ func CountTokenClaudeRequest(request dto.ClaudeRequest, model string) (int, erro
 	// Count tokens in system message
 	if request.System != "" {
 		systemTokens := CountTokenInput(request.System, model)
-		if err != nil {
-			return 0, err
-		}
 		tkm += systemTokens
 	}