fix: now the input field can be array type now (close #149)

This commit is contained in:
JustSong
2023-06-12 16:11:57 +08:00
parent 8b2ef666ef
commit 7c7eb6b7ec
2 changed files with 16 additions and 2 deletions

View File

@@ -38,7 +38,7 @@ type GeneralOpenAIRequest struct {
Temperature float64 `json:"temperature"`
TopP float64 `json:"top_p"`
N int `json:"n"`
Input string `json:"input"`
Input any `json:"input"`
}
type ChatRequest struct {
@@ -189,7 +189,7 @@ func relayHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode {
case RelayModeCompletions:
promptTokens = countTokenText(textRequest.Prompt, textRequest.Model)
case RelayModeModeration:
promptTokens = countTokenText(textRequest.Input, textRequest.Model)
promptTokens = countTokenInput(textRequest.Input, textRequest.Model)
}
preConsumedTokens := common.PreConsumedQuota
if textRequest.MaxTokens != 0 {