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:
Jeffrey Morgan 2024-07-18 08:50:23 -07:00 committed by GitHub
parent b255445557
commit 319fb1ce03
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1385,10 +1385,13 @@ func (s *Server) ChatHandler(c *gin.Context) {
}
resp.Message.Content = sb.String()
if len(req.Tools) > 0 {
if toolCalls, ok := m.parseToolCalls(sb.String()); ok {
resp.Message.ToolCalls = toolCalls
resp.Message.Content = ""
}
}
c.JSON(http.StatusOK, resp)
return