diff --git a/cmd/cmd.go b/cmd/cmd.go index db4c8f50..2d31a121 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -1038,8 +1038,6 @@ func checkServerHeartbeat(cmd *cobra.Command, _ []string) error { } func versionHandler(cmd *cobra.Command, _ []string) { - fmt.Printf("ollama version %s\n", version.Version) - client, err := api.ClientFromEnvironment() if err != nil { return @@ -1047,11 +1045,15 @@ func versionHandler(cmd *cobra.Command, _ []string) { serverVersion, err := client.Version(cmd.Context()) if err != nil { - return + fmt.Println("Warning: could not connect to a running Ollama instance") + } + + if serverVersion != "" { + fmt.Printf("ollama version is %s\n", serverVersion) } if serverVersion != version.Version { - fmt.Printf("ollama host version %s\n", serverVersion) + fmt.Printf("Warning: client version is %s\n", version.Version) } } @@ -1067,7 +1069,6 @@ func NewCLI() *cobra.Command { CompletionOptions: cobra.CompletionOptions{ DisableDefaultCmd: true, }, - Version: version.Version, Run: func(cmd *cobra.Command, args []string) { if version, _ := cmd.Flags().GetBool("version"); version { versionHandler(cmd, args)