Delete 'retried' messages in lmcli retry
This commit is contained in:
parent
ed6ee9bea9
commit
4f37ed046b
@ -472,6 +472,14 @@ var retryCmd = &cobra.Command{
|
||||
lastUserMessageIndex = i
|
||||
break
|
||||
}
|
||||
|
||||
if lastUserMessageIndex == 0 {
|
||||
// haven't found the the last user message yet, delete this one
|
||||
err = store.DeleteMessage(&messages[i])
|
||||
if err != nil {
|
||||
Warn("Could not delete previous reply: %v\n", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
messages = messages[:lastUserMessageIndex+1]
|
||||
|
@ -97,6 +97,10 @@ func (s *Store) SaveMessage(message *Message) error {
|
||||
return s.db.Create(message).Error
|
||||
}
|
||||
|
||||
func (s *Store) DeleteMessage(message *Message) error {
|
||||
return s.db.Delete(&message).Error
|
||||
}
|
||||
|
||||
func (s *Store) Conversations() ([]Conversation, error) {
|
||||
var conversations []Conversation
|
||||
err := s.db.Find(&conversations).Error
|
||||
|
Loading…
Reference in New Issue
Block a user