feat(FN-2594): merge fusion/fn-2594
This commit is contained in:
@@ -85,6 +85,21 @@ describe("wrapAuthStorageWithApiKeyProviders", () => {
|
||||
expect(merged.list()).toEqual(expect.arrayContaining(["openrouter", "minimax"]));
|
||||
});
|
||||
|
||||
it("excludes pi-claude-cli models from API key providers", () => {
|
||||
const fusionAuth = makeAuthStorage();
|
||||
const modelRegistry = {
|
||||
getAll: vi.fn(() => [
|
||||
{ provider: "pi-claude-cli", id: "claude-cli/sonnet" },
|
||||
{ provider: "openrouter", id: "openrouter/auto" },
|
||||
]),
|
||||
} as any;
|
||||
|
||||
const wrapped = wrapAuthStorageWithApiKeyProviders(fusionAuth, modelRegistry);
|
||||
const providerIds = wrapped.getApiKeyProviders().map((provider) => provider.id);
|
||||
|
||||
expect(providerIds).toContain("openrouter");
|
||||
expect(providerIds).not.toContain("pi-claude-cli");
|
||||
});
|
||||
|
||||
it("reads legacy auth JSON without creating missing files", async () => {
|
||||
const tempDir = tempWorkspace("fusion-provider-auth-");
|
||||
|
||||
@@ -47,6 +47,8 @@ const BUILT_IN_API_KEY_PROVIDERS: Array<{ id: string; name: string }> = [
|
||||
{ id: "zai", name: "Zai" },
|
||||
];
|
||||
|
||||
const CLI_PROVIDER_IDS = new Set(["pi-claude-cli"]);
|
||||
|
||||
function getProviderDisplayName(providerId: string): string {
|
||||
const knownProviderNames = new Map(
|
||||
BUILT_IN_API_KEY_PROVIDERS.map((provider) => [provider.id, provider.name]),
|
||||
@@ -93,7 +95,12 @@ export function wrapAuthStorageWithApiKeyProviders(
|
||||
|
||||
for (const model of modelRegistry.getAll()) {
|
||||
const providerId = model.provider;
|
||||
if (!providerId || oauthProviderIds.has(providerId) || providers.has(providerId)) {
|
||||
if (
|
||||
!providerId ||
|
||||
oauthProviderIds.has(providerId) ||
|
||||
providers.has(providerId) ||
|
||||
CLI_PROVIDER_IDS.has(providerId)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
providers.set(providerId, getProviderDisplayName(providerId));
|
||||
|
||||
Reference in New Issue
Block a user