mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-17 02:05:22 -04:00
Research: drop visible category row, move Format override into Settings
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 <select> 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.
This commit is contained in:
+18
-26
@@ -69,13 +69,12 @@ try { _settingsCollapsed = localStorage.getItem(_COLLAPSE_KEY) === '1'; } catch
|
|||||||
|
|
||||||
function _saveSettingsToStorage() {
|
function _saveSettingsToStorage() {
|
||||||
try {
|
try {
|
||||||
const activeCat = document.querySelector('.research-cat.active');
|
|
||||||
localStorage.setItem(_SETTINGS_KEY, JSON.stringify({
|
localStorage.setItem(_SETTINGS_KEY, JSON.stringify({
|
||||||
max_rounds: document.getElementById('research-rounds')?.value || '0',
|
max_rounds: document.getElementById('research-rounds')?.value || '0',
|
||||||
search_provider: document.getElementById('research-search-provider')?.value || '',
|
search_provider: document.getElementById('research-search-provider')?.value || '',
|
||||||
endpoint_id: document.getElementById('research-endpoint')?.value || '',
|
endpoint_id: document.getElementById('research-endpoint')?.value || '',
|
||||||
model: document.getElementById('research-model')?.value || '',
|
model: document.getElementById('research-model')?.value || '',
|
||||||
category: activeCat?.dataset.cat || '',
|
category: document.getElementById('research-category')?.value || '',
|
||||||
}));
|
}));
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
@@ -374,13 +373,6 @@ function _buildPanelHTML() {
|
|||||||
<span id="research-no-past-hint" style="display:none;font-size:11px;opacity:0.7;position:relative;top:-4px;">— past runs in <button type="button" class="research-library-link" style="background:none;border:none;padding:0;font:inherit;color:var(--accent, var(--red));cursor:pointer;text-decoration:underline;">Library, Research</button></span>
|
<span id="research-no-past-hint" style="display:none;font-size:11px;opacity:0.7;position:relative;top:-4px;">— past runs in <button type="button" class="research-library-link" style="background:none;border:none;padding:0;font:inherit;color:var(--accent, var(--red));cursor:pointer;text-decoration:underline;">Library, Research</button></span>
|
||||||
</p>
|
</p>
|
||||||
<textarea id="research-query" class="research-query" placeholder="${_pickResearchHint()}" rows="4"></textarea>
|
<textarea id="research-query" class="research-query" placeholder="${_pickResearchHint()}" rows="4"></textarea>
|
||||||
<div class="research-category-row" id="research-category-row">
|
|
||||||
<button class="research-cat active" data-cat="" title="LLM auto-detects the best format">Auto</button>
|
|
||||||
<button class="research-cat" data-cat="product">Product</button>
|
|
||||||
<button class="research-cat" data-cat="comparison">Compare</button>
|
|
||||||
<button class="research-cat" data-cat="howto">How-to</button>
|
|
||||||
<button class="research-cat" data-cat="factcheck">Fact-check</button>
|
|
||||||
</div>
|
|
||||||
<button id="research-settings-toggle" class="research-settings-toggle${chevronCls}">
|
<button id="research-settings-toggle" class="research-settings-toggle${chevronCls}">
|
||||||
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:4px;opacity:0.85;flex-shrink:0;"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>Settings<span class="research-settings-chevron">${_chevronIcon}</span>
|
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:4px;opacity:0.85;flex-shrink:0;"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>Settings<span class="research-settings-chevron">${_chevronIcon}</span>
|
||||||
</button>
|
</button>
|
||||||
@@ -389,6 +381,16 @@ function _buildPanelHTML() {
|
|||||||
<span class="research-setting-label">Rounds <span class="hwfit-help-chip hwfit-help-chip-inline" title="How many search → read → reflect rounds the agent runs. More rounds = deeper coverage, longer wait, more tokens.">?</span></span>
|
<span class="research-setting-label">Rounds <span class="hwfit-help-chip hwfit-help-chip-inline" title="How many search → read → reflect rounds the agent runs. More rounds = deeper coverage, longer wait, more tokens.">?</span></span>
|
||||||
<select id="research-rounds">${roundOpts}</select>
|
<select id="research-rounds">${roundOpts}</select>
|
||||||
</label>
|
</label>
|
||||||
|
<label class="research-setting">
|
||||||
|
<span class="research-setting-label">Format <span class="hwfit-help-chip hwfit-help-chip-inline" title="Auto lets the LLM pick the output shape. Override when you specifically want a Compare table, How-to, Product, or Fact-check.">?</span></span>
|
||||||
|
<select id="research-category">
|
||||||
|
<option value="" selected>Auto</option>
|
||||||
|
<option value="product">Product</option>
|
||||||
|
<option value="comparison">Compare</option>
|
||||||
|
<option value="howto">How-to</option>
|
||||||
|
<option value="factcheck">Fact-check</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
<label class="research-setting">
|
<label class="research-setting">
|
||||||
<span class="research-setting-label">Search engine</span>
|
<span class="research-setting-label">Search engine</span>
|
||||||
<select id="research-search-provider">${providerOpts}</select>
|
<select id="research-search-provider">${providerOpts}</select>
|
||||||
@@ -437,8 +439,8 @@ function _dismissKeyboard(input) {
|
|||||||
|
|
||||||
/** Reset the category selector back to "Auto" (called after each start). */
|
/** Reset the category selector back to "Auto" (called after each start). */
|
||||||
function _resetCategoryToAuto() {
|
function _resetCategoryToAuto() {
|
||||||
document.querySelectorAll('.research-cat').forEach(b =>
|
const sel = document.getElementById('research-category');
|
||||||
b.classList.toggle('active', (b.dataset.cat || '') === ''));
|
if (sel) sel.value = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function _wireEvents(pane) {
|
function _wireEvents(pane) {
|
||||||
@@ -452,13 +454,6 @@ function _wireEvents(pane) {
|
|||||||
pane.querySelector('#research-start-btn').addEventListener('click', _handleStart);
|
pane.querySelector('#research-start-btn').addEventListener('click', _handleStart);
|
||||||
pane.querySelector('#research-add-btn').addEventListener('click', _handleAdd);
|
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', () => {
|
pane.querySelector('#research-settings-toggle').addEventListener('click', () => {
|
||||||
const body = document.getElementById('research-settings-body');
|
const body = document.getElementById('research-settings-body');
|
||||||
const btn = document.getElementById('research-settings-toggle');
|
const btn = document.getElementById('research-settings-toggle');
|
||||||
@@ -484,8 +479,7 @@ function _wireEvents(pane) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function _readSettings() {
|
function _readSettings() {
|
||||||
const activeCat = document.querySelector('.research-cat.active');
|
const category = document.getElementById('research-category')?.value || undefined;
|
||||||
const category = activeCat?.dataset.cat || undefined;
|
|
||||||
const settings = {
|
const settings = {
|
||||||
max_rounds: parseInt(document.getElementById('research-rounds')?.value || '0', 10),
|
max_rounds: parseInt(document.getElementById('research-rounds')?.value || '0', 10),
|
||||||
search_provider: document.getElementById('research-search-provider')?.value || undefined,
|
search_provider: document.getElementById('research-search-provider')?.value || undefined,
|
||||||
@@ -524,9 +518,8 @@ function _editJob(job) {
|
|||||||
}
|
}
|
||||||
// Restore category
|
// Restore category
|
||||||
const cat = job.category || '';
|
const cat = job.category || '';
|
||||||
document.querySelectorAll('.research-cat').forEach(b => {
|
const catSel = document.getElementById('research-category');
|
||||||
b.classList.toggle('active', b.dataset.cat === cat);
|
if (catSel) catSel.value = cat;
|
||||||
});
|
|
||||||
// Restore settings
|
// Restore settings
|
||||||
const s = job.settings || {};
|
const s = job.settings || {};
|
||||||
const roundsEl = document.getElementById('research-rounds');
|
const roundsEl = document.getElementById('research-rounds');
|
||||||
@@ -613,9 +606,8 @@ function _restoreSavedSettings() {
|
|||||||
const saved = _loadSettingsFromStorage();
|
const saved = _loadSettingsFromStorage();
|
||||||
if (!saved) return;
|
if (!saved) return;
|
||||||
if (saved.category !== undefined) {
|
if (saved.category !== undefined) {
|
||||||
document.querySelectorAll('.research-cat').forEach(b => {
|
const catSel = document.getElementById('research-category');
|
||||||
b.classList.toggle('active', b.dataset.cat === saved.category);
|
if (catSel) catSel.value = saved.category;
|
||||||
});
|
|
||||||
}
|
}
|
||||||
// Rounds intentionally defaults to "Auto" on every open — don't restore.
|
// Rounds intentionally defaults to "Auto" on every open — don't restore.
|
||||||
// Users can pick a specific cap each time if needed.
|
// Users can pick a specific cap each time if needed.
|
||||||
|
|||||||
Reference in New Issue
Block a user