chore: bump to 0.1.2, replace setInterval with Promise sharing in OnnxNerScanner

This commit is contained in:
Axelle Abbadie 2026-05-13 11:50:23 +02:00
parent 48e9849389
commit a15491c178
7 changed files with 68 additions and 40 deletions

View file

@ -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

View file

@ -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).

31
main.js
View file

@ -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;
}
};

View file

@ -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",

View file

@ -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/",

View file

@ -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<NerResult[]>) | null = null;
let _loading = false;
let _loadingPromise: Promise<void> | 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<void> {
if (_pipeline) return;
if (_loadError) throw new Error(_loadError);
if (_loading) {
// Attendre la fin du chargement en cours
await new Promise<void>((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<void> {
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;
}
}

View file

@ -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"
}