fix: log /ai new errors instead of showing user Failed to reset conversation
This commit is contained in:
+1
-1
@@ -41,7 +41,7 @@ func (p *Plugin) ExecuteCommand(_ *plugin.Context, args *model.CommandArgs) (*mo
|
||||
|
||||
case parts[0] == "new":
|
||||
if err := p.conversationStore.Reset(args.UserId, args.ChannelId); err != nil {
|
||||
return p.response("Failed to reset conversation."), nil
|
||||
p.API.LogError("Failed to reset conversation", "error", err.Error())
|
||||
}
|
||||
p.engagementEngine.Sleep(args.UserId, args.ChannelId)
|
||||
return p.response("Conversation reset. @matty to start again."), nil
|
||||
|
||||
+1
-3
@@ -86,9 +86,7 @@ func (s *ConversationStore) BuildMessages(userID, channelID, prompt string) ([]C
|
||||
func (s *ConversationStore) Reset(userID, channelID string) error {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
// Ignore errors — the key may not exist, and an empty session is the goal either way.
|
||||
_ = s.api.KVDelete(sessionKey(userID, channelID))
|
||||
return nil
|
||||
return s.api.KVDelete(sessionKey(userID, channelID))
|
||||
}
|
||||
|
||||
func (s *ConversationStore) loadSession(userID, channelID string) *conversationSession {
|
||||
|
||||
Reference in New Issue
Block a user