File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 4
4
IInlineCompletionProvider
5
5
} from '@jupyterlab/completer' ;
6
6
7
- import { Debouncer } from '@lumino/polling' ;
7
+ import { Throttler } from '@lumino/polling' ;
8
8
9
9
import MistralClient , { CompletionRequest } from '@mistralai/mistralai' ;
10
10
@@ -19,7 +19,7 @@ export class CodestralProvider implements IInlineCompletionProvider {
19
19
20
20
constructor ( options : CodestralProvider . IOptions ) {
21
21
this . _mistralClient = options . mistralClient ;
22
- this . _debouncer = new Debouncer ( async ( data : CompletionRequest ) => {
22
+ this . _throttler = new Throttler ( async ( data : CompletionRequest ) => {
23
23
const response = await this . _mistralClient . completion ( data ) ;
24
24
const items = response . choices . map ( ( choice : any ) => {
25
25
return { insertText : choice . message . content as string } ;
@@ -53,14 +53,14 @@ export class CodestralProvider implements IInlineCompletionProvider {
53
53
} ;
54
54
55
55
try {
56
- return this . _debouncer . invoke ( data ) ;
56
+ return this . _throttler . invoke ( data ) ;
57
57
} catch ( error ) {
58
58
console . error ( 'Error fetching completions' , error ) ;
59
59
return { items : [ ] } ;
60
60
}
61
61
}
62
62
63
- private _debouncer : Debouncer ;
63
+ private _throttler : Throttler ;
64
64
private _mistralClient : MistralClient ;
65
65
}
66
66
You can’t perform that action at this time.
0 commit comments