mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 12:22:14 +03:00
fix: clean up proxy page redundancy and fix 1proxy sync empty body error (#2052)
This commit is contained in:
@@ -239,7 +239,8 @@ function getActiveBudgetLimit(budget: NormalizedBudgetConfig): number {
|
||||
function getBudgetWindowTotal(apiKeyId: string, periodStartAt: number): number {
|
||||
try {
|
||||
return (
|
||||
loadCostTotal(apiKeyId, periodStartAt) + spendBatchWriter.getPendingCostTotal(apiKeyId, periodStartAt)
|
||||
loadCostTotal(apiKeyId, periodStartAt) +
|
||||
spendBatchWriter.getPendingCostTotal(apiKeyId, periodStartAt)
|
||||
);
|
||||
} catch {
|
||||
return 0;
|
||||
|
||||
@@ -16,7 +16,12 @@ type PricingByProvider = Record<string, PricingModels>;
|
||||
export type PricingSource = "default" | "litellm" | "modelsDev" | "user";
|
||||
export type PricingSourceMap = Record<string, Record<string, PricingSource>>;
|
||||
type ProxyValue = JsonRecord | string | null;
|
||||
type ProxyResolutionResult = { proxy: ProxyValue; level: string; levelId: string | null; source?: string };
|
||||
type ProxyResolutionResult = {
|
||||
proxy: ProxyValue;
|
||||
level: string;
|
||||
levelId: string | null;
|
||||
source?: string;
|
||||
};
|
||||
type ProxyResolutionCacheEntry = {
|
||||
generation: number;
|
||||
registryGeneration: number;
|
||||
@@ -541,7 +546,12 @@ export async function resolveProxyForConnection(connectionId: string) {
|
||||
const registryResolved = await resolveProxyForConnectionFromRegistry(connectionId);
|
||||
if (registryResolved?.proxy) {
|
||||
if (registryResolved.level === "account") {
|
||||
cacheProxyResolution(connectionId, startGeneration, startRegistryGeneration, registryResolved);
|
||||
cacheProxyResolution(
|
||||
connectionId,
|
||||
startGeneration,
|
||||
startRegistryGeneration,
|
||||
registryResolved
|
||||
);
|
||||
}
|
||||
return registryResolved;
|
||||
}
|
||||
|
||||
@@ -861,9 +861,7 @@ export async function getCallLogById(id: string) {
|
||||
LEFT JOIN provider_nodes pn ON pn.id = cl.provider
|
||||
WHERE cl.id = ?`
|
||||
)
|
||||
.get(id) as
|
||||
| CallLogSummaryRow
|
||||
| undefined;
|
||||
.get(id) as CallLogSummaryRow | undefined;
|
||||
if (!row) return null;
|
||||
|
||||
const entry = mapSummaryRow(row);
|
||||
|
||||
Reference in New Issue
Block a user