-
Notifications
You must be signed in to change notification settings - Fork 8.3k
[GitHub] github:copilot is a routing alias — no model control or visibility #897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 16 commits
1c38084
de4c1b2
db1f9f3
65c00e1
c451548
144cc6e
b3e1a61
d1c1829
ee6f94c
20599b2
3f8d867
6d02223
9cc8902
b717f8f
a42bf48
29130a8
faaa5e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,8 +7,8 @@ | |
|
|
||
| import { isLocalProviderUrl, resolveProviderRequest } from '../services/api/providerConfig.js' | ||
| import { getLocalOpenAICompatibleProviderLabel } from '../utils/providerDiscovery.js' | ||
| import { getSettings_DEPRECATED } from '../utils/settings/settings.js' | ||
| import { parseUserSpecifiedModel } from '../utils/model/model.js' | ||
| import { getSettingsForSource } from '../utils/settings/settings.js' | ||
| import { getPublicModelDisplayName, parseUserSpecifiedModel } from '../utils/model/model.js' | ||
| import { containsExactZaiGlmModelId, isZaiBaseUrl } from '../utils/zaiProvider.js' | ||
|
|
||
| declare const MACRO: { VERSION: string; DISPLAY_VERSION?: string } | ||
|
|
@@ -85,32 +85,50 @@ const LOGO_CLAUDE = [ | |
| // ─── Provider detection ─────────────────────────────────────────────────────── | ||
|
|
||
| export function detectProvider(modelOverride?: string): { name: string; model: string; baseUrl: string; isLocal: boolean } { | ||
| const settings = getSettingsForSource('userSettings') || {} | ||
| const useGemini = process.env.CLAUDE_CODE_USE_GEMINI === '1' || process.env.CLAUDE_CODE_USE_GEMINI === 'true' | ||
| const useGithub = process.env.CLAUDE_CODE_USE_GITHUB === '1' || process.env.CLAUDE_CODE_USE_GITHUB === 'true' | ||
| const useOpenAI = process.env.CLAUDE_CODE_USE_OPENAI === '1' || process.env.CLAUDE_CODE_USE_OPENAI === 'true' | ||
| const useMistral = process.env.CLAUDE_CODE_USE_MISTRAL === '1' || process.env.CLAUDE_CODE_USE_MISTRAL === 'true' | ||
|
|
||
| if (useGemini) { | ||
| const model = modelOverride || process.env.GEMINI_MODEL || 'gemini-2.0-flash' | ||
| const model = modelOverride || settings.model || process.env.GEMINI_MODEL || 'gemini-2.0-flash' | ||
| const baseUrl = process.env.GEMINI_BASE_URL || 'https://generativelanguage.googleapis.com/v1beta/openai' | ||
| return { name: 'Google Gemini', model, baseUrl, isLocal: false } | ||
| return { | ||
| name: 'Google Gemini', | ||
| model: getPublicModelDisplayName(model) ?? model, | ||
| baseUrl, | ||
| isLocal: false, | ||
| } | ||
| } | ||
|
|
||
| if (useMistral) { | ||
| const model = modelOverride || process.env.MISTRAL_MODEL || 'devstral-latest' | ||
| const model = modelOverride || settings.model || process.env.MISTRAL_MODEL || 'devstral-latest' | ||
| const baseUrl = process.env.MISTRAL_BASE_URL || 'https://api.mistral.ai/v1' | ||
| return { name: 'Mistral', model, baseUrl, isLocal: false } | ||
| return { | ||
| name: 'Mistral', | ||
| model: getPublicModelDisplayName(model) ?? model, | ||
| baseUrl, | ||
| isLocal: false, | ||
| } | ||
| } | ||
|
|
||
| if (useGithub) { | ||
| const model = modelOverride || process.env.OPENAI_MODEL || 'github:copilot' | ||
| const baseUrl = | ||
| process.env.OPENAI_BASE_URL || 'https://api.githubcopilot.com' | ||
| return { name: 'GitHub Copilot', model, baseUrl, isLocal: false } | ||
| const rawModel = process.env.OPENAI_MODEL?.trim() || 'github:copilot' | ||
| const resolvedRequest = resolveProviderRequest({ | ||
| model: rawModel, | ||
| baseUrl: process.env.OPENAI_BASE_URL, | ||
| }) | ||
|
LoackyBit marked this conversation as resolved.
Comment on lines
116
to
+121
|
||
| const baseUrl = resolvedRequest.baseUrl | ||
| let displayModel = resolvedRequest.resolvedModel | ||
| if (resolvedRequest.reasoning?.effort) { | ||
| displayModel = `${displayModel} (${resolvedRequest.reasoning.effort})` | ||
| } | ||
| return { name: 'GitHub Copilot', model: displayModel, baseUrl, isLocal: false } | ||
| } | ||
|
|
||
| if (useOpenAI) { | ||
| const rawModel = modelOverride || process.env.OPENAI_MODEL || 'gpt-4o' | ||
| const rawModel = modelOverride || settings.model || process.env.OPENAI_MODEL || 'gpt-4o' | ||
| const resolvedRequest = resolveProviderRequest({ | ||
| model: rawModel, | ||
| baseUrl: process.env.OPENAI_BASE_URL, | ||
|
|
@@ -158,7 +176,7 @@ export function detectProvider(modelOverride?: string): { name: string; model: s | |
| else if (isLocal) name = getLocalOpenAICompatibleProviderLabel(baseUrl) | ||
|
|
||
| // Resolve model alias to actual model name + reasoning effort | ||
| let displayModel = resolvedRequest.resolvedModel | ||
| let displayModel = getPublicModelDisplayName(resolvedRequest.resolvedModel) ?? resolvedRequest.resolvedModel | ||
| if (resolvedRequest.reasoning?.effort) { | ||
| displayModel = `${displayModel} (${resolvedRequest.reasoning.effort})` | ||
| } | ||
|
|
@@ -167,12 +185,11 @@ export function detectProvider(modelOverride?: string): { name: string; model: s | |
| } | ||
|
|
||
| // Default: Anthropic - check settings.model first, then env vars | ||
| const settings = getSettings_DEPRECATED() || {} | ||
| const modelSetting = modelOverride || settings.model || process.env.ANTHROPIC_MODEL || process.env.CLAUDE_MODEL || 'claude-sonnet-4-6' | ||
| const resolvedModel = parseUserSpecifiedModel(modelSetting) | ||
| const baseUrl = process.env.ANTHROPIC_BASE_URL ?? 'https://api.anthropic.com' | ||
| const isLocal = isLocalProviderUrl(baseUrl) | ||
| return { name: 'Anthropic', model: resolvedModel, baseUrl, isLocal } | ||
| return { name: 'Anthropic', model: getPublicModelDisplayName(resolvedModel) ?? resolvedModel, baseUrl, isLocal } | ||
| } | ||
|
|
||
| // ─── Box drawing ────────────────────────────────────────────────────────────── | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getGithubProviderModel()now always returns an empty string, so GitHub provider summaries never show the configured model (and the function becomes dead code). If the intent is to hide the model, consider inlining/removing this helper; otherwise, return the resolved model fromGITHUB_MODEL/OPENAI_MODEL/settings so the summary remains informative.