Improve TUI system prompt handling
+ allow setting a default agent
This commit is contained in:
@@ -37,6 +37,25 @@ func (m *AppModel) ClearConversation() {
|
||||
m.RootMessages = []api.Message{}
|
||||
}
|
||||
|
||||
func (m *AppModel) ApplySystemPrompt() {
|
||||
var system string
|
||||
agent := m.Ctx.GetAgent(m.Ctx.Config.Defaults.Agent)
|
||||
if agent != nil && agent.SystemPrompt != "" {
|
||||
system = agent.SystemPrompt
|
||||
}
|
||||
if system == "" {
|
||||
system = m.Ctx.DefaultSystemPrompt()
|
||||
}
|
||||
if system != "" {
|
||||
m.Messages = api.ApplySystemPrompt(m.Messages, system, false)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *AppModel) NewConversation() {
|
||||
m.ClearConversation()
|
||||
m.ApplySystemPrompt()
|
||||
}
|
||||
|
||||
func (m *AppModel) LoadConversations() (error, []LoadedConversation) {
|
||||
messages, err := m.Ctx.Store.LatestConversationMessages()
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user