diff --git a/pkg/cli/gptscript.go b/pkg/cli/gptscript.go index a8561abf..5a44c5fb 100644 --- a/pkg/cli/gptscript.go +++ b/pkg/cli/gptscript.go @@ -361,6 +361,11 @@ func (r *GPTScript) Run(cmd *cobra.Command, args []string) (retErr error) { gptOpt.Env = append(gptOpt.Env, system.BinEnvVar+"="+system.Bin()) } + // If the DefaultModel is set, then pass the correct environment variable. + if r.DefaultModel != "" { + gptOpt.Env = append(gptOpt.Env, "GPTSCRIPT_SDKSERVER_DEFAULT_MODEL="+r.DefaultModel) + } + args = append([]string{args[0]}, "--file="+file) if len(args) > 2 {