|
|
@@ -197,16 +197,6 @@ export namespace Provider {
|
|
|
options: {},
|
|
|
}
|
|
|
},
|
|
|
- "github-copilot-enterprise": async () => {
|
|
|
- return {
|
|
|
- autoload: false,
|
|
|
- async getModel(sdk: any, modelID: string, _options?: Record<string, any>) {
|
|
|
- if (useLanguageModel(sdk)) return sdk.languageModel(modelID)
|
|
|
- return shouldUseCopilotResponsesApi(modelID) ? sdk.responses(modelID) : sdk.chat(modelID)
|
|
|
- },
|
|
|
- options: {},
|
|
|
- }
|
|
|
- },
|
|
|
azure: async (provider) => {
|
|
|
const resource = iife(() => {
|
|
|
const name = provider.options?.resourceName
|
|
|
@@ -863,20 +853,6 @@ export namespace Provider {
|
|
|
|
|
|
const configProviders = Object.entries(config.provider ?? {})
|
|
|
|
|
|
- // Add GitHub Copilot Enterprise provider that inherits from GitHub Copilot
|
|
|
- if (database["github-copilot"]) {
|
|
|
- const githubCopilot = database["github-copilot"]
|
|
|
- database["github-copilot-enterprise"] = {
|
|
|
- ...githubCopilot,
|
|
|
- id: ProviderID.githubCopilotEnterprise,
|
|
|
- name: "GitHub Copilot Enterprise",
|
|
|
- models: mapValues(githubCopilot.models, (model) => ({
|
|
|
- ...model,
|
|
|
- providerID: ProviderID.githubCopilotEnterprise,
|
|
|
- })),
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
function mergeProvider(providerID: ProviderID, provider: Partial<Info>) {
|
|
|
const existing = providers[providerID]
|
|
|
if (existing) {
|
|
|
@@ -1003,46 +979,16 @@ export namespace Provider {
|
|
|
const providerID = ProviderID.make(plugin.auth.provider)
|
|
|
if (disabled.has(providerID)) continue
|
|
|
|
|
|
- // For github-copilot plugin, check if auth exists for either github-copilot or github-copilot-enterprise
|
|
|
- let hasAuth = false
|
|
|
const auth = await Auth.get(providerID)
|
|
|
- if (auth) hasAuth = true
|
|
|
-
|
|
|
- // Special handling for github-copilot: also check for enterprise auth
|
|
|
- if (providerID === ProviderID.githubCopilot && !hasAuth) {
|
|
|
- const enterpriseAuth = await Auth.get("github-copilot-enterprise")
|
|
|
- if (enterpriseAuth) hasAuth = true
|
|
|
- }
|
|
|
-
|
|
|
- if (!hasAuth) continue
|
|
|
+ if (!auth) continue
|
|
|
if (!plugin.auth.loader) continue
|
|
|
|
|
|
- // Load for the main provider if auth exists
|
|
|
if (auth) {
|
|
|
const options = await plugin.auth.loader(() => Auth.get(providerID) as any, database[plugin.auth.provider])
|
|
|
const opts = options ?? {}
|
|
|
const patch: Partial<Info> = providers[providerID] ? { options: opts } : { source: "custom", options: opts }
|
|
|
mergeProvider(providerID, patch)
|
|
|
}
|
|
|
-
|
|
|
- // If this is github-copilot plugin, also register for github-copilot-enterprise if auth exists
|
|
|
- if (providerID === ProviderID.githubCopilot) {
|
|
|
- const enterpriseProviderID = ProviderID.githubCopilotEnterprise
|
|
|
- if (!disabled.has(enterpriseProviderID)) {
|
|
|
- const enterpriseAuth = await Auth.get(enterpriseProviderID)
|
|
|
- if (enterpriseAuth) {
|
|
|
- const enterpriseOptions = await plugin.auth.loader(
|
|
|
- () => Auth.get(enterpriseProviderID) as any,
|
|
|
- database[enterpriseProviderID],
|
|
|
- )
|
|
|
- const opts = enterpriseOptions ?? {}
|
|
|
- const patch: Partial<Info> = providers[enterpriseProviderID]
|
|
|
- ? { options: opts }
|
|
|
- : { source: "custom", options: opts }
|
|
|
- mergeProvider(enterpriseProviderID, patch)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
for (const [id, fn] of Object.entries(CUSTOM_LOADERS)) {
|