feat(sidebar+assistant): filtre Recents/Sauvegardes (#99), pastille Deep Research (#100) et icone du bouton + (BUG-049)
This commit is contained in:
+17
-14
@@ -114,6 +114,9 @@ class BooksLM {
|
||||
this._adhocDirs = [];
|
||||
this._images = [];
|
||||
this._activeSkill = null;
|
||||
// Deep Research: a skill-like chip that enables agent tools and injects a
|
||||
// research directive into the request (without polluting the composer).
|
||||
this._activeDeepResearch = false;
|
||||
this._skills = [];
|
||||
this._menuItems = [];
|
||||
this._menuIndex = 0;
|
||||
@@ -214,6 +217,7 @@ class BooksLM {
|
||||
this._adhocDirs = [];
|
||||
this._images = [];
|
||||
this._activeSkill = null;
|
||||
this._activeDeepResearch = false;
|
||||
this._isLoading = true;
|
||||
await this._loadHistory(preferredSessionId);
|
||||
|
||||
@@ -1216,7 +1220,7 @@ class BooksLM {
|
||||
const host = this._panel.querySelector('.bookslm-attachments');
|
||||
if (!host) return;
|
||||
host.innerHTML = '';
|
||||
const hasAny = this._adhocFiles.length || this._adhocDirs.length || this._images.length || this._activeSkill;
|
||||
const hasAny = this._adhocFiles.length || this._adhocDirs.length || this._images.length || this._activeSkill || this._activeDeepResearch;
|
||||
host.classList.toggle('empty', !hasAny);
|
||||
if (!hasAny) return;
|
||||
|
||||
@@ -1228,6 +1232,13 @@ class BooksLM {
|
||||
() => { this._activeSkill = null; this._renderAttachments(); },
|
||||
));
|
||||
}
|
||||
if (this._activeDeepResearch) {
|
||||
host.appendChild(this._chip(
|
||||
`🔎 ${t('bookslm.ext_deep_research')}`,
|
||||
'deep-research',
|
||||
() => { this._activeDeepResearch = false; this._renderAttachments(); },
|
||||
));
|
||||
}
|
||||
for (const file of this._adhocFiles) {
|
||||
host.appendChild(this._chip(`📄 ${file.path}`, 'file', () => this._removeAdhocFile(file.path)));
|
||||
}
|
||||
@@ -1449,21 +1460,13 @@ class BooksLM {
|
||||
if (typeof safeCreateIcons === 'function') safeCreateIcons();
|
||||
}
|
||||
|
||||
/** #97 — Deep Research: enabled agent tools + a pre-filled directive. */
|
||||
/** #97/#99 — Deep Research: agent tools + a skill-like chip (no composer text). */
|
||||
_startDeepResearch() {
|
||||
this._closeExtMenu();
|
||||
if (!this._agentMode) this._toggleAgentMode();
|
||||
const textarea = this._panel && this._panel.querySelector('textarea');
|
||||
if (textarea) {
|
||||
const directive = textarea.value.trim()
|
||||
? textarea.value.replace(/\s*$/, '')
|
||||
: '';
|
||||
textarea.value = (directive ? directive + '\n\n' : '') + t('bookslm.deep_research_prompt');
|
||||
textarea.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
textarea.focus();
|
||||
} else {
|
||||
showToast(t('bookslm.deep_research_started'), 'info');
|
||||
}
|
||||
this._activeDeepResearch = true;
|
||||
this._renderAttachments();
|
||||
showToast(t('bookslm.deep_research_started'), 'info');
|
||||
}
|
||||
|
||||
_onPaste(e) {
|
||||
@@ -2728,7 +2731,7 @@ class BooksLM {
|
||||
img.path ? { path: img.path } : { data: img.data, mime_type: img.mime_type }
|
||||
)),
|
||||
skill: this._activeSkill,
|
||||
message: text,
|
||||
message: this._activeDeepResearch ? `${t('bookslm.deep_research_prompt')}\n\n${text}` : text,
|
||||
conversation_history: history,
|
||||
provider,
|
||||
model,
|
||||
|
||||
Reference in New Issue
Block a user