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) {
330
330
331
331
// If the user is trying to launch the chat-builder UI, then set up the tool and options here.
332
332
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 ... )
334
334
335
335
// If args has more than one element, then the user has provided a file.
336
336
if len (args ) > 1 {
@@ -493,3 +493,15 @@ func (r *GPTScript) Run(cmd *cobra.Command, args []string) (retErr error) {
493
493
494
494
return r .PrintOutput (toolInput , s )
495
495
}
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