File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -80,12 +80,13 @@ export default class TextCompletePlugin extends AdminForthPlugin {
8080      handler : async  ( {  body,  headers } )  =>  { 
8181        if  ( this . options . rateLimit ?. limit )  { 
8282          // rate limit 
83-           const  {  error }  =  RateLimiter . checkRateLimit ( 
84-             this . pluginInstanceId ,  
85-             this . options . rateLimit ?. limit , 
86-             this . adminforth . auth . getClientIp ( headers ) , 
87-           ) ; 
88-           if  ( error )  { 
83+           // const { error } = RateLimiter.checkRateLimit( 
84+           //   this.pluginInstanceId,  
85+           //   this.options.rateLimit?.limit, 
86+           //   this.adminforth.auth.getClientIp(headers), 
87+           // ); 
88+           const  rateLimiter  =  new  RateLimiter ( this . options . rateLimit ?. limit ) ; 
89+           if  ( ! rateLimiter . consume ( `${ this . pluginInstanceId }  -${ this . adminforth . auth . getClientIp ( headers ) }  ` ) )  { 
8990            return  { 
9091              completion : [ ] , 
9192            } 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments