This commit is contained in:
2024-02-16 17:47:40 +08:00
parent ca386f8302
commit f2e32340e3

View File

@@ -65,7 +65,7 @@ func processRequest(c *gin.Context, upstream *OPENAI_UPSTREAM, record *Record, s
record.Body = string(inBody) record.Body = string(inBody)
requestBody, requestBodyOK := ParseRequestBody(inBody) requestBody, requestBodyOK := ParseRequestBody(inBody)
// record if parse success // record if parse success
if requestBodyOK == nil && record.Model != "" { if requestBodyOK == nil && record.Model == "" {
record.Model = requestBody.Model record.Model = requestBody.Model
} }
@@ -79,7 +79,7 @@ func processRequest(c *gin.Context, upstream *OPENAI_UPSTREAM, record *Record, s
} }
} }
if !isAllow { if !isAllow {
errCtx = append(errCtx, errors.New("[proxy.rewrite]: model not allowed")) errCtx = append(errCtx, errors.New("[proxy.rewrite]: model '"+record.Model+"' not allowed"))
return return
} }
} }
@@ -87,7 +87,7 @@ func processRequest(c *gin.Context, upstream *OPENAI_UPSTREAM, record *Record, s
if len(upstream.Deny) > 0 { if len(upstream.Deny) > 0 {
for _, deny := range upstream.Deny { for _, deny := range upstream.Deny {
if deny == record.Model { if deny == record.Model {
errCtx = append(errCtx, errors.New("[proxy.rewrite]: model denied")) errCtx = append(errCtx, errors.New("[proxy.rewrite]: model '"+record.Model+"' denied"))
return return
} }
} }