- Add attributionModel.ts: getRealModelName() resolves model names for OpenAI/Gemini providers, so Git commit sign-off shows correct model name (DeepSeek/GPT/Gemini) instead of Anthropic default. - Wire into attribution.ts: replace multi-branch fallback logic with simple getRealModelName() call. - CCP's APIProvider doesn't include 'grok' — skipped that case.
This commit is contained in:
parent
2ea37816a6
commit
379335e3b2
|
|
@ -21,6 +21,7 @@ import {
|
||||||
isInternalModelRepoCached,
|
isInternalModelRepoCached,
|
||||||
sanitizeModelName,
|
sanitizeModelName,
|
||||||
} from './commitAttribution.js'
|
} from './commitAttribution.js'
|
||||||
|
import { getRealModelName } from './attributionModel.js'
|
||||||
import { logForDebugging } from './debug.js'
|
import { logForDebugging } from './debug.js'
|
||||||
import { parseJSONL } from './json.js'
|
import { parseJSONL } from './json.js'
|
||||||
import { logError } from './log.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).
|
// @[MODEL LAUNCH]: Update the hardcoded fallback model name below (guards against codename leaks).
|
||||||
// For internal repos, use the real model name. For external repos,
|
// Uses getRealModelName() for provider-aware model resolution (DeepSeek/Gemini/Grok → correct name).
|
||||||
// fall back to "Claude Opus 4.6" for unrecognized models to avoid leaking codenames.
|
const modelName = getRealModelName() || 'Claude Opus 4.6'
|
||||||
const model = getMainLoopModel()
|
|
||||||
const isKnownPublicModel = getPublicModelDisplayName(model) !== null
|
|
||||||
const modelName =
|
|
||||||
isInternalModelRepoCached() || isKnownPublicModel
|
|
||||||
? getPublicModelName(model)
|
|
||||||
: 'Claude Opus 4.6'
|
|
||||||
const defaultAttribution = `🤖 Generated with [Claude Code](${PRODUCT_URL})`
|
const defaultAttribution = `🤖 Generated with [Claude Code](${PRODUCT_URL})`
|
||||||
const defaultCommit = `Co-Authored-By: ${modelName} <noreply@anthropic.com>`
|
const defaultCommit = `Co-Authored-By: ${modelName} <noreply@anthropic.com>`
|
||||||
|
|
||||||
|
|
|
||||||
18
src/utils/attributionModel.ts
Normal file
18
src/utils/attributionModel.ts
Normal file
|
|
@ -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())
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user