JustSong 2 лет назад
Родитель
Сommit
3b36608bbd
2 измененных файлов с 4 добавлено и 4 удалено
  1. 3 3
      controller/relay.go
  2. 1 1
      router/web-router.go

+ 3 - 3
controller/relay.go

@@ -207,10 +207,10 @@ func RelayNotImplemented(c *gin.Context) {
 
 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",
+		Message: fmt.Sprintf("Invalid URL (%s %s)", c.Request.Method, c.Request.URL.Path),
+		Type:    "invalid_request_error",
 		Param:   "",
-		Code:    "api_not_found",
+		Code:    "",
 	}
 	c.JSON(http.StatusNotFound, gin.H{
 		"error": err,

+ 1 - 1
router/web-router.go

@@ -18,7 +18,7 @@ func SetWebRouter(router *gin.Engine, buildFS embed.FS, indexPage []byte) {
 	router.Use(middleware.Cache())
 	router.Use(static.Serve("/", common.EmbedFolder(buildFS, "web/build")))
 	router.NoRoute(func(c *gin.Context) {
-		if strings.HasPrefix(c.Request.RequestURI, "/v1") {
+		if strings.HasPrefix(c.Request.RequestURI, "/v1") || strings.HasPrefix(c.Request.RequestURI, "/api") {
 			controller.RelayNotFound(c)
 			return
 		}