tui: use EnabledTools from lmcli.Context

This commit is contained in:
Matt Low 2024-03-13 05:09:55 +00:00
parent 793aaab50e
commit ea78edf039

View File

@ -11,7 +11,6 @@ import (
"git.mlow.ca/mlow/lmcli/pkg/lmcli" "git.mlow.ca/mlow/lmcli/pkg/lmcli"
models "git.mlow.ca/mlow/lmcli/pkg/lmcli/model" 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/textarea"
"github.com/charmbracelet/bubbles/viewport" "github.com/charmbracelet/bubbles/viewport"
tea "github.com/charmbracelet/bubbletea" tea "github.com/charmbracelet/bubbletea"
@ -295,19 +294,11 @@ func (m *model) promptLLM() tea.Cmd {
return msgError(err) 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{ requestParams := models.RequestParameters{
Model: *m.ctx.Config.Defaults.Model, Model: *m.ctx.Config.Defaults.Model,
MaxTokens: *m.ctx.Config.Defaults.MaxTokens, MaxTokens: *m.ctx.Config.Defaults.MaxTokens,
Temperature: *m.ctx.Config.Defaults.Temperature, Temperature: *m.ctx.Config.Defaults.Temperature,
ToolBag: toolBag, ToolBag: m.ctx.EnabledTools,
} }
replyHandler := func(msg models.Message) { replyHandler := func(msg models.Message) {