fix(types): remove extraneous config/models from AutoComboConfig returns and type seedConnection overrides

This commit is contained in:
diegosouzapw
2026-05-11 00:13:20 -03:00
parent 966e411ecb
commit 7d8b783195
2 changed files with 11 additions and 26 deletions

View File

@@ -55,13 +55,6 @@ export async function createVirtualAutoCombo(
weights: { ...DEFAULT_WEIGHTS },
explorationRate: 0.05,
routerStrategy: "lkgp",
config: {
candidatePool: emptyPool,
weights: { ...DEFAULT_WEIGHTS },
explorationRate: 0.05,
routingStrategy: "lkgp",
},
models: emptyPool,
};
}
@@ -122,20 +115,9 @@ export async function createVirtualAutoCombo(
id: `virtual-auto-${variant || "default"}`,
name: `Auto ${variant || "Default"}`,
type: "auto",
// Root-level fields for AutoComboConfig type compatibility
candidatePool: pool,
weights: weights,
explorationRate: explorationRate,
routerStrategy: routerStrategy,
// Nested config for combo router's auto-type handler
// (reads via: combo?.autoConfig || combo?.config?.auto || combo?.config || {})
config: {
candidatePool: pool,
weights: weights,
explorationRate: explorationRate,
routingStrategy: routerStrategy,
},
// models array so resolveComboTargets doesn't get an empty array
models: pool,
};
}

View File

@@ -24,16 +24,19 @@ async function resetStorage() {
fs.mkdirSync(TEST_DATA_DIR, { recursive: true });
}
async function seedConnection(provider, overrides = {}) {
async function seedConnection(
provider: string,
overrides: Record<string, unknown> = {}
) {
return providersDb.createProviderConnection({
provider,
authType: overrides.authType || "apikey",
name: overrides.name || `${provider}-${Math.random().toString(16).slice(2, 8)}`,
apiKey: overrides.apiKey || "sk-test",
accessToken: overrides.accessToken,
isActive: overrides.isActive ?? true,
testStatus: overrides.testStatus || "active",
providerSpecificData: overrides.providerSpecificData || {},
authType: (overrides.authType as string) || "apikey",
name: (overrides.name as string) || `${provider}-${Math.random().toString(16).slice(2, 8)}`,
apiKey: (overrides.apiKey as string) || "sk-test",
accessToken: overrides.accessToken as string | undefined,
isActive: (overrides.isActive as boolean) ?? true,
testStatus: (overrides.testStatus as string) || "active",
providerSpecificData: (overrides.providerSpecificData as Record<string, unknown>) || {},
});
}