mirror of
https://github.com/ollama/ollama.git
synced 2025-12-06 07:12:07 +01:00
Compare commits
2 commits
c3d9af48d6
...
9e8b58bd1f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9e8b58bd1f | ||
|
|
31b8c6a214 |
|
|
@ -262,6 +262,12 @@ func (s *Server) GenerateHandler(c *gin.Context) {
|
||||||
slog.Warn("embedded messages in the model not supported with '/api/generate'; try '/api/chat' instead")
|
slog.Warn("embedded messages in the model not supported with '/api/generate'; try '/api/chat' instead")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
contentType := "application/x-ndjson"
|
||||||
|
if req.Stream != nil && !*req.Stream {
|
||||||
|
contentType = "application/json; charset=utf-8"
|
||||||
|
}
|
||||||
|
c.Header("Content-Type", contentType)
|
||||||
|
|
||||||
fn := func(resp api.GenerateResponse) error {
|
fn := func(resp api.GenerateResponse) error {
|
||||||
resp.Model = origModel
|
resp.Model = origModel
|
||||||
resp.RemoteModel = m.Config.RemoteModel
|
resp.RemoteModel = m.Config.RemoteModel
|
||||||
|
|
@ -303,12 +309,6 @@ func (s *Server) GenerateHandler(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
contentType := "application/json; charset=utf-8"
|
|
||||||
if req.Stream != nil && *req.Stream {
|
|
||||||
contentType = "application/x-ndjson"
|
|
||||||
}
|
|
||||||
c.Header("Content-Type", contentType)
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1939,6 +1939,12 @@ func (s *Server) ChatHandler(c *gin.Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
contentType := "application/x-ndjson"
|
||||||
|
if req.Stream != nil && !*req.Stream {
|
||||||
|
contentType = "application/json; charset=utf-8"
|
||||||
|
}
|
||||||
|
c.Header("Content-Type", contentType)
|
||||||
|
|
||||||
fn := func(resp api.ChatResponse) error {
|
fn := func(resp api.ChatResponse) error {
|
||||||
resp.Model = origModel
|
resp.Model = origModel
|
||||||
resp.RemoteModel = m.Config.RemoteModel
|
resp.RemoteModel = m.Config.RemoteModel
|
||||||
|
|
@ -1980,12 +1986,6 @@ func (s *Server) ChatHandler(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
contentType := "application/json; charset=utf-8"
|
|
||||||
if req.Stream != nil && *req.Stream {
|
|
||||||
contentType = "application/x-ndjson"
|
|
||||||
}
|
|
||||||
c.Header("Content-Type", contentType)
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue