tui: use EnabledTools from lmcli.Context

This commit is contained in:
Matt Low 2024-03-13 05:09:55 +00:00
parent 00eb57820f
commit a06ac694c6

View File

@ -11,7 +11,6 @@ import (
"git.mlow.ca/mlow/lmcli/pkg/lmcli"
models "git.mlow.ca/mlow/lmcli/pkg/lmcli/model"
"git.mlow.ca/mlow/lmcli/pkg/lmcli/tools"
"github.com/charmbracelet/bubbles/textarea"
"github.com/charmbracelet/bubbles/viewport"
tea "github.com/charmbracelet/bubbletea"
@ -295,19 +294,11 @@ func (m *model) promptLLM() tea.Cmd {
return msgError(err)
}
var toolBag []models.Tool
for _, toolName := range *m.ctx.Config.Tools.EnabledTools {
tool, ok := tools.AvailableTools[toolName]
if ok {
toolBag = append(toolBag, tool)
}
}
requestParams := models.RequestParameters{
Model: *m.ctx.Config.Defaults.Model,
MaxTokens: *m.ctx.Config.Defaults.MaxTokens,
Temperature: *m.ctx.Config.Defaults.Temperature,
ToolBag: toolBag,
ToolBag: m.ctx.EnabledTools,
}
replyHandler := func(msg models.Message) {