From dbf024b0904c6676360cc0320088cd0ee8181655 Mon Sep 17 00:00:00 2001 From: pnkcaht Date: Thu, 5 Feb 2026 13:35:12 -0500 Subject: [PATCH 1/2] fix(model): restore implicit defaults for model identifiers Signed-off-by: pnkcaht --- cmd/cli/commands/run.go | 2 +- cmd/cli/commands/utils.go | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/cmd/cli/commands/run.go b/cmd/cli/commands/run.go index 2f18aaee..d25dd287 100644 --- a/cmd/cli/commands/run.go +++ b/cmd/cli/commands/run.go @@ -608,7 +608,7 @@ func newRunCmd() *cobra.Command { } }, RunE: func(cmd *cobra.Command, args []string) error { - model := args[0] + model := normalizeModelIdentifier(args[0]) prompt := "" argsLen := len(args) if argsLen > 1 { diff --git a/cmd/cli/commands/utils.go b/cmd/cli/commands/utils.go index c77f472b..3c122ddf 100644 --- a/cmd/cli/commands/utils.go +++ b/cmd/cli/commands/utils.go @@ -156,6 +156,29 @@ func stripDefaultsFromModelName(model string) string { return model } +// normalizeModelIdentifier expands a user-provided model reference into a fully +// qualified model identifier expected by the engine. +// +// The CLI intentionally strips default values (org and tag) when displaying +// models to improve readability. However, users should be able to pass the same +// shorthand forms back to the CLI (e.g. "mxbai-embed-large"). +// +// This function restores the implicit defaults to ensure round-trip consistency +// between `docker model list` output and subsequent CLI commands. +func normalizeModelIdentifier(model string) string { + // If no organization is provided, assume the default org. + if !strings.Contains(model, "/") { + model = defaultOrg + "/" + model + } + + // If no tag is provided, assume the default tag. + if !strings.Contains(model, ":") { + model = model + ":" + defaultTag + } + + return model +} + // requireExactArgs returns a cobra.PositionalArgs validator that ensures exactly n arguments are provided func requireExactArgs(n int, cmdName string, usageArgs string) cobra.PositionalArgs { return func(cmd *cobra.Command, args []string) error { From 52432f75ee51abd5f0eab82e40115c0bc47f687b Mon Sep 17 00:00:00 2001 From: Sam Richard Date: Thu, 5 Feb 2026 13:42:13 -0500 Subject: [PATCH 2/2] Update cmd/cli/commands/utils.go Update strings.Contains in utils.go Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- cmd/cli/commands/utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/cli/commands/utils.go b/cmd/cli/commands/utils.go index 3c122ddf..1f9f3654 100644 --- a/cmd/cli/commands/utils.go +++ b/cmd/cli/commands/utils.go @@ -172,7 +172,7 @@ func normalizeModelIdentifier(model string) string { } // If no tag is provided, assume the default tag. - if !strings.Contains(model, ":") { +if lastSlash := strings.LastIndex(model, "/"); !strings.Contains(model[lastSlash+1:], ":") { model = model + ":" + defaultTag }