diff --git a/server/routes.go b/server/routes.go index f1770cb70c..3d32a9aad9 100644 --- a/server/routes.go +++ b/server/routes.go @@ -289,6 +289,12 @@ func (s *Server) GenerateHandler(c *gin.Context) { return } + contentType := "application/json; charset=utf-8" + if req.Stream != nil && *req.Stream { + contentType = "application/x-ndjson" + } + c.Header("Content-Type", contentType) + return } @@ -1932,6 +1938,12 @@ func (s *Server) ChatHandler(c *gin.Context) { return } + contentType := "application/json; charset=utf-8" + if req.Stream != nil && *req.Stream { + contentType = "application/x-ndjson" + } + c.Header("Content-Type", contentType) + return }