Merge pull request #9084 from r266-tech/codex/command-code-image-modalities

fix(codex): include Command Code image capabilities in model catalogs
This commit is contained in:
Wesley Liddick authored and GitHub committed 2026-11-26 11:48:38 +08:00
commit ab00fef989
2 files changed
+47 -2

No files matched your search

@@ -259,6 +259,7 @@ func loadCodexGroupCatalogAccounts(ctx context.Context, repo AccountRepository,
PlatformDeepseek,
PlatformMiniMax,
PlatformOpenCodeGo,
PlatformCommandCode,
},
false,
)
@@ -1182,7 +1183,9 @@ func groupCodexModelSupportsImageInput(
return false
}
}
if platform != PlatformOpenAI && platform != PlatformGrok && platform != PlatformDeepseek && platform != PlatformOpenCodeGo {
switch platform {
case PlatformOpenAI, PlatformGrok, PlatformDeepseek, PlatformOpenCodeGo, PlatformCommandCode:
default:
return false
}
@@ -1321,7 +1324,7 @@ func accountCodexModelSupportsImageInput(account *Account, upstreamModel string)
return false
}
switch account.Platform {
case PlatformOpenAI, PlatformDeepseek, PlatformOpenCodeGo:
case PlatformOpenAI, PlatformDeepseek, PlatformOpenCodeGo, PlatformCommandCode:
if metadata, ok := account.GetUpstreamModelMetadata(upstreamModel); ok {
if modalities := normalizeCodexInputModalities(metadata.InputModalities); len(modalities) > 0 {
// Official GPT-6 Astra metadata briefly shipped with a stale
@@ -1334,6 +1337,14 @@ func accountCodexModelSupportsImageInput(account *Account, upstreamModel string)
return stringSliceContains(modalities, "image")
}
}
if account.IsCommandCode() {
// Only infer capabilities for the provider's own endpoints when a
// synced model has no input modalities.
model := strings.TrimPrefix(strings.TrimSpace(upstreamModel), "deepseek/")
return model == "deepseek-v4.1-flash" &&
strings.TrimRight(account.GetOpenAIBaseURL(), "/") == DefaultCommandCodeBaseURL &&
strings.TrimRight(account.GetCNProtocolBaseURL(APIProtocolResponses), "/") == DefaultCommandCodeBaseURL
}
if strings.EqualFold(strings.TrimSpace(upstreamModel), "deepseek-v4-flash-vision-exp") {
return account.Type == AccountTypeAPIKey
}
@@ -816,6 +816,9 @@ func TestBuildCodexModelsManifestForGroupUsesDeepSeekVisionCapabilities(t *testi
return account
}
customResponses := newAccount(1, PlatformCommandCode, "deepseek-v4.1-flash", nil)
customResponses.Credentials["api_base_urls"] = map[string]any{APIProtocolResponses: "https://example.test/v1"}
tests := []struct {
name string
platform string
@@ -837,6 +840,36 @@ func TestBuildCodexModelsManifestForGroupUsesDeepSeekVisionCapabilities(t *testi
accounts: []Account{newAccount(1, PlatformDeepseek, visionModel, nil)},
modalities: []any{"text", "image"},
},
{
name: "Command Code bare ID", platform: PlatformCommandCode,
accounts: []Account{newAccount(1, PlatformCommandCode, "deepseek-v4.1-flash", nil)},
modalities: []any{"text", "image"},
},
{
name: "Composite Command Code mapping", platform: PlatformComposite,
accounts: []Account{newAccount(1, PlatformCommandCode, "deepseek/deepseek-v4.1-flash", nil)},
modalities: []any{"text", "image"},
},
{
name: "Command Code with a custom Responses endpoint", platform: PlatformCommandCode,
accounts: []Account{customResponses},
modalities: []any{"text"},
},
{
name: "Command Code text-only override", platform: PlatformCommandCode,
accounts: []Account{newAccount(1, PlatformCommandCode, "deepseek/deepseek-v4.1-flash", []string{"text"})},
modalities: []any{"text"},
},
{
name: "Command Code unknown model", platform: PlatformCommandCode,
accounts: []Account{newAccount(1, PlatformCommandCode, "unknown-model", nil)},
modalities: []any{"text"},
},
{
name: "Command Code explicit vision metadata", platform: PlatformCommandCode,
accounts: []Account{newAccount(1, PlatformCommandCode, "other-model", []string{"text", "image"})},
modalities: []any{"text", "image"},
},
{
name: "text-only DeepSeek Flash", platform: PlatformDeepseek,
accounts: []Account{newAccount(1, PlatformDeepseek, "deepseek-v4-flash", nil)},
@@ -1129,6 +1162,7 @@ func TestBuildCodexModelsManifestForGroupLoadsAccountsOnce(t *testing.T) {
require.Contains(t, repo.platforms, PlatformDeepseek)
require.Contains(t, repo.platforms, PlatformMiniMax)
require.Contains(t, repo.platforms, PlatformOpenCodeGo)
require.Contains(t, repo.platforms, PlatformCommandCode)
require.NotContains(t, repo.platforms, PlatformComposite)
}