use path as default model name

This commit is contained in:
2024-02-16 22:31:32 +08:00
parent f2e32340e3
commit 46ee30ced7
2 changed files with 2 additions and 4 deletions

View File

@@ -33,9 +33,6 @@ func processRequest(c *gin.Context, upstream *OPENAI_UPSTREAM, record *Record, s
path := strings.TrimPrefix(c.Request.URL.Path, "/v1")
// recoognize whisper url
if strings.HasPrefix(path, "/audio/transcriptions") || strings.HasPrefix(path, "/audio/translations") {
record.Model = "whisper"
}
remote.Path = upstream.URL.Path + path
log.Println("[proxy.begin]:", remote)
log.Println("[proxy.begin]: shouldResposne:", shouldResponse)
@@ -65,7 +62,7 @@ func processRequest(c *gin.Context, upstream *OPENAI_UPSTREAM, record *Record, s
record.Body = string(inBody)
requestBody, requestBodyOK := ParseRequestBody(inBody)
// record if parse success
if requestBodyOK == nil && record.Model == "" {
if requestBodyOK == nil && requestBody.Model != "" {
record.Model = requestBody.Model
}