Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6301810f16 |
+13
-1
@@ -6,7 +6,7 @@ Format basé sur [Keep a Changelog](https://keepachangelog.com/fr/1.1.0/),
|
||||
et [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
> **En cours de développement** : les changements à venir sont listés dans la section
|
||||
> [Unreleased](#unreleased). La dernière version livrée est **2.91.0**.
|
||||
> [Unreleased](#unreleased). La dernière version livrée est **2.92.0**.
|
||||
|
||||
---
|
||||
|
||||
@@ -14,6 +14,18 @@ et [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
---
|
||||
|
||||
## [2.92.0] — 2026-11-28
|
||||
|
||||
### Ajouté
|
||||
|
||||
- **Bascule des entrées IA vers Spark (#234, carte D3 #83, épopée fusion #195)** : toutes les entrées « assistant » passent par un aiguilleur commun — BooksLM, bouton mobile et appelants du viewer, toolbar IA de l'éditeur classique (réduite à un bouton « ✦ Spark » en mode Spark, les actions d'édition vivant dans Spark avec approbation) et bouton IA de Forge. **Réglage de bascule** par utilisateur dans l'écran « Clés API IA » : « Spark » (défaut) ou « Assistant intégré » (ancien) — retour arrière en un réglage. **Compteurs d'usage** des anciennes surfaces (`POST`/`GET /api/transition/usage`, admin pour la lecture) pour nourrir les décisions de retrait D5/D6. **Redéploiement Docker requis.**
|
||||
|
||||
### Modifié
|
||||
|
||||
- **Boutons flottants (décision de Bruno, 2026-11-28)** : la pastille robot de l'assistant (desktop) est retirée — le bouton commun des applications (avatar Spark) suffit — et le bouton central de la barre mobile devient ce même avatar Spark, au lieu de l'icône robot.
|
||||
|
||||
---
|
||||
|
||||
## [2.91.0] — 2026-11-28
|
||||
|
||||
### Modifié
|
||||
|
||||
+3
-3
@@ -4,7 +4,7 @@
|
||||
|
||||
**Porte d'entrée web ultra-léger pour vos vaults Obsidian** — Accédez, naviguez et recherchez dans toutes vos notes Obsidian depuis n'importe quel appareil via une interface web moderne et responsive.
|
||||
|
||||
[]()
|
||||
[]()
|
||||
[](https://opensource.org/licenses/MIT)
|
||||
[](https://www.docker.com/)
|
||||
[](https://www.python.org/)
|
||||
@@ -981,8 +981,8 @@ Ce projet est sous licence **MIT** — voir le fichier [LICENSE](LICENSE) pour l
|
||||
|
||||
## 📝 Changelog
|
||||
|
||||
Consultez le [CHANGELOG.md](./CHANGELOG.md) pour l'historique complet de toutes les versions (v1.0.0 → v2.91.0).
|
||||
Consultez le [CHANGELOG.md](./CHANGELOG.md) pour l'historique complet de toutes les versions (v1.0.0 → v2.92.0).
|
||||
|
||||
---
|
||||
|
||||
*Projet : ObsiGate | Version : 2.91.0 | Dernière mise à jour : Septembre 2026*
|
||||
*Projet : ObsiGate | Version : 2.92.0 | Dernière mise à jour : Septembre 2026*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
**Ultra-light web gateway for your Obsidian vaults** — Access, browse, and search all your Obsidian notes from any device via a modern, responsive web interface.
|
||||
|
||||
[]()
|
||||
[]()
|
||||
[](https://opensource.org/licenses/MIT)
|
||||
[](https://www.docker.com/)
|
||||
[](https://www.python.org/)
|
||||
@@ -1156,8 +1156,8 @@ This project is licensed under the **MIT License** - see the [LICENSE](LICENSE)
|
||||
|
||||
## 📝 Changelog
|
||||
|
||||
See [CHANGELOG.md](./CHANGELOG.md) for the complete version history (v1.0.0 → v2.91.0).
|
||||
See [CHANGELOG.md](./CHANGELOG.md) for the complete version history (v1.0.0 → v2.92.0).
|
||||
|
||||
---
|
||||
|
||||
*Project: ObsiGate | Version: 2.91.0 | Last updated: September 2026*
|
||||
*Project: ObsiGate | Version: 2.92.0 | Last updated: September 2026*
|
||||
|
||||
@@ -575,6 +575,7 @@ from backend.routers.scheduler import router as scheduler_router
|
||||
from backend.routers.search import router as search_router
|
||||
from backend.routers.sharing import router as sharing_router
|
||||
from backend.routers.sso import router as sso_router
|
||||
from backend.routers.transition import router as transition_router
|
||||
from backend.routers.vaults import router as vaults_router
|
||||
from backend.routers.webhooks import router as webhooks_router
|
||||
from backend.skills_routes import router as skills_router
|
||||
@@ -588,6 +589,7 @@ app.include_router(history_router) # ROADMAP #85 T8 — History
|
||||
app.include_router(external_refs_router) # Fusion #215 — Références croisées (ACC-1.3)
|
||||
app.include_router(sso_router) # Fusion #216 — Émettrice SSO draco_session (ACC-3.1)
|
||||
app.include_router(liaison_router) # #75 — Liaison d'appareil (jeton draco)
|
||||
app.include_router(transition_router) # #234 — Transition Spark : compteurs d'usage des anciennes surfaces IA
|
||||
app.include_router(desktop_sso_router) # #230 — Desktop : compte central (404 hors desktop)
|
||||
app.include_router(realtime_router) # ROADMAP #85 T9 — SSE + collab WS
|
||||
app.include_router(search_router) # ROADMAP #85 T5 — Search
|
||||
|
||||
@@ -48,6 +48,7 @@ TAGS_METADATA: list[dict[str, str]] = [
|
||||
{"name": "Duplicates", "description": "Duplicate-note detection and confirmed merge (#166)."},
|
||||
{"name": "Notify", "description": "External notifications: Discord, Telegram, SMTP and generic webhooks (#168)."},
|
||||
{"name": "Scheduler", "description": "Scheduled automatic tasks reusing the vault mutation services (#170)."},
|
||||
{"name": "Transition", "description": "ObsiGate → Spark transition (wave D): usage counters of the legacy AI surfaces, feeding the D5/D6 removal decisions (#234)."},
|
||||
{"name": "Frontend", "description": "Static assets and SPA fallback routes."},
|
||||
]
|
||||
|
||||
@@ -162,6 +163,7 @@ _TAG_ALIASES: dict[str, str] = {
|
||||
"webhooks": "Webhooks",
|
||||
"duplicates": "Duplicates",
|
||||
"notify": "Notify",
|
||||
"transition": "Transition",
|
||||
"scheduler": "Scheduler",
|
||||
"conflicts": "Conflicts",
|
||||
"system": "System",
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
"""Transition ObsiGate → Spark (vague D) — compteurs d'usage.
|
||||
|
||||
Les entrées « assistant » d'ObsiGate ouvrent le panneau Spark par
|
||||
défaut (carte D3, #83) ; l'assistant intégré ne sert plus que de
|
||||
repli explicite ou de mode choisi par le réglage de bascule. Chaque
|
||||
recours à l'ancienne surface est compté ici (fichier
|
||||
``data/transition_usage.json``) pour nourrir les décisions de
|
||||
retrait D5/D6 (carte D7, #87) : aucune surface encore utilisée sans
|
||||
équivalent validé ne doit disparaître en silence.
|
||||
|
||||
POST /api/transition/usage — authentifié, corps ``{"surface": …}``
|
||||
(surfaces connues uniquement). GET /api/transition/usage — admin,
|
||||
retourne les compteurs ``{surface: {"count": n, "last": iso}}``.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import threading
|
||||
from datetime import UTC, datetime
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from fastapi import APIRouter, Body, Depends
|
||||
|
||||
from backend.auth.middleware import require_admin, require_auth
|
||||
|
||||
router = APIRouter(prefix="/api/transition", tags=["transition"])
|
||||
|
||||
_BASE_DIR = Path(__file__).resolve().parent.parent.parent
|
||||
_USAGE_PATH = _BASE_DIR / "data" / "transition_usage.json"
|
||||
_lock = threading.RLock()
|
||||
|
||||
# Surfaces connues : natif-explicite = le réglage de bascule est sur
|
||||
# l'assistant intégré ; natif-repli = le panneau Spark n'a pas pu
|
||||
# s'ouvrir et l'entrée a rabattu sur l'intégré.
|
||||
SURFACES = ("natif-explicite", "natif-repli")
|
||||
|
||||
|
||||
def _lire() -> dict[str, Any]:
|
||||
try:
|
||||
return json.loads(_USAGE_PATH.read_text(encoding="utf-8"))
|
||||
except Exception:
|
||||
return {}
|
||||
|
||||
|
||||
def _ecrire(data: dict[str, Any]) -> None:
|
||||
_USAGE_PATH.parent.mkdir(parents=True, exist_ok=True)
|
||||
_USAGE_PATH.write_text(
|
||||
json.dumps(data, ensure_ascii=False, indent=1), encoding="utf-8")
|
||||
|
||||
|
||||
@router.post("/usage")
|
||||
async def api_transition_usage_post(
|
||||
body: dict = Body(...),
|
||||
current_user=Depends(require_auth)) -> dict[str, Any]:
|
||||
surface = str((body or {}).get("surface") or "")
|
||||
if surface not in SURFACES:
|
||||
return {"ok": False, "erreur": "surface inconnue"}
|
||||
with _lock:
|
||||
data = _lire()
|
||||
entree = data.get(surface) or {"count": 0, "last": None}
|
||||
entree["count"] = int(entree.get("count") or 0) + 1
|
||||
entree["last"] = datetime.now(UTC).isoformat()
|
||||
data[surface] = entree
|
||||
_ecrire(data)
|
||||
return {"ok": True, "surface": surface, "count": entree["count"]}
|
||||
|
||||
|
||||
@router.get("/usage")
|
||||
async def api_transition_usage_get(
|
||||
current_user=Depends(require_admin)) -> dict[str, Any]:
|
||||
with _lock:
|
||||
return {"surfaces": _lire()}
|
||||
Generated
+1
-1
@@ -2626,7 +2626,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "obsigate-desktop"
|
||||
version = "2.91.0"
|
||||
version = "2.92.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"env_logger",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "obsigate-desktop"
|
||||
version = "2.91.0"
|
||||
version = "2.92.0"
|
||||
description = "ObsiGate Desktop — Porte d'entrée native pour vos vaults Obsidian"
|
||||
authors = ["Bruno Charest"]
|
||||
edition = "2021"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/nicedoc/obsigate/main/desktop/tauri.conf.schema.json",
|
||||
"productName": "ObsiGate",
|
||||
"version": "2.91.0",
|
||||
"version": "2.92.0",
|
||||
"identifier": "com.obsigate.desktop",
|
||||
"build": {
|
||||
"frontendDist": "../frontend",
|
||||
|
||||
+12
-1
@@ -1,6 +1,6 @@
|
||||
# ObsiGate — Roadmap
|
||||
|
||||
> **Version :** 2.91.0 | **Dernière mise à jour :** 2026-11-28
|
||||
> **Version :** 2.92.0 | **Dernière mise à jour :** 2026-11-28
|
||||
> **Ce fichier ne contient que le travail à venir** (🔵 En cours + ⚪ Backlog) et un index compact
|
||||
> vers les fonctionnalités livrées.
|
||||
> - **Méthode de livraison à appliquer pour toute tâche : [DELIVERY_WORKFLOW.md](./DELIVERY_WORKFLOW.md)**
|
||||
@@ -30,6 +30,17 @@
|
||||
|
||||
## 🔵 En cours
|
||||
|
||||
### 234. Fusion — bascule des entrées IA vers Spark (transition D3)
|
||||
|
||||
- **Effort :** ~0,5 jour | **Impact :** 🟡 | **Ouvert :** 2026-11-28 | **Statut :** 🔵 en cours — PR sur `feat/transition-d3-bascule` (carte Gitea #83 ; fusion et redéploiement Docker = geste de Bruno)
|
||||
- **Fiche :** [features/fusion-bascule-d3-234.md](./features/fusion-bascule-d3-234.md)
|
||||
- **Description :** vague D3 de la transition ObsiGate → Spark (épopée fusion #195). Toutes les entrées « assistant » passent par l'aiguilleur `ouvrirAssistantIA` de `spark-panneau.js` : BooksLM, bouton mobile et appelants du viewer, toolbar IA de l'éditeur (réduite à un bouton Spark en mode spark) et bouton IA de Forge. **Réglage de bascule** par utilisateur (`spark` par défaut / `natif`, écran #cfg-ai) — retour arrière en un réglage. **Compteurs d'usage** des anciennes surfaces (`/api/transition/usage`) pour les retraits D5/D6. Décision de Bruno (2026-11-28) : pastille robot desktop retirée, bouton mobile = avatar Spark commun. Le chat par fichier (discussion humaine) et le serveur MCP ne sont pas touchés.
|
||||
- **Sous-tâches :**
|
||||
- [x] Aiguilleur + réglage de bascule + compteurs backend (`backend/routers/transition.py`)
|
||||
- [x] Toolbar IA éditeur et bouton IA de Forge aiguillés ; BooksLM et ai-fab sur l'aiguilleur
|
||||
- [x] Pastille robot retirée (desktop), bouton mobile en avatar Spark ; i18n FR/EN ; test `test_bascule_d3_234`
|
||||
- [ ] Fusion de la PR, CI verte, redéploiement Docker (geste de Bruno), preuve des entrées en mode spark et natif
|
||||
|
||||
### 233. Fusion — BooksLM ouvre Spark + panneau affiné (retours D1/D2)
|
||||
|
||||
- **Effort :** ~0,5 jour | **Impact :** 🟡 | **Ouvert :** 2026-11-28 | **Statut :** 🔵 en cours — PR sur `feat/bookslm-spark-panneau-v2` (premier pas de la carte D3 #83 ; fusion et redéploiement Docker = geste de Bruno)
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
# #234 — Fusion : bascule des entrées IA vers Spark (transition D3)
|
||||
|
||||
**Carte Gitea :** ObsiGate #83 (vague D3 de l'épopée fusion-trois-apps #195).
|
||||
**Prérequis :** D1/D2 (#232), premier pas BooksLM (#233), vagues A/B/C de Spark
|
||||
(agent-commun, dont C1 les actions d'édition), correctif « contexte opérant »
|
||||
(agent-commun 0.106.0).
|
||||
|
||||
## Ce que fait la bascule
|
||||
|
||||
Toutes les entrées « assistant » d'ObsiGate passent par un aiguilleur unique,
|
||||
`ouvrirAssistantIA(ctx, ouvrirNatif)` dans `frontend/js/spark-panneau.js` :
|
||||
|
||||
- **BooksLM** (menu contextuel vault et dossiers, `ui.js`) — contexte répertoire forcé.
|
||||
- **Bouton mobile et appelants du viewer** (`ai-fab.js` : barre mobile, inspecteur
|
||||
xlsx, commande « gemini ») — contexte courant.
|
||||
- **Toolbar IA de l'éditeur classique** (`ai.js`) — en mode Spark, elle se réduit à
|
||||
un bouton « ✦ Spark » et un rappel : les actions d'édition vivent dans Spark
|
||||
(contexte + sélection transmis par D2, approbation avant écriture, vague C1).
|
||||
En mode natif, la toolbar historique est inchangée.
|
||||
- **Bouton IA de Forge** (`sync.js`, message `forge-open-ai`) — même aiguillage.
|
||||
|
||||
## Réglage de bascule (retour arrière en un réglage)
|
||||
|
||||
Par utilisateur, dans le navigateur (`localStorage`, clé
|
||||
`obsigate_assistant_mode`) : `spark` (défaut) ou `natif`. Réglable dans
|
||||
l'écran **#cfg-ai** (« Entrées assistant »). En mode `natif`, les entrées
|
||||
rouvrent l'assistant intégré ; si le panneau Spark n'est pas chargé, le repli
|
||||
sur l'intégré reste explicite, comme depuis #233.
|
||||
|
||||
## Boutons flottants (décision de Bruno, 2026-11-28)
|
||||
|
||||
Le bouton commun des applications — l'avatar Spark `.draco-spark-flottant` —
|
||||
suffit. La pastille robot `.ai-fab` (desktop) est **retirée** (`initAIFab` ne
|
||||
crée plus de bouton) et le bouton central de la barre mobile (`#mt-ai`) devient
|
||||
ce même avatar (image ronde bordée, comme le bouton commun), au lieu de
|
||||
l'icône robot sur fond d'accent.
|
||||
|
||||
## Compteurs d'usage des anciennes surfaces
|
||||
|
||||
Chaque recours à l'assistant intégré est compté : `POST /api/transition/usage`
|
||||
(authentifié, corps `{"surface": "natif-explicite" | "natif-repli"}`),
|
||||
compteurs persistés dans `data/transition_usage.json` ; lecture admin par
|
||||
`GET /api/transition/usage` (`backend/routers/transition.py`). Ces métriques
|
||||
nourrissent les décisions de retrait D5/D6 (carte D7, #87).
|
||||
|
||||
## Hors périmètre
|
||||
|
||||
- Le **chat par fichier** (`filechat.js`) est une discussion entre humains sur
|
||||
un fichier — fonction de portail, **non redirigée**.
|
||||
- Le **serveur MCP** n'est pas touché (décision C2 : conservé tel quel).
|
||||
- Aucun code de l'assistant intégré n'est supprimé ici : retraits = D5 (#85)
|
||||
et D6 (#86), après migration des données (D4, #84).
|
||||
|
||||
## Vérification
|
||||
|
||||
- `tests/test_draco_barre.py::test_bascule_d3_234` (+ contrat #233 mis à jour
|
||||
vers l'aiguilleur) ; ruff, mypy, validate-imports, unit.test.mjs verts en local.
|
||||
- E2E Playwright : laissé au CI (stack complète requise).
|
||||
- **Redéploiement Docker requis** après fusion.
|
||||
+27
-3
@@ -2548,6 +2548,30 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ai-default-card">
|
||||
<div class="ai-card-title" data-i18n="config.assistant_mode_section">Assistant</div>
|
||||
<div class="ai-field">
|
||||
<label
|
||||
class="ai-field-label"
|
||||
for="cfg-assistant-mode"
|
||||
data-i18n="config.assistant_mode"
|
||||
>Entrées « assistant » (BooksLM, toolbar IA, bouton mobile)</label
|
||||
>
|
||||
<select
|
||||
id="cfg-assistant-mode"
|
||||
class="config-select"
|
||||
>
|
||||
<option value="spark" data-i18n="config.assistant_mode_spark">Spark (panneau commun)</option>
|
||||
<option value="natif" data-i18n="config.assistant_mode_natif">Assistant intégré (ancien)</option>
|
||||
</select>
|
||||
</div>
|
||||
<p class="config-description" data-i18n="config.assistant_mode_desc">
|
||||
Transition ObsiGate → Spark : « Spark » ouvre le panneau de l'agent commun
|
||||
(contexte du document ou du répertoire transmis) ; « Assistant intégré »
|
||||
rouvre les anciennes surfaces, comptées tant qu'elles existent.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="ai-providers-header">
|
||||
<h3
|
||||
class="ai-card-title"
|
||||
@@ -5945,10 +5969,10 @@ curl -X POST https://votre-serveur.com/webhook \
|
||||
<button
|
||||
class="mt-btn mt-btn-ai"
|
||||
id="mt-ai"
|
||||
title="Assistant AI"
|
||||
aria-label="Ouvrir l'assistant AI"
|
||||
title="Spark"
|
||||
aria-label="Ouvrir Spark, l'agent commun"
|
||||
>
|
||||
<i data-lucide="bot" style="width: 24px; height: 24px"></i>
|
||||
<img src="/static/img/avatar-spark.png" alt="" width="56" height="56" />
|
||||
</button>
|
||||
<button
|
||||
class="mt-btn mt-btn-primary"
|
||||
|
||||
+22
-50
@@ -1,34 +1,24 @@
|
||||
// ObsiGate — Floating Action Button (FAB) for the AI Assistant sidebar.
|
||||
// Always visible in the bottom-right corner; hides while the assistant panel
|
||||
// is expanded. Clicking it opens the assistant in the context that matches
|
||||
// the current application state (open documents, or General when none).
|
||||
// ObsiGate — Point d'entrée « assistant » partagé (transition Spark).
|
||||
//
|
||||
// Historiquement le FAB flottant (pastille robot, bas-droite) de
|
||||
// l'assistant intégré. Décision de Bruno (2026-11-28, vague D3) : le
|
||||
// bouton commun des applications (l'avatar Spark, .draco-spark-
|
||||
// flottant) suffit sur desktop — la pastille robot est retirée — et
|
||||
// le mobile utilise ce même bouton avatar (bouton central de la
|
||||
// barre mobile, #mt-ai). initAIFab ne crée donc plus aucun bouton ;
|
||||
// ce module ne porte plus que l'aiguillage d'ouverture, partagé par
|
||||
// la barre mobile et les appelants de viewer.js.
|
||||
import booksLM from './bookslm.js';
|
||||
import { ouvrirSpark } from './spark-panneau.js';
|
||||
import { ouvrirAssistantIA } from './spark-panneau.js';
|
||||
import { t } from './i18n.js';
|
||||
import { safeCreateIcons } from './utils.js';
|
||||
|
||||
let _fab = null;
|
||||
|
||||
// The panel is visible when it has `.open` without `.hidden`.
|
||||
function isBooksLmVisible() {
|
||||
const panel = document.querySelector('.bookslm-panel');
|
||||
return !!(panel && panel.classList.contains('open') && !panel.classList.contains('hidden'));
|
||||
}
|
||||
|
||||
function syncVisibility() {
|
||||
if (!_fab) return;
|
||||
const visible = isBooksLmVisible();
|
||||
_fab.hidden = visible;
|
||||
const label = visible ? t('fab.close') : t('fab.open');
|
||||
_fab.title = label;
|
||||
_fab.setAttribute('aria-label', label);
|
||||
}
|
||||
|
||||
// Shared entry point used by the floating FAB and the mobile toolbar button.
|
||||
// Transition ObsiGate → Spark : l'assistant s'ouvre dans le panneau
|
||||
// Spark, avec le contexte courant (document ouvert ou général) déclaré
|
||||
// par viewer.js. Repli explicite sur l'assistant intégré si le panneau
|
||||
// Spark n'est pas chargé ; un panneau intégré replié se ré-affiche.
|
||||
// Shared entry point used by the mobile toolbar button and viewer
|
||||
// callers. Transition ObsiGate → Spark (D3, #83) : l'aiguilleur de
|
||||
// spark-panneau.js ouvre le panneau Spark avec le contexte courant
|
||||
// (document ouvert ou général) déclaré par viewer.js, selon le
|
||||
// réglage de bascule ; l'assistant intégré reste le repli explicite
|
||||
// (ou le mode choisi), et un panneau intégré replié se ré-affiche.
|
||||
export async function openAssistant() {
|
||||
const panel = document.querySelector('.bookslm-panel');
|
||||
// Collapsed panel: reveal it instead of reopening.
|
||||
@@ -36,32 +26,14 @@ export async function openAssistant() {
|
||||
booksLM._toggleSidebar();
|
||||
return;
|
||||
}
|
||||
if (ouvrirSpark(null)) return;
|
||||
// Otherwise open (or re-focus) the assistant for the current context.
|
||||
await booksLM.openForCurrentContext();
|
||||
}
|
||||
|
||||
async function onClick() {
|
||||
await openAssistant();
|
||||
await ouvrirAssistantIA(null, () => booksLM.openForCurrentContext());
|
||||
}
|
||||
|
||||
export function initAIFab() {
|
||||
if (_fab) return;
|
||||
|
||||
const btn = document.createElement('button');
|
||||
btn.type = 'button';
|
||||
btn.id = 'ai-fab';
|
||||
btn.className = 'ai-fab';
|
||||
btn.innerHTML = '<i data-lucide="bot" style="width:24px;height:24px"></i>';
|
||||
document.body.appendChild(btn);
|
||||
_fab = btn;
|
||||
|
||||
btn.addEventListener('click', onClick);
|
||||
document.addEventListener('bookslm:opened', syncVisibility);
|
||||
document.addEventListener('bookslm:closed', syncVisibility);
|
||||
|
||||
if (typeof safeCreateIcons === 'function') safeCreateIcons();
|
||||
syncVisibility();
|
||||
// Bouton flottant retiré (voir l'en-tête) : l'avatar Spark commun
|
||||
// (.draco-spark-flottant) est le seul bouton flottant, sur desktop
|
||||
// comme sur mobile. Fonction conservée pour l'appelant (app.js).
|
||||
void t; void safeCreateIcons;
|
||||
}
|
||||
|
||||
export default initAIFab;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
import { api } from './auth.js';
|
||||
import { t } from './i18n.js';
|
||||
import { modeAssistant, ouvrirSpark, signalerUsageSurface } from './spark-panneau.js';
|
||||
|
||||
// ── API call helper ──
|
||||
async function aiAction(endpoint, text, extra = {}) {
|
||||
@@ -769,6 +770,45 @@ function _promptRewriteInstruction() {
|
||||
}
|
||||
|
||||
export async function createAIToolbar(container, getEditorView) {
|
||||
// Transition Spark (D3, #83) : en mode « spark » (réglage de
|
||||
// bascule par défaut), la toolbar IA de l'éditeur se réduit à
|
||||
// l'ouverture du panneau Spark — le document et la sélection de
|
||||
// l'éditeur y sont transmis en contexte (D2), et les actions
|
||||
// d'édition y vivent (vague C1, approbation avant écriture). En
|
||||
// mode « natif », la toolbar historique ci-dessous reste en place.
|
||||
if (modeAssistant() === 'spark') {
|
||||
const bar = document.createElement('div');
|
||||
bar.className = 'ai-toolbar ai-toolbar-spark';
|
||||
Object.assign(bar.style, {
|
||||
display: 'flex', alignItems: 'center', gap: '8px',
|
||||
padding: '4px 8px', borderBottom: '1px solid var(--border)',
|
||||
background: 'var(--bg-secondary)', position: 'sticky',
|
||||
top: '0', zIndex: '5',
|
||||
});
|
||||
const btn = document.createElement('button');
|
||||
btn.className = 'ai-toolbar-btn';
|
||||
btn.innerHTML = '✦ Spark';
|
||||
Object.assign(btn.style, {
|
||||
color: '#60a5fa', fontWeight: '600', fontSize: '0.75rem',
|
||||
background: 'none', border: 'none', cursor: 'pointer',
|
||||
padding: '3px 8px', borderRadius: '4px',
|
||||
});
|
||||
btn.title = t('ai.spark_toolbar_title');
|
||||
btn.setAttribute('aria-label', t('ai.spark_toolbar_title'));
|
||||
btn.addEventListener('click', () => {
|
||||
if (!ouvrirSpark(null)) {
|
||||
signalerUsageSurface('natif-repli');
|
||||
showToast(t('viewer.spark_unavailable'), 'error');
|
||||
}
|
||||
});
|
||||
const hint = document.createElement('span');
|
||||
hint.style.cssText = 'font-size:0.7rem;color:var(--text-muted)';
|
||||
hint.textContent = t('ai.spark_toolbar_hint');
|
||||
bar.appendChild(btn);
|
||||
bar.appendChild(hint);
|
||||
container.appendChild(bar);
|
||||
return;
|
||||
}
|
||||
// Check if AI is configured
|
||||
let aiConfigured = false;
|
||||
try {
|
||||
|
||||
@@ -7,6 +7,7 @@ import { escapeHtml, safeCreateIcons } from './utils.js';
|
||||
import { showToast, closeHeaderMenu, closeMobileSidebar } from './ui.js';
|
||||
import { t, setLocale, getLocale } from './i18n.js';
|
||||
import { getModelCapabilities, renderCapabilityBadges, refreshAIPickers } from './ai.js';
|
||||
import { modeAssistant, definirModeAssistant } from './spark-panneau.js';
|
||||
import { isTauriEnv, invoke, pickAndAddVault, pickAndAddDir, removeRoot, getDesktopSettings, setDesktopEnvironment } from './desktop.js';
|
||||
import { openSidebarChat, filterChatMessages as _filterChat } from './filechat.js';
|
||||
|
||||
@@ -966,6 +967,15 @@ function initConfigModal() {
|
||||
_renderConfigModelCaps(providerSel ? providerSel.value : null, aiDefaultModelSel.value);
|
||||
});
|
||||
}
|
||||
// Réglage de bascule assistant (transition Spark, D3 #83) : par
|
||||
// utilisateur, dans ce navigateur — « spark » (défaut) ou « natif ».
|
||||
const assistantModeSel = document.getElementById("cfg-assistant-mode");
|
||||
if (assistantModeSel) {
|
||||
assistantModeSel.value = modeAssistant();
|
||||
assistantModeSel.addEventListener("change", () => {
|
||||
definirModeAssistant(assistantModeSel.value);
|
||||
});
|
||||
}
|
||||
// Load existing keys/defaults on modal open
|
||||
document.getElementById("config-open-btn").addEventListener("click", loadAIKeys);
|
||||
document.getElementById("config-open-btn").addEventListener("click", loadAIDefaults);
|
||||
|
||||
@@ -2,16 +2,29 @@
|
||||
//
|
||||
// Point d'entrée unique des accès « assistant » qui doivent ouvrir
|
||||
// Spark plutôt que l'assistant intégré : les entrées BooksLM du menu
|
||||
// contextuel (vault et dossiers) et le bouton flottant / mobile
|
||||
// (ai-fab.js). Le contexte forcé éventuel est posé dans l'état, lu par
|
||||
// la déclaration DRACO_PANNEAU_CONTEXTE de viewer.js à chaque envoi —
|
||||
// ouvrir un document l'efface (le contexte redevient le document).
|
||||
// contextuel (vault et dossiers), le bouton mobile et les appelants
|
||||
// d'ai-fab.js, la toolbar IA de l'éditeur et le bouton IA de Forge
|
||||
// (cartes D1 #81 et D3 #83). Le contexte forcé éventuel est posé dans
|
||||
// l'état, lu par la déclaration DRACO_PANNEAU_CONTEXTE de viewer.js à
|
||||
// chaque envoi — ouvrir un document l'efface (le contexte redevient
|
||||
// le document).
|
||||
//
|
||||
// Repli explicite : retourne false si le panneau Spark n'est pas
|
||||
// chargé ; l'appelant retombe alors sur l'assistant intégré, jamais
|
||||
// de silence.
|
||||
// Réglage de bascule (D3) : par utilisateur, dans ce navigateur
|
||||
// (localStorage « obsigate_assistant_mode ») — « spark » (défaut) :
|
||||
// les entrées ouvrent Spark ; « natif » : elles rouvrent l'assistant
|
||||
// intégré (retour arrière en un réglage, écran #cfg-ai). Chaque
|
||||
// recours à l'intégré est compté côté backend (POST
|
||||
// /api/transition/usage) pour nourrir les décisions de retrait
|
||||
// D5/D6 : « natif-explicite » (réglage choisi) ou « natif-repli »
|
||||
// (panneau Spark non chargé).
|
||||
//
|
||||
// Repli explicite : ouvrirSpark retourne false si le panneau Spark
|
||||
// n'est pas chargé ; l'aiguilleur retombe alors sur l'assistant
|
||||
// intégré, jamais de silence.
|
||||
import { state } from './state.js';
|
||||
|
||||
const CLE_MODE = 'obsigate_assistant_mode';
|
||||
|
||||
export function ouvrirSpark(ctx) {
|
||||
state.sparkContexteForce = ctx || null;
|
||||
if (window.DRACO_PANNEAU && typeof window.DRACO_PANNEAU.open === 'function') {
|
||||
@@ -20,3 +33,47 @@ export function ouvrirSpark(ctx) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function modeAssistant() {
|
||||
try {
|
||||
return localStorage.getItem(CLE_MODE) === 'natif' ? 'natif' : 'spark';
|
||||
} catch {
|
||||
return 'spark';
|
||||
}
|
||||
}
|
||||
|
||||
export function definirModeAssistant(mode) {
|
||||
try {
|
||||
localStorage.setItem(CLE_MODE, mode === 'natif' ? 'natif' : 'spark');
|
||||
} catch { /* stockage indisponible : le défaut (spark) s'applique */ }
|
||||
}
|
||||
|
||||
export function signalerUsageSurface(surface) {
|
||||
try {
|
||||
const headers = { 'Content-Type': 'application/json' };
|
||||
if (window.AuthManager && typeof window.AuthManager.getAuthHeaders === 'function') {
|
||||
Object.assign(headers, window.AuthManager.getAuthHeaders() || {});
|
||||
}
|
||||
fetch('/api/transition/usage', {
|
||||
method: 'POST',
|
||||
headers,
|
||||
credentials: 'include',
|
||||
body: JSON.stringify({ surface }),
|
||||
}).catch(() => {});
|
||||
} catch { /* compteur best-effort : ne bloque jamais l'ouverture */ }
|
||||
}
|
||||
|
||||
// Aiguilleur commun des entrées « assistant » : selon le réglage de
|
||||
// bascule, ouvre Spark (contexte forcé éventuel) ou l'assistant
|
||||
// intégré via le rappel fourni par l'appelant. Retourne la surface
|
||||
// effectivement ouverte : 'spark', 'natif' ou 'aucune'.
|
||||
export async function ouvrirAssistantIA(ctx, ouvrirNatif) {
|
||||
if (modeAssistant() === 'natif') {
|
||||
signalerUsageSurface('natif-explicite');
|
||||
if (ouvrirNatif) { await ouvrirNatif(); return 'natif'; }
|
||||
}
|
||||
if (ouvrirSpark(ctx)) return 'spark';
|
||||
signalerUsageSurface('natif-repli');
|
||||
if (ouvrirNatif) { await ouvrirNatif(); return 'natif'; }
|
||||
return 'aucune';
|
||||
}
|
||||
|
||||
+9
-2
@@ -686,8 +686,15 @@ export function init() {
|
||||
// parent to open the shared AI Assistant (same provider/model, skills,
|
||||
// context and history).
|
||||
var openForgeAssistant = function() {
|
||||
import('./bookslm.js').then(function(m) {
|
||||
if (m && m.default) m.default.openForCurrentContext();
|
||||
// Transition Spark (D3, #83) : le bouton IA de Forge passe par
|
||||
// l'aiguilleur commun — panneau Spark selon le réglage de
|
||||
// bascule, assistant intégré en repli explicite.
|
||||
import('./spark-panneau.js').then(function(sp) {
|
||||
return sp.ouvrirAssistantIA(null, function() {
|
||||
return import('./bookslm.js').then(function(m) {
|
||||
if (m && m.default) m.default.openForCurrentContext();
|
||||
});
|
||||
});
|
||||
}).catch(function(err) {
|
||||
console.warn('[Forge] Unable to open AI assistant', err);
|
||||
});
|
||||
|
||||
+2
-2
@@ -1807,7 +1807,7 @@ export const ContextMenuManager = {
|
||||
this._addItem('folder-plus', 'Nouveau dossier', () => this._createDirectory(), isReadonly);
|
||||
this._addItem('file-plus', 'Nouveau fichier', () => this._createFile(), isReadonly);
|
||||
this._addSeparator();
|
||||
this._addItem('brain', '🧠 BooksLM', () => { import('./spark-panneau.js').then(m => { if (!m.ouvrirSpark({ vault: this._targetVault, repertoire: '' })) import('./bookslm.js').then(b => b.default.open(this._targetVault, '')); }); }, false);
|
||||
this._addItem('brain', '🧠 BooksLM', () => { import('./spark-panneau.js').then(m => m.ouvrirAssistantIA({ vault: this._targetVault, repertoire: '' }, async () => { const b = await import('./bookslm.js'); b.default.open(this._targetVault, ''); })); }, false);
|
||||
// #159 — retrait d'un vault ou dossier racine : desktop uniquement,
|
||||
// déregistration seule (aucun fichier supprimé), confirmation exigée.
|
||||
if (isTauriEnv()) {
|
||||
@@ -1824,7 +1824,7 @@ export const ContextMenuManager = {
|
||||
this._addSeparator();
|
||||
this._addItem('bookmark-plus', 'Ajouter aux recherches sauvegardees', () => this._saveDirectorySearch(), false);
|
||||
this._addSeparator();
|
||||
this._addItem('brain', '🧠 BooksLM', () => { import('./spark-panneau.js').then(m => { if (!m.ouvrirSpark({ vault: this._targetVault, repertoire: this._targetPath })) import('./bookslm.js').then(b => b.default.open(this._targetVault, this._targetPath)); }); }, false);
|
||||
this._addItem('brain', '🧠 BooksLM', () => { import('./spark-panneau.js').then(m => m.ouvrirAssistantIA({ vault: this._targetVault, repertoire: this._targetPath }, async () => { const b = await import('./bookslm.js'); b.default.open(this._targetVault, this._targetPath); })); }, false);
|
||||
this._addSeparator();
|
||||
this._addItem('move', t('common.move'), () => this._moveItem(), isReadonly);
|
||||
this._addItem('copy', t('common.duplicate'), () => this._duplicateItem(), isReadonly);
|
||||
|
||||
@@ -116,6 +116,8 @@
|
||||
"ai.improve": "Improve",
|
||||
"ai.input_hint": "Enter to send · Ctrl+Enter for a line break",
|
||||
"ai.inline_completion_title": "AI Inline Completion (Ctrl+J) — Auto-complete text",
|
||||
"ai.spark_toolbar_title": "Open Spark for this document",
|
||||
"ai.spark_toolbar_hint": "AI editing actions live in Spark (context and selection included, approval before any write).",
|
||||
"ai.invalid_api_key": "AI: invalid API key. Check DEEPSEEK_API_KEY in .env",
|
||||
"ai.longer": "Longer",
|
||||
"ai.no_api_key": "No API key configured",
|
||||
@@ -405,6 +407,11 @@
|
||||
"config.ai_header_desc": "Configure your API keys provider by provider. Expand a card to enter a key, then click Test to load the models.",
|
||||
"config.ai_search_placeholder": "Search a provider…",
|
||||
"config.ai_default_section": "Default configuration",
|
||||
"config.assistant_mode_section": "Assistant",
|
||||
"config.assistant_mode": "“Assistant” entries (BooksLM, AI toolbar, mobile button)",
|
||||
"config.assistant_mode_spark": "Spark (shared panel)",
|
||||
"config.assistant_mode_natif": "Built-in assistant (legacy)",
|
||||
"config.assistant_mode_desc": "ObsiGate → Spark transition: “Spark” opens the shared agent panel (current document or folder context included); “Built-in assistant” reopens the legacy surfaces, which are counted while they still exist.",
|
||||
"config.ai_providers_title": "API providers",
|
||||
"config.ai_providers_empty": "No matching provider",
|
||||
"config.ai_status_configured": "Configured",
|
||||
|
||||
@@ -116,6 +116,8 @@
|
||||
"ai.improve": "Améliorer",
|
||||
"ai.input_hint": "Entrée pour envoyer · Ctrl+Entrée pour un saut de ligne",
|
||||
"ai.inline_completion_title": "AI Inline Completion (Ctrl+J) — Complète le texte automatiquement",
|
||||
"ai.spark_toolbar_title": "Ouvrir Spark pour ce document",
|
||||
"ai.spark_toolbar_hint": "Les actions d'édition IA vivent dans Spark (contexte et sélection transmis, approbation avant écriture).",
|
||||
"ai.invalid_api_key": "AI: clé API invalide. Vérifiez DEEPSEEK_API_KEY dans .env",
|
||||
"ai.longer": "Allonger",
|
||||
"ai.no_api_key": "Aucune clé API configurée",
|
||||
@@ -405,6 +407,11 @@
|
||||
"config.ai_header_desc": "Configurez vos clés API fournisseur par fournisseur. Dépliez une carte pour saisir une clé, puis cliquez sur Tester pour charger les modèles.",
|
||||
"config.ai_search_placeholder": "Rechercher un fournisseur…",
|
||||
"config.ai_default_section": "Configuration par défaut",
|
||||
"config.assistant_mode_section": "Assistant",
|
||||
"config.assistant_mode": "Entrées « assistant » (BooksLM, toolbar IA, bouton mobile)",
|
||||
"config.assistant_mode_spark": "Spark (panneau commun)",
|
||||
"config.assistant_mode_natif": "Assistant intégré (ancien)",
|
||||
"config.assistant_mode_desc": "Transition ObsiGate → Spark : « Spark » ouvre le panneau de l'agent commun (contexte du document ou du répertoire transmis) ; « Assistant intégré » rouvre les anciennes surfaces, comptées tant qu'elles existent.",
|
||||
"config.ai_providers_title": "Fournisseurs d'API",
|
||||
"config.ai_providers_empty": "Aucun fournisseur ne correspond",
|
||||
"config.ai_status_configured": "Configuré",
|
||||
|
||||
+13
-7
@@ -9115,7 +9115,8 @@ body.desktop-mode .editor-container {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* AI assistant — raised central button, stands out from the 4 other items */
|
||||
/* Spark — raised central button with the common avatar (même
|
||||
bouton que .draco-spark-flottant sur desktop, décision D3) */
|
||||
.mt-btn-ai {
|
||||
flex: 0 0 auto;
|
||||
width: 56px;
|
||||
@@ -9123,18 +9124,23 @@ body.desktop-mode .editor-container {
|
||||
min-height: 56px;
|
||||
margin: -18px 2px 0;
|
||||
border-radius: 50%;
|
||||
background: var(--accent);
|
||||
color: #fff;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
background: transparent;
|
||||
box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35), 0 0 0 4px var(--bg-secondary);
|
||||
z-index: 2;
|
||||
}
|
||||
.mt-btn-ai:active {
|
||||
background: var(--accent);
|
||||
transform: scale(0.94);
|
||||
}
|
||||
.mt-btn-ai svg {
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
.mt-btn-ai img {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
border-radius: 50%;
|
||||
object-fit: cover;
|
||||
display: block;
|
||||
box-sizing: border-box;
|
||||
border: 3px solid var(--agent, var(--accent));
|
||||
}
|
||||
.mt-btn-ai .mt-label {
|
||||
display: none;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "obsigate",
|
||||
"version": "2.91.0",
|
||||
"version": "2.92.0",
|
||||
"description": "**Porte d'entr\u00e9e web ultra-l\u00e9ger pour vos vaults Obsidian** \u2014 Acc\u00e9dez, naviguez et recherchez dans toutes vos notes Obsidian depuis n'importe quel appareil via une interface web moderne et responsive.",
|
||||
"main": "patch.js",
|
||||
"directories": {
|
||||
|
||||
@@ -451,14 +451,14 @@ def test_bookslm_ouvre_spark_233():
|
||||
"""
|
||||
ui = (FRONTEND / "js" / "ui.js").read_text(encoding="utf-8")
|
||||
assert "import('./spark-panneau.js')" in ui
|
||||
assert "m.ouvrirSpark({ vault: this._targetVault, repertoire: this._targetPath })" in ui
|
||||
assert "m.ouvrirSpark({ vault: this._targetVault, repertoire: '' })" in ui
|
||||
assert "m.ouvrirAssistantIA({ vault: this._targetVault, repertoire: this._targetPath }" in ui
|
||||
assert "m.ouvrirAssistantIA({ vault: this._targetVault, repertoire: '' }" in ui
|
||||
# Repli : l'assistant intégré reste l'issue si Spark n'est pas chargé.
|
||||
assert "b.default.open(this._targetVault, this._targetPath)" in ui
|
||||
|
||||
fab = (FRONTEND / "js" / "ai-fab.js").read_text(encoding="utf-8")
|
||||
assert "import { ouvrirSpark } from './spark-panneau.js';" in fab
|
||||
assert "if (ouvrirSpark(null)) return;" in fab
|
||||
assert "import { ouvrirAssistantIA } from './spark-panneau.js';" in fab
|
||||
assert "ouvrirAssistantIA(null, () => booksLM.openForCurrentContext())" in fab
|
||||
assert "booksLM.openForCurrentContext()" in fab # repli conservé
|
||||
|
||||
helper = (FRONTEND / "js" / "spark-panneau.js").read_text(encoding="utf-8")
|
||||
@@ -477,3 +477,49 @@ def test_bookslm_ouvre_spark_233():
|
||||
panneau = (FRONTEND / "draco-panneau.js").read_text(encoding="utf-8")
|
||||
assert "draco-contexte" in panneau and "DOCUMENT OUVERT" in panneau
|
||||
assert "MODE GÉNÉRAL" in panneau
|
||||
|
||||
|
||||
def test_bascule_d3_234():
|
||||
"""#234 (carte D3, #83) — bascule des entrées IA vers Spark.
|
||||
|
||||
Réglage par utilisateur (spark par défaut / natif) lu par
|
||||
l'aiguilleur commun ; toolbar IA de l'éditeur réduite à Spark en
|
||||
mode spark ; bouton IA de Forge aiguillé ; pastille robot desktop
|
||||
retirée, bouton mobile = avatar Spark commun ; compteurs d'usage
|
||||
des anciennes surfaces côté backend.
|
||||
"""
|
||||
helper = (FRONTEND / "js" / "spark-panneau.js").read_text(encoding="utf-8")
|
||||
assert "export function modeAssistant()" in helper
|
||||
assert "export function definirModeAssistant(mode)" in helper
|
||||
assert "export async function ouvrirAssistantIA(ctx, ouvrirNatif)" in helper
|
||||
assert "obsigate_assistant_mode" in helper
|
||||
assert "natif-explicite" in helper and "natif-repli" in helper
|
||||
assert "/api/transition/usage" in helper
|
||||
|
||||
fab = (FRONTEND / "js" / "ai-fab.js").read_text(encoding="utf-8")
|
||||
assert "createElement('button')" not in fab # pastille robot retirée
|
||||
assert "btn.id = 'ai-fab'" not in fab
|
||||
|
||||
index = (FRONTEND / "index.html").read_text(encoding="utf-8")
|
||||
assert 'id="mt-ai"' in index
|
||||
mt = index.split('id="mt-ai"')[1].split("</button>")[0]
|
||||
assert "avatar-spark.png" in mt # mobile : bouton avatar commun
|
||||
assert 'id="cfg-assistant-mode"' in index # réglage de bascule
|
||||
|
||||
ai = (FRONTEND / "js" / "ai.js").read_text(encoding="utf-8")
|
||||
assert "modeAssistant() === 'spark'" in ai
|
||||
assert "ai-toolbar-spark" in ai
|
||||
|
||||
sync = (FRONTEND / "js" / "sync.js").read_text(encoding="utf-8")
|
||||
assert "sp.ouvrirAssistantIA(null" in sync # bouton IA de Forge
|
||||
|
||||
config = (FRONTEND / "js" / "config.js").read_text(encoding="utf-8")
|
||||
assert "cfg-assistant-mode" in config
|
||||
assert "definirModeAssistant" in config
|
||||
|
||||
racine = FRONTEND.parent
|
||||
backend = (racine / "backend" / "routers" / "transition.py").read_text(encoding="utf-8")
|
||||
assert 'prefix="/api/transition"' in backend
|
||||
assert '"natif-explicite"' in backend and '"natif-repli"' in backend
|
||||
main = (racine / "backend" / "main.py").read_text(encoding="utf-8")
|
||||
assert "transition_router" in main
|
||||
|
||||
Reference in New Issue
Block a user