Skip to content

Commit

Permalink
Merge pull request #4 from github/models/322-improve-error-messaging-…
Browse files Browse the repository at this point in the history
…root

Improve clarity of model run command's error message
  • Loading branch information
garman authored Oct 9, 2024
2 parents bb2a622 + 1b69d4a commit ab0f0c4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cmd/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,23 @@ func NewRunCommand() *cobra.Command {
modelName = args[0]
}

noMatchErrorMessage := "The specified model name is not found. Run 'gh models list' to see available models or 'gh models run' to select interactively."

if modelName == "" {
return errors.New(noMatchErrorMessage)
}

foundMatch := false
for _, model := range models {
if strings.EqualFold(model.FriendlyName, modelName) || strings.EqualFold(model.Name, modelName) {
modelName = model.Name
foundMatch = true
break
}
}

if modelName == "" {
return errors.New("the specified model name is not supported")
if !foundMatch {
return errors.New(noMatchErrorMessage)
}

initialPrompt := ""
Expand Down

0 comments on commit ab0f0c4

Please sign in to comment.