mirror of
https://github.com/ollama/ollama.git
synced 2025-05-11 18:36:41 +02:00
server/routes: catch when JSON tool was used
This commit is contained in:
parent
4833025889
commit
34065c2cc6
1 changed files with 3 additions and 2 deletions
|
@ -1595,12 +1595,13 @@ func (s *Server) ChatHandler(c *gin.Context) {
|
|||
toolCallIndex++
|
||||
}
|
||||
res.Message.Content = ""
|
||||
sb.Reset()
|
||||
ch <- res
|
||||
// Only way to have multiple calls is to have [] which is derived or provided
|
||||
if templateToolToken == "" {
|
||||
// This case occurs when the tool call is a json block - do not allow tool calls again
|
||||
if templateToolToken == "" || (templateToolToken != "" && !strings.HasPrefix(sb.String(), templateToolToken)) {
|
||||
checkToolCall = false
|
||||
}
|
||||
sb.Reset()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue