feat: add createdAt timestamps to check-in logs and improve i18n translations

- Added createdAt timestamps to various check-in log entries in checkinService.ts for better tracking.
- Updated i18n translations in Models.tsx to improve user experience with accurate Chinese translations.
- Reduced default page size in ProgramLogs.tsx and ProxyLogs.tsx from 80 and 100 to 50 for better performance.
- Enhanced ProxyLogs.tsx with memoization for filtered logs and summary statistics.
- Implemented support for parsing Unix timestamps and PostgreSQL-style timezone offsets in checkinLogTime.ts.
- Added comprehensive tests for database proxy query wrapper in index.proxy-wrap.test.ts to ensure functionality.
This commit is contained in:
cita
2026-03-05 21:18:49 +08:00
parent 0d5e56f478
commit fdf4f30987
19 changed files with 313 additions and 156 deletions
+1
View File
@@ -739,6 +739,7 @@ async function logProxy(
estimatedCost,
errorMessage: normalizedErrorMessage,
retryCount,
createdAt: new Date().toISOString(),
}).run();
} catch (error) {
console.warn('[proxy/chat] failed to write proxy log', error);
+14 -13
View File
@@ -247,20 +247,21 @@ async function logProxy(
errorMessage,
});
await db.insert(schema.proxyLogs).values({
routeId: selected.channel.routeId,
channelId: selected.channel.id,
accountId: selected.account.id,
modelRequested,
modelActual: selected.actualModel,
status,
httpStatus,
latencyMs,
promptTokens,
completionTokens,
totalTokens,
estimatedCost,
routeId: selected.channel.routeId,
channelId: selected.channel.id,
accountId: selected.account.id,
modelRequested,
modelActual: selected.actualModel,
status,
httpStatus,
latencyMs,
promptTokens,
completionTokens,
totalTokens,
estimatedCost,
errorMessage: normalizedErrorMessage,
retryCount,
retryCount,
createdAt: new Date().toISOString(),
}).run();
} catch (error) {
console.warn('[proxy/completions] failed to write proxy log', error);
+14 -13
View File
@@ -162,20 +162,21 @@ async function logProxy(
errorMessage,
});
await db.insert(schema.proxyLogs).values({
routeId: selected.channel.routeId,
channelId: selected.channel.id,
accountId: selected.account.id,
modelRequested,
modelActual: selected.actualModel,
status,
httpStatus,
latencyMs,
promptTokens,
completionTokens,
totalTokens,
estimatedCost,
routeId: selected.channel.routeId,
channelId: selected.channel.id,
accountId: selected.account.id,
modelRequested,
modelActual: selected.actualModel,
status,
httpStatus,
latencyMs,
promptTokens,
completionTokens,
totalTokens,
estimatedCost,
errorMessage: normalizedErrorMessage,
retryCount,
retryCount,
createdAt: new Date().toISOString(),
}).run();
} catch (error) {
console.warn('[proxy/embeddings] failed to write proxy log', error);
+14 -13
View File
@@ -132,20 +132,21 @@ async function logProxy(
errorMessage,
});
await db.insert(schema.proxyLogs).values({
routeId: selected.channel.routeId,
channelId: selected.channel.id,
accountId: selected.account.id,
modelRequested,
modelActual: selected.actualModel,
status,
httpStatus,
latencyMs,
promptTokens: 0,
completionTokens: 0,
totalTokens: 0,
estimatedCost,
routeId: selected.channel.routeId,
channelId: selected.channel.id,
accountId: selected.account.id,
modelRequested,
modelActual: selected.actualModel,
status,
httpStatus,
latencyMs,
promptTokens: 0,
completionTokens: 0,
totalTokens: 0,
estimatedCost,
errorMessage: normalizedErrorMessage,
retryCount,
retryCount,
createdAt: new Date().toISOString(),
}).run();
} catch (error) {
console.warn('[proxy/images] failed to write proxy log', error);
+1
View File
@@ -1597,6 +1597,7 @@ async function logProxy(
estimatedCost,
errorMessage: normalizedErrorMessage,
retryCount,
createdAt: new Date().toISOString(),
}).run();
} catch (error) {
console.warn('[proxy/responses] failed to write proxy log', error);