feat: return a not found response if requested a wrong API endpoints

This commit is contained in:
JustSong
2023-06-17 09:46:07 +08:00
parent 57b213a035
commit 70ed126ccb
2 changed files with 18 additions and 0 deletions

View File

@@ -398,3 +398,15 @@ func RelayNotImplemented(c *gin.Context) {
"error": err,
})
}
func RelayNotFound(c *gin.Context) {
err := OpenAIError{
Message: fmt.Sprintf("API not found: %s:%s", c.Request.Method, c.Request.URL.Path),
Type: "one_api_error",
Param: "",
Code: "api_not_found",
}
c.JSON(http.StatusOK, gin.H{
"error": err,
})
}