mirror of
https://github.com/tcsenpai/ollama.git
synced 2025-06-09 04:35:21 +00:00
server: only parse tool calls if tools are provided (#5771)
* server: only parse tool calls if tools are provided * still set `resp.Message.Content`
This commit is contained in:
parent
b255445557
commit
319fb1ce03
@ -1385,10 +1385,13 @@ func (s *Server) ChatHandler(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resp.Message.Content = sb.String()
|
resp.Message.Content = sb.String()
|
||||||
|
|
||||||
|
if len(req.Tools) > 0 {
|
||||||
if toolCalls, ok := m.parseToolCalls(sb.String()); ok {
|
if toolCalls, ok := m.parseToolCalls(sb.String()); ok {
|
||||||
resp.Message.ToolCalls = toolCalls
|
resp.Message.ToolCalls = toolCalls
|
||||||
resp.Message.Content = ""
|
resp.Message.Content = ""
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user