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:
@@ -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),
|
||||
|
||||
@@ -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'))`),
|
||||
|
||||
Reference in New Issue
Block a user