Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions proxy/proxymanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,15 @@ func (pm *ProxyManager) proxyToUpstream(c *gin.Context) {
modelName = real
remainingPath = "/" + strings.Join(parts[i+1:], "/")
modelFound = true

// Check if this is exactly a model name with no additional path
// and doesn't end with a trailing slash
if remainingPath == "/" && !strings.HasSuffix(upstreamPath, "/") {
// Redirect to add trailing slash
newPath := "/upstream/" + searchModelName + "/"
c.Redirect(http.StatusMovedPermanently, newPath)
return
}
break
}
}
Expand All @@ -438,6 +447,7 @@ func (pm *ProxyManager) proxyToUpstream(c *gin.Context) {
c.Request.URL.Path = remainingPath
processGroup.ProxyRequest(realModelName, c.Writer, c.Request)
}

func (pm *ProxyManager) proxyOAIHandler(c *gin.Context) {
bodyBytes, err := io.ReadAll(c.Request.Body)
if err != nil {
Expand Down
Loading