canceled ollama requests on token canceled
This commit is contained in:
parent
02e65c5700
commit
f93d24dc39
1 changed files with 5 additions and 1 deletions
|
@ -87,7 +87,7 @@ const tokenProvider = async (
|
||||||
document: vscode.TextDocument,
|
document: vscode.TextDocument,
|
||||||
position: vscode.Position,
|
position: vscode.Position,
|
||||||
_context: vscode.InlineCompletionContext,
|
_context: vscode.InlineCompletionContext,
|
||||||
_token: vscode.CancellationToken,
|
token: vscode.CancellationToken,
|
||||||
) => {
|
) => {
|
||||||
const prefix = document.getText(new vscode.Range(0, 0, position.line, position.character));
|
const prefix = document.getText(new vscode.Range(0, 0, position.line, position.character));
|
||||||
|
|
||||||
|
@ -114,6 +114,10 @@ const tokenProvider = async (
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
token.onCancellationRequested(() => {
|
||||||
|
response.abort();
|
||||||
|
});
|
||||||
|
|
||||||
const resultBuffer: string[] = await new Promise(async (resolve, reject) => {
|
const resultBuffer: string[] = await new Promise(async (resolve, reject) => {
|
||||||
const buffer: string[] = [];
|
const buffer: string[] = [];
|
||||||
const timeout = setTimeout(() => {
|
const timeout = setTimeout(() => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue