opencode-avatar 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +5 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -24,6 +24,7 @@ var isThinking = false;
|
|
|
24
24
|
var isToolActive = false;
|
|
25
25
|
var isShuttingDown = false;
|
|
26
26
|
var idleTriggered = false;
|
|
27
|
+
var currentRequestId = null;
|
|
27
28
|
var heartbeatInterval = null;
|
|
28
29
|
function sendHeartbeat() {
|
|
29
30
|
const req = http.request({
|
|
@@ -219,6 +220,8 @@ var AvatarPlugin = async ({ client }) => {
|
|
|
219
220
|
});
|
|
220
221
|
};
|
|
221
222
|
async function requestAvatarGeneration(prompt, showToasts = true, toolName) {
|
|
223
|
+
const requestId = `${Date.now()}-${Math.random()}`;
|
|
224
|
+
currentRequestId = requestId;
|
|
222
225
|
if (showToasts) {
|
|
223
226
|
showInfoToast(`Generating avatar: ${prompt}`);
|
|
224
227
|
}
|
|
@@ -241,7 +244,7 @@ var AvatarPlugin = async ({ client }) => {
|
|
|
241
244
|
if (showToasts) {
|
|
242
245
|
showInfoToast(`Avatar ready: ${prompt}`);
|
|
243
246
|
}
|
|
244
|
-
if (
|
|
247
|
+
if (currentRequestId === requestId) {
|
|
245
248
|
setAvatarViaHttp(prompt, toolName);
|
|
246
249
|
}
|
|
247
250
|
resolve();
|
|
@@ -299,6 +302,7 @@ var AvatarPlugin = async ({ client }) => {
|
|
|
299
302
|
idleTriggered = true;
|
|
300
303
|
isThinking = false;
|
|
301
304
|
isToolActive = false;
|
|
305
|
+
currentRequestId = null;
|
|
302
306
|
await setAvatarViaHttp();
|
|
303
307
|
}
|
|
304
308
|
}
|