@jeffreycao/copilot-api 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +1 -1
- package/dist/{server-npfFvUzR.js → server-BDdqK9ps.js} +21 -10
- package/dist/{server-npfFvUzR.js.map → server-BDdqK9ps.js.map} +1 -1
- package/dist/{start-CS27P3z1.js → start-BZqWghY0.js} +2 -2
- package/dist/{start-CS27P3z1.js.map → start-BZqWghY0.js.map} +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -25,7 +25,7 @@ bindElectronFetch();
|
|
|
25
25
|
const { auth } = await import("./auth-DH-ThnhJ.js");
|
|
26
26
|
const { debug } = await import("./debug-D2giR-Kj.js");
|
|
27
27
|
const { mcp } = await import("./mcp-BG6fpi6q.js");
|
|
28
|
-
const { start } = await import("./start-
|
|
28
|
+
const { start } = await import("./start-BZqWghY0.js");
|
|
29
29
|
await runMain(defineCommand({
|
|
30
30
|
meta: {
|
|
31
31
|
name: "copilot-api",
|
|
@@ -7561,17 +7561,11 @@ async function handleMergedCodexModels(c, candidatesRequest, options = {}) {
|
|
|
7561
7561
|
const slug = `codex/${model.slug}`;
|
|
7562
7562
|
if (seenSlugs.has(slug)) return [];
|
|
7563
7563
|
seenSlugs.add(slug);
|
|
7564
|
-
return [
|
|
7565
|
-
...model,
|
|
7566
|
-
slug
|
|
7567
|
-
}];
|
|
7564
|
+
return [createCatalogAlias(model, slug, options.codexProviderName)];
|
|
7568
7565
|
}) : [];
|
|
7569
7566
|
const syntheticModels = candidates.filter((candidate) => !seenSlugs.has(candidate.slug)).flatMap((candidate, index) => {
|
|
7570
7567
|
const catalogModel = candidate.catalogSlug ? catalogModelsBySlug.get(candidate.catalogSlug) : void 0;
|
|
7571
|
-
if (catalogModel) return [
|
|
7572
|
-
...catalogModel,
|
|
7573
|
-
slug: candidate.slug
|
|
7574
|
-
}];
|
|
7568
|
+
if (catalogModel) return [createCatalogAlias(catalogModel, candidate.slug, candidate.providerName)];
|
|
7575
7569
|
if (candidate.catalogMatchRequired) return [];
|
|
7576
7570
|
return [createSyntheticCodexModel(candidate, template, upstreamModels.length + index)];
|
|
7577
7571
|
});
|
|
@@ -7591,6 +7585,18 @@ async function handleMergedCodexModels(c, candidatesRequest, options = {}) {
|
|
|
7591
7585
|
});
|
|
7592
7586
|
return c.json(response);
|
|
7593
7587
|
}
|
|
7588
|
+
function createCatalogAlias(model, slug, providerName) {
|
|
7589
|
+
const alias = {
|
|
7590
|
+
...model,
|
|
7591
|
+
slug
|
|
7592
|
+
};
|
|
7593
|
+
const prefix = providerName?.trim();
|
|
7594
|
+
if (!prefix || typeof alias.display_name !== "string" || alias.display_name.startsWith(`${prefix} `)) return alias;
|
|
7595
|
+
return {
|
|
7596
|
+
...alias,
|
|
7597
|
+
display_name: `${prefix} ${alias.display_name}`
|
|
7598
|
+
};
|
|
7599
|
+
}
|
|
7594
7600
|
function createSyntheticCodexModel(candidate, template, priority) {
|
|
7595
7601
|
const reasoningEfforts = candidate.reasoningEfforts.length > 0 ? candidate.reasoningEfforts : DEFAULT_REASONING_EFFORTS;
|
|
7596
7602
|
const defaultReasoningEffort = reasoningEfforts.includes(candidate.defaultReasoningEffort) ? candidate.defaultReasoningEffort : reasoningEfforts[0];
|
|
@@ -7880,6 +7886,7 @@ function createProviderCodexCandidate(providerConfig, modelId, remoteModel, mode
|
|
|
7880
7886
|
slug: `${providerConfig.name}/${modelId}`,
|
|
7881
7887
|
catalogSlug: modelId,
|
|
7882
7888
|
catalogMatchRequired: effectiveType === "openai-responses",
|
|
7889
|
+
providerName: providerConfig.name,
|
|
7883
7890
|
displayName: `${displayName} (${providerConfig.name})`,
|
|
7884
7891
|
description: `${displayName} through the ${providerConfig.name} ${adapterName} adapter.`,
|
|
7885
7892
|
contextWindow: positiveNumber(codexConfig?.contextWindow ?? getFirstPositiveNumber(remoteModel, [
|
|
@@ -7940,7 +7947,11 @@ modelRoutes.get("/", async (c) => {
|
|
|
7940
7947
|
try {
|
|
7941
7948
|
if (isCodexUserAgent(c.req.header("user-agent"))) {
|
|
7942
7949
|
const enabledProviders = listEnabledProviders();
|
|
7943
|
-
|
|
7950
|
+
const codexProviderName = enabledProviders.find((provider) => provider === "codex");
|
|
7951
|
+
return await handleMergedCodexModels(c, getSyntheticCodexModels(c.req.raw.headers, enabledProviders), {
|
|
7952
|
+
includeCodexProviderAliases: codexProviderName !== void 0,
|
|
7953
|
+
codexProviderName
|
|
7954
|
+
});
|
|
7944
7955
|
}
|
|
7945
7956
|
const models = await getAggregatedModels(c.req.raw.headers);
|
|
7946
7957
|
return c.json({
|
|
@@ -10051,4 +10062,4 @@ server.route("/:provider/images", providerImageRoutes);
|
|
|
10051
10062
|
//#endregion
|
|
10052
10063
|
export { server };
|
|
10053
10064
|
|
|
10054
|
-
//# sourceMappingURL=server-
|
|
10065
|
+
//# sourceMappingURL=server-BDdqK9ps.js.map
|