Skip to content

Commit b97eb2b

Browse files
authored
cloud: set the proxy content-type to the same as local models (ollama#12759)
1 parent ad6f6a1 commit b97eb2b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

server/routes.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,12 @@ func (s *Server) GenerateHandler(c *gin.Context) {
289289
return
290290
}
291291

292+
contentType := "application/json; charset=utf-8"
293+
if req.Stream != nil && *req.Stream {
294+
contentType = "application/x-ndjson"
295+
}
296+
c.Header("Content-Type", contentType)
297+
292298
return
293299
}
294300

@@ -1932,6 +1938,12 @@ func (s *Server) ChatHandler(c *gin.Context) {
19321938
return
19331939
}
19341940

1941+
contentType := "application/json; charset=utf-8"
1942+
if req.Stream != nil && *req.Stream {
1943+
contentType = "application/x-ndjson"
1944+
}
1945+
c.Header("Content-Type", contentType)
1946+
19351947
return
19361948
}
19371949

0 commit comments

Comments
 (0)