feat: update error messages in NewApiAdapter tests to use correct Chinese translations

feat: enhance proxy usage parser to include cache read and creation tokens

feat: add billing details to ProxyLog interface and implement related formatting functions

fix: correct mojibake issues in source files and add regression test for mojibake detection

chore: add SQL migration for billing details in proxy_logs table

test: improve site speed button tests to ensure proper state updates without DOM lookups
This commit is contained in:
cita
2026-03-06 17:10:01 +08:00
parent 2a810facb8
commit 55b1ae564e
23 changed files with 1298 additions and 344 deletions
+12
View File
@@ -263,6 +263,17 @@ function ensureDownstreamApiKeySchema() {
`);
}
function ensureProxyLogBillingDetailsSchema() {
const sqlite = requireSqliteConnection();
if (!tableExists('proxy_logs')) {
return;
}
if (!tableColumnExists('proxy_logs', 'billing_details')) {
sqlite.exec('ALTER TABLE proxy_logs ADD COLUMN billing_details text;');
}
}
async function sqliteProxyQuery(sqlText: string, params: unknown[], method: SqlMethod) {
const sqlite = requireSqliteConnection();
const statement = sqlite.prepare(sqlText);
@@ -518,6 +529,7 @@ function initSqliteDb() {
ensureSiteGlobalWeightSchema();
ensureRouteGroupingSchema();
ensureDownstreamApiKeySchema();
ensureProxyLogBillingDetailsSchema();
const rawDb = drizzleSqliteProxy(
(sqlText, params, method) => sqliteProxyQuery(sqlText, params, method as SqlMethod),
+1
View File
@@ -155,6 +155,7 @@ export const proxyLogs = sqliteTable('proxy_logs', {
completionTokens: integer('completion_tokens'),
totalTokens: integer('total_tokens'),
estimatedCost: real('estimated_cost'),
billingDetails: text('billing_details'),
errorMessage: text('error_message'),
retryCount: integer('retry_count').default(0),
createdAt: text('created_at').default(sql`(datetime('now'))`),