use path as default model name
This commit is contained in:
1
main.go
1
main.go
@@ -109,6 +109,7 @@ func main() {
|
|||||||
CreatedAt: time.Now(),
|
CreatedAt: time.Now(),
|
||||||
Authorization: c.Request.Header.Get("Authorization"),
|
Authorization: c.Request.Header.Get("Authorization"),
|
||||||
UserAgent: c.Request.Header.Get("User-Agent"),
|
UserAgent: c.Request.Header.Get("User-Agent"),
|
||||||
|
Model: c.Request.URL.Path,
|
||||||
}
|
}
|
||||||
|
|
||||||
// check authorization header
|
// check authorization header
|
||||||
|
|||||||
@@ -33,9 +33,6 @@ func processRequest(c *gin.Context, upstream *OPENAI_UPSTREAM, record *Record, s
|
|||||||
|
|
||||||
path := strings.TrimPrefix(c.Request.URL.Path, "/v1")
|
path := strings.TrimPrefix(c.Request.URL.Path, "/v1")
|
||||||
// recoognize whisper url
|
// recoognize whisper url
|
||||||
if strings.HasPrefix(path, "/audio/transcriptions") || strings.HasPrefix(path, "/audio/translations") {
|
|
||||||
record.Model = "whisper"
|
|
||||||
}
|
|
||||||
remote.Path = upstream.URL.Path + path
|
remote.Path = upstream.URL.Path + path
|
||||||
log.Println("[proxy.begin]:", remote)
|
log.Println("[proxy.begin]:", remote)
|
||||||
log.Println("[proxy.begin]: shouldResposne:", shouldResponse)
|
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)
|
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 && requestBody.Model != "" {
|
||||||
record.Model = requestBody.Model
|
record.Model = requestBody.Model
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user