fix: clean up proxy page redundancy and fix 1proxy sync empty body error (#2052)

This commit is contained in:
diegosouzapw
2026-05-08 17:43:41 -03:00
parent e26f79f052
commit aacd43bb45
8 changed files with 51 additions and 19 deletions

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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);