CalciumIon 1 год назад
Родитель
Сommit
d168a685c1
2 измененных файлов с 4 добавлено и 2 удалено
  1. 1 1
      relay/channel/cohere/dto.go
  2. 3 1
      relay/channel/cohere/relay-cohere.go

+ 1 - 1
relay/channel/cohere/dto.go

@@ -8,7 +8,7 @@ type CohereRequest struct {
 	Message     string        `json:"message"`
 	Stream      bool          `json:"stream"`
 	MaxTokens   int           `json:"max_tokens"`
-	SafetyMode  string        `json:"safety_mode"`
+	SafetyMode  string        `json:"safety_mode,omitempty"`
 }
 
 type ChatHistory struct {

+ 3 - 1
relay/channel/cohere/relay-cohere.go

@@ -22,7 +22,9 @@ func requestOpenAI2Cohere(textRequest dto.GeneralOpenAIRequest) *CohereRequest {
 		Message:     "",
 		Stream:      textRequest.Stream,
 		MaxTokens:   textRequest.GetMaxTokens(),
-		SafetyMode:  common.CohereSafetySetting,
+	}
+	if common.CohereSafetySetting != "NONE" {
+		cohereReq.SafetyMode = common.CohereSafetySetting
 	}
 	if cohereReq.MaxTokens == 0 {
 		cohereReq.MaxTokens = 4000