diff --git a/src/utils/attribution.ts b/src/utils/attribution.ts index d76291637..4c79417f0 100644 --- a/src/utils/attribution.ts +++ b/src/utils/attribution.ts @@ -21,6 +21,7 @@ import { isInternalModelRepoCached, sanitizeModelName, } from './commitAttribution.js' +import { getRealModelName } from './attributionModel.js' import { logForDebugging } from './debug.js' import { parseJSONL } from './json.js' import { logError } from './log.js' @@ -68,14 +69,8 @@ export function getAttributionTexts(): AttributionTexts { } // @[MODEL LAUNCH]: Update the hardcoded fallback model name below (guards against codename leaks). - // For internal repos, use the real model name. For external repos, - // fall back to "Claude Opus 4.6" for unrecognized models to avoid leaking codenames. - const model = getMainLoopModel() - const isKnownPublicModel = getPublicModelDisplayName(model) !== null - const modelName = - isInternalModelRepoCached() || isKnownPublicModel - ? getPublicModelName(model) - : 'Claude Opus 4.6' + // Uses getRealModelName() for provider-aware model resolution (DeepSeek/Gemini/Grok → correct name). + const modelName = getRealModelName() || 'Claude Opus 4.6' const defaultAttribution = `🤖 Generated with [Claude Code](${PRODUCT_URL})` const defaultCommit = `Co-Authored-By: ${modelName} ` diff --git a/src/utils/attributionModel.ts b/src/utils/attributionModel.ts new file mode 100644 index 000000000..a45c3c545 --- /dev/null +++ b/src/utils/attributionModel.ts @@ -0,0 +1,18 @@ +import { resolveGeminiModel, resolveOpenAIModel } from '@ant/model-provider' +import { getMainLoopModel } from './model/model.js' +import { getAPIProvider } from './model/providers.js' + +function resolveProviderModel(anthropicModel: string): string { + switch (getAPIProvider()) { + case 'openai': + return resolveOpenAIModel(anthropicModel) + case 'gemini': + return resolveGeminiModel(anthropicModel) + default: + return anthropicModel + } +} + +export function getRealModelName(): string { + return resolveProviderModel(getMainLoopModel()) +}