Skip to content

Commit c8b865a

Browse files
authored
Merge pull request #566 from njhale/chore/sync-ui-version
chore: pull ui tool with matching release tag
2 parents 27a4540 + f1179b2 commit c8b865a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

pkg/cli/gptscript.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ func (r *GPTScript) Run(cmd *cobra.Command, args []string) (retErr error) {
330330

331331
// If the user is trying to launch the chat-builder UI, then set up the tool and options here.
332332
if r.UI {
333-
args = append([]string{env.VarOrDefault("GPTSCRIPT_CHAT_UI_TOOL", "github.com/gptscript-ai/ui")}, args...)
333+
args = append([]string{uiTool()}, args...)
334334

335335
// If args has more than one element, then the user has provided a file.
336336
if len(args) > 1 {
@@ -493,3 +493,15 @@ func (r *GPTScript) Run(cmd *cobra.Command, args []string) (retErr error) {
493493

494494
return r.PrintOutput(toolInput, s)
495495
}
496+
497+
// uiTool returns the versioned UI tool reference for the current GPTScript version.
498+
// For release versions, a reference with a matching release tag is returned.
499+
// For all other versions, a reference to main is returned.
500+
func uiTool() string {
501+
ref := "github.com/gptscript-ai/ui"
502+
if tag := version.Tag; !strings.Contains(tag, "v0.0.0-dev") {
503+
ref = fmt.Sprintf("%s@%s", ref, tag)
504+
}
505+
506+
return env.VarOrDefault("GPTSCRIPT_CHAT_UI_TOOL", ref)
507+
}

0 commit comments

Comments
 (0)