From 8d2315a1de84a54a5893be143c3afdf89e0954fc Mon Sep 17 00:00:00 2001 From: kznrluk Date: Thu, 8 Feb 2024 12:57:55 +0900 Subject: [PATCH] Add override model args --- lib/aski.go | 5 +++++ main.go | 1 + 2 files changed, 6 insertions(+) diff --git a/lib/aski.go b/lib/aski.go index 4ca357c..68e24c4 100644 --- a/lib/aski.go +++ b/lib/aski.go @@ -18,6 +18,7 @@ func Aski(cmd *cobra.Command, args []string) { profileTarget, err := cmd.Flags().GetString("profile") isRestMode, _ := cmd.Flags().GetBool("rest") content, _ := cmd.Flags().GetString("content") + model, _ := cmd.Flags().GetString("model") fileGlobs, _ := cmd.Flags().GetStringSlice("file") restore, _ := cmd.Flags().GetString("restore") verbose, _ := cmd.Flags().GetBool("verbose") @@ -43,6 +44,10 @@ func Aski(cmd *cobra.Command, args []string) { prof = config.InitialProfile() } + if model != "" { + prof.Model = model + } + var ctx conv.Conversation if restore != "" { load, fileName, err := ReadFileFromPWDAndHistoryDir(restore) diff --git a/main.go b/main.go index 679bc4f..42ec284 100644 --- a/main.go +++ b/main.go @@ -25,6 +25,7 @@ func main() { rootCmd.PersistentFlags().StringSliceP("file", "f", []string{}, "Input file(s) to start dialog from. Can be specified multiple times.") rootCmd.PersistentFlags().StringP("profile", "p", "", "Select the profile to use for this conversation, as defined in the .aski/config.yaml file.") rootCmd.PersistentFlags().StringP("content", "c", "", "Input text to start dialog from command line") + rootCmd.PersistentFlags().StringP("model", "m", "", "Override the model to use for this conversation. This will override the model specified in the profile.") rootCmd.PersistentFlags().StringP("restore", "r", "", "Restore conversations from history yaml files. Search pwd and .aski/history folders by default. Prefix match.") rootCmd.PersistentFlags().BoolP("rest", "", false, "When you specify this flag, you will communicate with the REST API instead of streaming. This can be useful if the communication is unstable or if you are not receiving responses properly.") rootCmd.PersistentFlags().BoolP("verbose", "v", false, "Debug logging")