mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-03 05:45:04 +03:00
fix(types): remove extraneous config/models from AutoComboConfig returns and type seedConnection overrides
This commit is contained in:
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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>) || {},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user