mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-14 11:12:17 +03:00
fix(sse): drop the localDb barrel imports from chat and auth (#9380)
Merge-train validated (tip 6ce4effef8). Vitest failures confirmed as base-red (#9679).
This commit is contained in:
@@ -1356,24 +1356,11 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"src/sse/handlers/chat.ts": {
|
||||
"no-restricted-imports": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"src/sse/handlers/chatHelpers.ts": {
|
||||
"no-restricted-imports": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"src/sse/services/auth.ts": {
|
||||
"no-restricted-imports": {
|
||||
"count": 1
|
||||
},
|
||||
"no-restricted-syntax": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"src/sse/services/model.ts": {
|
||||
"no-restricted-imports": {
|
||||
"count": 2
|
||||
|
||||
@@ -54,11 +54,10 @@ import { promoteSuccessfulComboModel } from "@/lib/combos/autoPromote";
|
||||
import {
|
||||
deleteSessionAccountAffinity,
|
||||
evictSessionAccountAffinityForConnection,
|
||||
getCachedSettings,
|
||||
getCombos,
|
||||
getCombosCacheVersion,
|
||||
getSessionAccountAffinity,
|
||||
} from "@/lib/localDb";
|
||||
} from "@/lib/db/sessionAccountAffinity";
|
||||
import { getCachedSettings, getCombosCacheVersion } from "@/lib/db/readCache";
|
||||
import { getCombos } from "@/lib/db/combos";
|
||||
import { resolveModelLockoutSettings } from "@/lib/resilience/modelLockoutSettings";
|
||||
import {
|
||||
ensureOpenAIStoreSessionFallback,
|
||||
@@ -956,7 +955,7 @@ async function handleChatImplementation(
|
||||
const providerPrefix = resolvedModelStr.split("/")[0];
|
||||
if (providerPrefix) {
|
||||
try {
|
||||
const { getComboByName } = await import("@/lib/localDb");
|
||||
const { getComboByName } = await import("@/lib/db/combos");
|
||||
const routingCombo = await getComboByName(providerPrefix);
|
||||
if (routingCombo?.id) {
|
||||
routingComboId = routingCombo.id;
|
||||
|
||||
@@ -2,16 +2,19 @@ import { randomUUID, createHash } from "crypto";
|
||||
import { extractGoogApiKeyHeader } from "./googApiKeyAuth.ts";
|
||||
import {
|
||||
getCachedRawProviderConnections,
|
||||
getProviderConnections,
|
||||
getCachedProviderNodes,
|
||||
validateApiKey,
|
||||
getCachedSettings,
|
||||
} from "@/lib/db/readCache";
|
||||
import {
|
||||
getProviderConnections,
|
||||
updateProviderConnection,
|
||||
resetConnectionBackoff,
|
||||
getSettings,
|
||||
getCachedSettings,
|
||||
touchConnectionLastUsed,
|
||||
clearConnectionErrorIfUnchanged,
|
||||
} from "@/lib/localDb";
|
||||
} from "@/lib/db/providers";
|
||||
import { validateApiKey } from "@/lib/db/apiKeys";
|
||||
import { getSettings } from "@/lib/db/settings";
|
||||
import { toNumber } from "@/shared/utils/numeric";
|
||||
import {
|
||||
createLazyConnectionView,
|
||||
toProviderConnection,
|
||||
@@ -125,15 +128,6 @@ function toStringOrNull(value: unknown): string | null {
|
||||
return typeof value === "string" && value.trim().length > 0 ? value : null;
|
||||
}
|
||||
|
||||
function toNumber(value: unknown, fallback = 0): number {
|
||||
if (typeof value === "number" && Number.isFinite(value)) return value;
|
||||
if (typeof value === "string" && value.trim().length > 0) {
|
||||
const parsed = Number(value);
|
||||
return Number.isFinite(parsed) ? parsed : fallback;
|
||||
}
|
||||
return fallback;
|
||||
}
|
||||
|
||||
function toNullableNumber(value: unknown): number | null {
|
||||
if (value === null || value === undefined) return null;
|
||||
const parsed = toNumber(value, Number.NaN);
|
||||
|
||||
Reference in New Issue
Block a user