File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff 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+ }
You can’t perform that action at this time.
0 commit comments