From a15491c1783d872dd518fe68c1282b585dc09c4c Mon Sep 17 00:00:00 2001 From: Axelle Abbadie Date: Wed, 13 May 2026 11:50:23 +0200 Subject: [PATCH] chore: bump to 0.1.2, replace setInterval with Promise sharing in OnnxNerScanner --- CHANGELOG.md | 34 ++++++++++++++++++++++++++++++++++ README.md | 3 ++- main.js | 31 ++++++++++++------------------- manifest.json | 2 +- package.json | 2 +- src/scanner/OnnxNerScanner.ts | 33 ++++++++++++++++----------------- versions.json | 3 ++- 7 files changed, 68 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfd988d..d68c934 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,39 @@ # Changelog +## [prod] v0.1.2 — 13 mai 2026 + +**Branche :** `main` | **Tag :** `0.1.2` + +### Corrections +- `setInterval`/`clearInterval` remplacés par partage de Promise dans `OnnxNerScanner` — plus de polling, appels concurrents correctement gérés + +--- + +## [prod] v0.1.1 — 13 mai 2026 + +**Branche :** `main` | **Tag :** `0.1.1` + +### Nouvelles fonctionnalités +- **Onglet Dictionnaires** — liste les `.dict.json` du vault avec nombre d'entrées, import et suppression + +### Corrections portail communautaire Obsidian +- `onunload` : suppression de `detachLeavesOfType` +- `eslint-disable` et `any` : type `TransformersModule` explicite dans `OnnxNerScanner` +- `window.setInterval`/`clearInterval`, `window.setTimeout`, `activeDocument` +- `FileManager.trashFile()` à la place de `Vault.delete()` +- `activeLeaf` déprécié → `getActiveViewOfType(ItemView)` +- Imports inutilisés supprimés (`Setting`, `RuleLocation`, `fs`) +- Promises dans les event listeners wrappées avec `void (async () => {})()` +- CSS `text-decoration-color` → `border-bottom` (support partiel) +- Workflow `.github/workflows/release.yml` — attestations GitHub Actions +- Régénération `package-lock.json` (erreur CI `concat-map` 404) + +--- + +## [prod] v0.1.0 — 13 mai 2026 + +**Branche :** `main` | **Tag :** `0.1.0` + ## [dev] v0.1.0 — en cours **Branche :** `dev` | **Publié :** non diff --git a/README.md b/README.md index 3c65273..82491e8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -# PseudObsidian-ization +# Pseudonymizer Tool +alias `PseudObsidian-ization` pour les intimes. Plugin Obsidian de **pseudonymisation et de correction de transcriptions** pour chercheurs en sciences du langage. Il comble un manque : les outils existants (Sonal, Whispurge) ne s'intègrent pas dans un environnement de prise de notes et d'analyse, et peu de logiciels acceptent les conventions de transcription multimodales (Jefferson, ICOR). diff --git a/main.js b/main.js index 9398223..fee0771 100644 --- a/main.js +++ b/main.js @@ -33092,7 +33092,7 @@ var TAG_TO_CATEGORY = { }; var MIN_ENTITY_LENGTH = 2; var _pipeline = null; -var _loading = false; +var _loadingPromise = null; var _loadError = null; var _counter2 = 0; var OnnxNerScanner = class { @@ -33111,27 +33111,22 @@ var OnnxNerScanner = class { ); } // Charge le pipeline NER (une seule fois, avec notice de progression). + // Les appels concurrents reçoivent la même Promise — pas de polling. async loadPipeline() { if (_pipeline) return; if (_loadError) throw new Error(_loadError); - if (_loading) { - await new Promise((resolve, reject) => { - const timer = window.setInterval(() => { - if (_pipeline) { - window.clearInterval(timer); - resolve(); - } - if (_loadError) { - window.clearInterval(timer); - reject(new Error(_loadError)); - } - }, 300); - }); - return; + if (_loadingPromise) + return _loadingPromise; + _loadingPromise = this._doLoad(); + try { + await _loadingPromise; + } finally { + _loadingPromise = null; } - _loading = true; + } + async _doLoad() { const notice = new import_obsidian8.Notice("Chargement du mod\xE8le NER (premi\xE8re utilisation \u2014 ~66 Mo)\u2026", 0); try { const t = await Promise.resolve().then(() => (init_transformers(), transformers_exports)); @@ -33157,10 +33152,8 @@ var OnnxNerScanner = class { const err = e; console.error("[PseudObs NER] Erreur compl\xE8te :", err.stack ?? err.message); _loadError = err.message; - _loading = false; throw e; } - _loading = false; } // Retourne true si le pipeline est déjà chargé. isReady() { @@ -33215,7 +33208,7 @@ var OnnxNerScanner = class { // Réinitialise le pipeline (utile pour changer de modèle ou libérer la mémoire). static reset() { _pipeline = null; - _loading = false; + _loadingPromise = null; _loadError = null; } }; diff --git a/manifest.json b/manifest.json index 7f2aa66..32f480a 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "pseudonymizer-tool", "name": "Pseudonymizer Tool", - "version": "0.1.1", + "version": "0.1.2", "minAppVersion": "1.7.2", "description": "Pseudonymize and correct interactional transcripts (Jefferson, ICOR, SRT, CHAT/CHA). Designed for qualitative researchers in linguistics and conversation analysis.", "author": "Axelle Abbadie", diff --git a/package.json b/package.json index 70f5843..5b55c26 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pseudonymizer-tool", - "version": "0.1.1", + "version": "0.1.2", "description": "Plugin Obsidian de pseudonymisation de transcriptions", "author": "Axelle Abbadie", "homepage": "https://cv.hal.science/axelle-abbadie/", diff --git a/src/scanner/OnnxNerScanner.ts b/src/scanner/OnnxNerScanner.ts index 2757664..a2fb6d8 100644 --- a/src/scanner/OnnxNerScanner.ts +++ b/src/scanner/OnnxNerScanner.ts @@ -26,9 +26,11 @@ type NerResult = { end: number; }; -// Pipeline chargé une seule fois pour toute la session +// Pipeline chargé une seule fois pour toute la session. +// _loadingPromise permet aux appels concurrents d'attendre le même chargement +// sans polling (setInterval) — ils awaittent directement la même Promise. let _pipeline: ((text: string, opts?: object) => Promise) | null = null; -let _loading = false; +let _loadingPromise: Promise | null = null; let _loadError: string | null = null; let _counter = 0; @@ -52,21 +54,21 @@ export class OnnxNerScanner { } // Charge le pipeline NER (une seule fois, avec notice de progression). + // Les appels concurrents reçoivent la même Promise — pas de polling. async loadPipeline(): Promise { if (_pipeline) return; if (_loadError) throw new Error(_loadError); - if (_loading) { - // Attendre la fin du chargement en cours - await new Promise((resolve, reject) => { - const timer = window.setInterval(() => { - if (_pipeline) { window.clearInterval(timer); resolve(); } - if (_loadError) { window.clearInterval(timer); reject(new Error(_loadError)); } - }, 300); - }); - return; - } + if (_loadingPromise) return _loadingPromise; - _loading = true; + _loadingPromise = this._doLoad(); + try { + await _loadingPromise; + } finally { + _loadingPromise = null; + } + } + + private async _doLoad(): Promise { const notice = new Notice('Chargement du modèle NER (première utilisation — ~66 Mo)…', 0); try { @@ -118,11 +120,8 @@ export class OnnxNerScanner { // Stack trace complète dans la console pour diagnostiquer console.error('[PseudObs NER] Erreur complète :', err.stack ?? err.message); _loadError = err.message; - _loading = false; throw e; } - - _loading = false; } // Retourne true si le pipeline est déjà chargé. @@ -187,7 +186,7 @@ export class OnnxNerScanner { // Réinitialise le pipeline (utile pour changer de modèle ou libérer la mémoire). static reset(): void { _pipeline = null; - _loading = false; + _loadingPromise = null; _loadError = null; } } diff --git a/versions.json b/versions.json index c79ff51..e96bd20 100644 --- a/versions.json +++ b/versions.json @@ -6,5 +6,6 @@ "0.0.5": "1.4.0", "0.0.6": "1.6.6", "0.1.0": "1.7.2", - "0.1.1": "1.7.2" + "0.1.1": "1.7.2", + "0.1.2": "1.7.2" } \ No newline at end of file