Compare commits
4
Commits
v0.2.1
...
4fdaa0ca9d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4fdaa0ca9d | ||
|
|
9798a41745 | ||
|
|
46b8d7e888 | ||
|
|
0460305327 |
No files matched your search
+8
-1
@@ -10,6 +10,12 @@ and this project adheres to
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.2.2] - 2026-11-06
|
||||
|
||||
### Fixed
|
||||
|
||||
- Correct the publisher in package.json.
|
||||
|
||||
## [0.2.1] - 2026-11-06
|
||||
|
||||
### Fixed
|
||||
@@ -64,7 +70,8 @@ First release usable for chat.
|
||||
|
||||
Initial development release. Not functional for chat.
|
||||
|
||||
[Unreleased]: https://git.inference.coop/evanp/inference-coop-copilot/compare/v0.2.1...HEAD
|
||||
[Unreleased]: https://git.inference.coop/evanp/inference-coop-copilot/compare/v0.2.2...HEAD
|
||||
[0.2.2]: https://git.inference.coop/evanp/inference-coop-copilot/compare/v0.2.1...v0.2.2
|
||||
[0.2.1]: https://git.inference.coop/evanp/inference-coop-copilot/compare/v0.2.0...v0.2.1
|
||||
[0.2.0]: https://git.inference.coop/evanp/inference-coop-copilot/compare/v0.1.0...v0.2.0
|
||||
[0.1.0]: https://git.inference.coop/evanp/inference-coop-copilot/releases/tag/v0.1.0
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "inference-coop-copilot",
|
||||
"version": "0.2.1",
|
||||
"version": "0.2.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "inference-coop-copilot",
|
||||
"version": "0.2.1",
|
||||
"version": "0.2.2",
|
||||
"devDependencies": {
|
||||
"@types/mocha": "^10.0.10",
|
||||
"@types/node": "24.x",
|
||||
|
||||
+2
-2
@@ -2,11 +2,11 @@
|
||||
"name": "inference-coop-copilot",
|
||||
"displayName": "inference-coop-copilot",
|
||||
"description": "Inference.coop models for Copilot Chat (unofficial)",
|
||||
"version": "0.2.1",
|
||||
"version": "0.2.2",
|
||||
"engines": {
|
||||
"vscode": "^1.145.0"
|
||||
},
|
||||
"publisher": "inference-coop",
|
||||
"publisher": "evanp",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://git.inference.coop/evanp/inference-coop-copilot.git"
|
||||
|
||||
+34
-1
@@ -109,6 +109,19 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
body.tool_choice = "auto";
|
||||
}
|
||||
|
||||
if (token.isCancellationRequested) {
|
||||
out.appendLine(" request cancelled before it started");
|
||||
return;
|
||||
}
|
||||
|
||||
// Abort the request as soon as the user cancels, so a cancelled chat
|
||||
// stops generating (and stops billing) server-side.
|
||||
const abort = new AbortController();
|
||||
const cancelSubscription = token.onCancellationRequested(() =>
|
||||
abort.abort(),
|
||||
);
|
||||
|
||||
try {
|
||||
const res = await fetch(`${BASE_URL}/chat/completions`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
@@ -116,7 +129,7 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(body),
|
||||
signal: token.isCancellationRequested ? AbortSignal.abort() : undefined,
|
||||
signal: abort.signal,
|
||||
});
|
||||
out.appendLine(` /chat/completions status: ${res.status}`);
|
||||
if (!res.ok || !res.body) {
|
||||
@@ -157,6 +170,11 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
};
|
||||
|
||||
while (true) {
|
||||
if (token.isCancellationRequested) {
|
||||
out.appendLine(" cancelled mid-stream; aborting request");
|
||||
abort.abort(); // close the connection so the gateway stops generating
|
||||
return;
|
||||
}
|
||||
const { done, value } = await reader.read();
|
||||
if (done) {
|
||||
break;
|
||||
@@ -221,6 +239,21 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
flushTools();
|
||||
}
|
||||
out.appendLine(` stream ended, ${textChunks} text chunks`);
|
||||
} catch (e) {
|
||||
// A cancellation aborts fetch (before headers) or the pending stream
|
||||
// read (mid-response) - both surface as AbortError. That is the user
|
||||
// pressing stop, not a failure: stop quietly instead of erroring.
|
||||
if (
|
||||
token.isCancellationRequested ||
|
||||
(e instanceof Error && e.name === "AbortError")
|
||||
) {
|
||||
out.appendLine(" stream aborted after cancellation");
|
||||
return;
|
||||
}
|
||||
throw e;
|
||||
} finally {
|
||||
cancelSubscription.dispose();
|
||||
}
|
||||
},
|
||||
|
||||
async provideTokenCount() {
|
||||
|
||||
Reference in new issue
Block a user