File tree Expand file tree Collapse file tree
packages/console/app/src/routes/zen/util Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,6 +30,8 @@ export function createModelTpmLimiter(providers: { id: string; model: string; tp
3030 )
3131 } ,
3232 track : async ( id : string , model : string , usageInfo : UsageInfo ) => {
33+ const key = `${ id } /${ model } `
34+ if ( ! keys . includes ( key ) ) return
3335 const usage =
3436 usageInfo . inputTokens +
3537 usageInfo . outputTokens +
@@ -41,7 +43,7 @@ export function createModelTpmLimiter(providers: { id: string; model: string; tp
4143 await Database . use ( ( tx ) =>
4244 tx
4345 . insert ( ModelRateLimitTable )
44- . values ( { key : ` ${ id } / ${ model } ` , interval : yyyyMMddHHmm , count : usage } )
46+ . values ( { key, interval : yyyyMMddHHmm , count : usage } )
4547 . onDuplicateKeyUpdate ( { set : { count : sql `${ ModelRateLimitTable . count } + ${ usage } ` } } ) ,
4648 )
4749 } ,
You can’t perform that action at this time.
0 commit comments