Skip to content

Commit 8527fa5

Browse files
authored
Merge pull request #445 from thedadams/fix-prompt-tui
fix: pass ExtraEnv to tui
2 parents 8f344d9 + 89b4bc4 commit 8527fa5

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ require (
1616
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
1717
github.com/google/uuid v1.6.0
1818
github.com/gptscript-ai/chat-completion-client v0.0.0-20240531200700-af8e7ecf0379
19-
github.com/gptscript-ai/tui v0.0.0-20240604233332-4a5ff43cdc58
19+
github.com/gptscript-ai/tui v0.0.0-20240605185737-d36cdf2ed691
2020
github.com/hexops/autogold/v2 v2.2.1
2121
github.com/hexops/valast v1.4.4
2222
github.com/jaytaylor/html2text v0.0.0-20230321000545-74c2419ad056

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ github.com/gptscript-ai/chat-completion-client v0.0.0-20240531200700-af8e7ecf037
175175
github.com/gptscript-ai/chat-completion-client v0.0.0-20240531200700-af8e7ecf0379/go.mod h1:7P/o6/IWa1KqsntVf68hSnLKuu3+xuqm6lYhch1w4jo=
176176
github.com/gptscript-ai/go-gptscript v0.0.0-20240604231423-7a845df843b1 h1:SHoqsU8Ne2V4zfrFve9kQn4vcv4N4TItD6Oju+pzKV8=
177177
github.com/gptscript-ai/go-gptscript v0.0.0-20240604231423-7a845df843b1/go.mod h1:h1yYzC0rgB5Kk7lwdba+Xs6cWkuJfLq6sPRna45OVG0=
178-
github.com/gptscript-ai/tui v0.0.0-20240604233332-4a5ff43cdc58 h1:kbr6cY4VdvxAfJf+xk6x/gxDzmgZMkX2ZfLcyskGYsw=
179-
github.com/gptscript-ai/tui v0.0.0-20240604233332-4a5ff43cdc58/go.mod h1:At6zmCk0XrJ2J1yo95fzbEDOGwaPPEMwxxcQGJx7IGE=
178+
github.com/gptscript-ai/tui v0.0.0-20240605185737-d36cdf2ed691 h1:7F0s0xY6bm5GfsjMldmcw07f+Ph9cQEcFQywu9CIYZA=
179+
github.com/gptscript-ai/tui v0.0.0-20240605185737-d36cdf2ed691/go.mod h1:At6zmCk0XrJ2J1yo95fzbEDOGwaPPEMwxxcQGJx7IGE=
180180
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
181181
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
182182
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=

pkg/cli/gptscript.go

+1
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ func (r *GPTScript) Run(cmd *cobra.Command, args []string) (retErr error) {
459459
Workspace: r.Workspace,
460460
SaveChatStateFile: r.SaveChatStateFile,
461461
ChatState: chatState,
462+
ExtraEnv: gptScript.ExtraEnv,
462463
})
463464
}
464465
return chat.Start(cmd.Context(), chatState, gptScript, func() (types.Program, error) {

pkg/gptscript/gptscript.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type GPTScript struct {
3232
Cache *cache.Client
3333
WorkspacePath string
3434
DeleteWorkspaceOnClose bool
35-
extraEnv []string
35+
ExtraEnv []string
3636
close func()
3737
}
3838

@@ -125,7 +125,7 @@ func New(opts *Options) (*GPTScript, error) {
125125
Cache: cacheClient,
126126
WorkspacePath: opts.Workspace,
127127
DeleteWorkspaceOnClose: opts.Workspace == "",
128-
extraEnv: extraEnv,
128+
ExtraEnv: extraEnv,
129129
close: closeServer,
130130
}, nil
131131
}
@@ -147,7 +147,7 @@ func (g *GPTScript) getEnv(env []string) ([]string, error) {
147147
if err := os.MkdirAll(g.WorkspacePath, 0700); err != nil {
148148
return nil, err
149149
}
150-
return slices.Concat(g.extraEnv, []string{
150+
return slices.Concat(g.ExtraEnv, []string{
151151
fmt.Sprintf("GPTSCRIPT_WORKSPACE_DIR=%s", g.WorkspacePath),
152152
fmt.Sprintf("GPTSCRIPT_WORKSPACE_ID=%s", hash.ID(g.WorkspacePath)),
153153
}, env), nil

0 commit comments

Comments
 (0)