From 3471dbbdc49f4bde1485b39c92fbe1306a37dacd Mon Sep 17 00:00:00 2001 From: Tim <11543666+tbckr@users.noreply.github.com> Date: Fri, 20 Sep 2024 15:05:02 +0200 Subject: [PATCH] fix: fix chat subcommands all of the sgpt chat subcommands (like cat, ls, rm) were broken. the viper config was not loaded, which included the user cache dir. this user cache dir is used to save the chat sessions. --- pkg/cli/chat.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/cli/chat.go b/pkg/cli/chat.go index 0f77924e..d6537ca3 100644 --- a/pkg/cli/chat.go +++ b/pkg/cli/chat.go @@ -72,6 +72,9 @@ Manage all open chat sessions - list, show, and delete chat sessions. DisableFlagsInUseLine: true, Args: cobra.NoArgs, ValidArgsFunction: cobra.NoFileCompletions, + PersistentPreRunE: func(_ *cobra.Command, _ []string) error { + return loadViperConfig(config) + }, RunE: func(cmd *cobra.Command, _ []string) error { return cmd.Help() },