mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-22 06:42:20 +02:00
Consolidate Odysseus agent harness and tool contracts
This commit is contained in:
+68
-3
@@ -1,7 +1,7 @@
|
||||
// static/js/settings.js — Settings panel module (ES6)
|
||||
// User-facing preferences: AI models, search, appearance
|
||||
|
||||
import uiModule from './ui.js?v=20260908weekhoverfix1';
|
||||
import uiModule from './ui.js?v=20260916largetoolscroll1';
|
||||
import searchModule from './search.js';
|
||||
import { byId } from './settings/dom.js';
|
||||
import {
|
||||
@@ -2193,6 +2193,71 @@ function initAll() {
|
||||
initEmailAccountsSettings();
|
||||
initReminderSettings();
|
||||
initUnifiedIntegrations();
|
||||
initDocumentWritingStyle();
|
||||
}
|
||||
|
||||
async function initDocumentWritingStyle() {
|
||||
const styleEl = el('set-document-style');
|
||||
const saveBtn = el('set-document-style-save');
|
||||
const extractBtn = el('set-document-style-extract');
|
||||
const fileEl = el('set-document-style-file');
|
||||
const msg = el('set-document-style-msg');
|
||||
if (!styleEl || !saveBtn) return;
|
||||
try {
|
||||
const res = await fetch('/api/auth/settings', { credentials: 'same-origin' });
|
||||
const data = await res.json();
|
||||
styleEl.value = String(data.document_writing_style || '');
|
||||
} catch (_) {
|
||||
if (msg) msg.textContent = 'Failed to load';
|
||||
}
|
||||
saveBtn.addEventListener('click', async () => {
|
||||
if (msg) msg.textContent = 'Saving...';
|
||||
try {
|
||||
const res = await _postSettings({ document_writing_style: styleEl.value });
|
||||
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
||||
if (msg) msg.textContent = '✓ Saved';
|
||||
} catch (_) {
|
||||
if (msg) msg.textContent = 'Failed to save';
|
||||
}
|
||||
setTimeout(() => { if (msg) msg.textContent = ''; }, 3000);
|
||||
});
|
||||
extractBtn?.addEventListener('click', () => fileEl?.click());
|
||||
fileEl?.addEventListener('change', async () => {
|
||||
const file = fileEl.files?.[0];
|
||||
if (!file) return;
|
||||
extractBtn.disabled = true;
|
||||
let whirlpool = null;
|
||||
if (msg) {
|
||||
msg.replaceChildren();
|
||||
try {
|
||||
const spinner = window.spinnerModule || (await import('./spinner.js')).default;
|
||||
whirlpool = spinner.createWhirlpool(14);
|
||||
whirlpool.element.style.cssText = 'display:inline-flex;width:14px;height:14px;margin-right:7px;';
|
||||
const label = document.createElement('span');
|
||||
label.textContent = 'Analyzing...';
|
||||
msg.append(whirlpool.element, label);
|
||||
} catch (_) {
|
||||
msg.textContent = 'Analyzing...';
|
||||
}
|
||||
}
|
||||
try {
|
||||
const body = new FormData();
|
||||
body.append('file', file);
|
||||
const res = await fetch('/api/auth/settings/document-style/extract', {
|
||||
method: 'POST', credentials: 'same-origin', body,
|
||||
});
|
||||
const data = await res.json().catch(() => ({}));
|
||||
if (!res.ok || !data.style) throw new Error(data.detail || data.error || 'Extraction failed');
|
||||
styleEl.value = String(data.style);
|
||||
if (msg) msg.textContent = '✓ Extracted — review and save';
|
||||
} catch (error) {
|
||||
if (msg) msg.textContent = error.message || 'Extraction failed';
|
||||
} finally {
|
||||
whirlpool?.destroy?.();
|
||||
extractBtn.disabled = false;
|
||||
fileEl.value = '';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function notifyIntegrationsChanged() {
|
||||
@@ -2668,7 +2733,7 @@ async function initEmailAccountsSettings() {
|
||||
if (emailPreferences && emailPreferences.dataset.emailSettingsBound !== '1') {
|
||||
emailPreferences.dataset.emailSettingsBound = '1';
|
||||
try {
|
||||
const mod = await import('./emailLibrary.js?v=20260910replyactions1');
|
||||
const mod = await import('./emailLibrary.js?v=20260915trashmove2');
|
||||
if (typeof mod.mountEmailSettings === 'function') {
|
||||
await mod.mountEmailSettings(emailPreferences);
|
||||
}
|
||||
@@ -2686,7 +2751,7 @@ async function initEmailAccountsSettings() {
|
||||
tasksBtn.dataset.bound = '1';
|
||||
tasksBtn.addEventListener('click', async () => {
|
||||
try {
|
||||
const mod = await import('./tasks.js?v=20260901taskskilldensity1');
|
||||
const mod = await import('./tasks.js?v=20260914taskmodel1');
|
||||
const openTasks = mod.openTasks || (mod.default && mod.default.openTasks);
|
||||
if (typeof openTasks === 'function') openTasks(null, { filter: 'Email' });
|
||||
else document.getElementById('tool-tasks-btn')?.click();
|
||||
|
||||
Reference in New Issue
Block a user