From 0895c70fc989ba357d9e895d94a73e5f5bebcd83 Mon Sep 17 00:00:00 2001
From: pewdiepie-archdaemon
Date: Sat, 13 Jun 2026 22:38:20 +0900
Subject: [PATCH] Research: drop visible category row, move Format override
into Settings
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Auto handles 90%+ of cases — the row of category buttons was
visual noise on the main panel. Now:
- Removed the .research-category-row from above the textarea.
- Added a Format inside Settings (next to Rounds) with
Auto / Product / Compare / How-to / Fact-check options. Default
is Auto, same as before.
- Updated all the JS that read .research-cat.active / data-cat to
read #research-category.value instead (_saveSettings, _readSettings,
_resetCategoryToAuto, _editJob, _restoreSavedSettings).
Same wire to the backend — settings.category still carries through.
---
static/js/research/panel.js | 44 +++++++++++++++----------------------
1 file changed, 18 insertions(+), 26 deletions(-)
diff --git a/static/js/research/panel.js b/static/js/research/panel.js
index 3d7e8943d..dd561abfc 100644
--- a/static/js/research/panel.js
+++ b/static/js/research/panel.js
@@ -69,13 +69,12 @@ try { _settingsCollapsed = localStorage.getItem(_COLLAPSE_KEY) === '1'; } catch
function _saveSettingsToStorage() {
try {
- const activeCat = document.querySelector('.research-cat.active');
localStorage.setItem(_SETTINGS_KEY, JSON.stringify({
max_rounds: document.getElementById('research-rounds')?.value || '0',
search_provider: document.getElementById('research-search-provider')?.value || '',
endpoint_id: document.getElementById('research-endpoint')?.value || '',
model: document.getElementById('research-model')?.value || '',
- category: activeCat?.dataset.cat || '',
+ category: document.getElementById('research-category')?.value || '',
}));
} catch {}
}
@@ -374,13 +373,6 @@ function _buildPanelHTML() {
— past runs in Library, Research
-
- Auto
- Product
- Compare
- How-to
- Fact-check
-
Settings${_chevronIcon}
@@ -389,6 +381,16 @@ function _buildPanelHTML() {
Rounds ?
${roundOpts}
+
+ Format ?
+
+ Auto
+ Product
+ Compare
+ How-to
+ Fact-check
+
+
Search engine
${providerOpts}
@@ -437,8 +439,8 @@ function _dismissKeyboard(input) {
/** Reset the category selector back to "Auto" (called after each start). */
function _resetCategoryToAuto() {
- document.querySelectorAll('.research-cat').forEach(b =>
- b.classList.toggle('active', (b.dataset.cat || '') === ''));
+ const sel = document.getElementById('research-category');
+ if (sel) sel.value = '';
}
function _wireEvents(pane) {
@@ -452,13 +454,6 @@ function _wireEvents(pane) {
pane.querySelector('#research-start-btn').addEventListener('click', _handleStart);
pane.querySelector('#research-add-btn').addEventListener('click', _handleAdd);
- pane.querySelectorAll('.research-cat').forEach(btn => {
- btn.addEventListener('click', () => {
- pane.querySelectorAll('.research-cat').forEach(b => b.classList.remove('active'));
- btn.classList.add('active');
- });
- });
-
pane.querySelector('#research-settings-toggle').addEventListener('click', () => {
const body = document.getElementById('research-settings-body');
const btn = document.getElementById('research-settings-toggle');
@@ -484,8 +479,7 @@ function _wireEvents(pane) {
}
function _readSettings() {
- const activeCat = document.querySelector('.research-cat.active');
- const category = activeCat?.dataset.cat || undefined;
+ const category = document.getElementById('research-category')?.value || undefined;
const settings = {
max_rounds: parseInt(document.getElementById('research-rounds')?.value || '0', 10),
search_provider: document.getElementById('research-search-provider')?.value || undefined,
@@ -524,9 +518,8 @@ function _editJob(job) {
}
// Restore category
const cat = job.category || '';
- document.querySelectorAll('.research-cat').forEach(b => {
- b.classList.toggle('active', b.dataset.cat === cat);
- });
+ const catSel = document.getElementById('research-category');
+ if (catSel) catSel.value = cat;
// Restore settings
const s = job.settings || {};
const roundsEl = document.getElementById('research-rounds');
@@ -613,9 +606,8 @@ function _restoreSavedSettings() {
const saved = _loadSettingsFromStorage();
if (!saved) return;
if (saved.category !== undefined) {
- document.querySelectorAll('.research-cat').forEach(b => {
- b.classList.toggle('active', b.dataset.cat === saved.category);
- });
+ const catSel = document.getElementById('research-category');
+ if (catSel) catSel.value = saved.category;
}
// Rounds intentionally defaults to "Auto" on every open — don't restore.
// Users can pick a specific cap each time if needed.