Self-hosted AI workspace.
Python
Move email writing style into AI settings
pewdiepie-archdaemon58ee4e78a140
diff --git a/static/index.html b/static/index.htmlindex 6c9887945..ffeafa183 100644--- a/static/index.html+++ b/static/index.html@@ -1591,8 +1591,16 @@settings backup. Re-add this card to surface the toggleagain once the core experience is faster. --><div class="admin-card">- <h2 style="display:flex;align-items:center;gap:6px;"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="margin-right:1px;opacity:0.6;flex-shrink:0"><rect x="2" y="4" width="20" height="16" rx="2"/><polyline points="2 6 12 13 22 6"/></svg>Email Safety<span style="flex:1"></span><label class="admin-switch" title="When on, agent send_email and reply_to_email tools stage a draft for your approval instead of sending immediately."><input type="checkbox" id="set-agentEmailConfirm" checked><span class="admin-slider"></span></label></h2>- <div class="admin-toggle-sub" style="margin-bottom:8px">When on, agent <code>send_email</code> / <code>reply_to_email</code> tools stage a draft for your approval (in the chat) instead of SMTPing immediately. Stops models from inventing a signature and sending it to a real recipient before you can review.</div>+ <h2><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:5px;opacity:0.6"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg>Writing Style</h2>+ <div class="admin-toggle-sub" style="margin-bottom:8px">Used when AI drafts email replies. Keep this email-specific: greetings, sign-off, tone, and length.</div>+ <div class="settings-col">+ <textarea id="set-email-style" rows="6" class="settings-select" style="font-family:inherit;resize:none" placeholder="e.g. I write emails in this style. I don't use exclamation marks. I sign emails with: ..."></textarea>+ <div class="settings-row" style="margin-top:4px">+ <span id="set-email-style-msg" style="font-size:11px;"></span>+ <button class="admin-btn-add" id="set-email-style-extract" style="margin-left:auto;display:inline-flex;align-items:center;gap:5px;"><svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 0L14.59 8.41L23 12L14.59 15.59L12 24L9.41 15.59L1 12L9.41 8.41Z"/></svg>Extract from Sent (15 emails)</button>+ <button class="admin-btn-add" id="set-email-style-save">Save</button>+ </div>+ </div></div></div>@@ -1999,18 +2007,6 @@</div></div>- <div class="admin-card">- <h2><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:5px;opacity:0.6"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg>Writing Style</h2>- <div class="admin-toggle-sub" style="margin-bottom:8px">AI-extracted from your sent emails. Used when AI drafts replies.</div>- <div class="settings-col">- <textarea id="set-email-style" rows="6" class="settings-select" style="font-family:inherit;resize:none" placeholder="e.g. I write emails in this style. I don't use exclamation marks. I sign emails with: ..."></textarea>- <div class="settings-row" style="margin-top:4px">- <span id="set-email-style-msg" style="font-size:11px;"></span>- <button class="admin-btn-add" id="set-email-style-extract" style="margin-left:auto;display:inline-flex;align-items:center;gap:5px;"><svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 0L14.59 8.41L23 12L14.59 15.59L12 24L9.41 15.59L1 12L9.41 8.41Z"/></svg>Extract from Sent (15 emails)</button>- <button class="admin-btn-add" id="set-email-style-save">Save</button>- </div>- </div>- </div></div><!-- ═══ REMINDERS TAB ═══ -->diff --git a/static/js/settings.js b/static/js/settings.jsindex 0f5f71d85..4bff7ad8c 100644--- a/static/js/settings.js+++ b/static/js/settings.js@@ -1722,24 +1722,6 @@ async function initAgentSettings() {(curR != null ? ' · ' + curR + ' steps/message' : '') +(supInput && supInput.checked ? ' · supervisor on' : '');- // Standalone Email Safety toggle (separate card on the AI Defaults tab).- // Default to ON if the setting isn't present so a fresh install is safe.- var emailConfirm = el('set-agentEmailConfirm');- if (emailConfirm) {- try {- var s = await fetch('/api/auth/settings', { credentials: 'same-origin' }).then(r => r.json());- emailConfirm.checked = s.agent_email_confirm !== false;- } catch (_) {}- emailConfirm.addEventListener('change', async () => {- try {- await fetch('/api/auth/settings', {- method: 'POST', credentials: 'same-origin',- headers: { 'Content-Type': 'application/json' },- body: JSON.stringify({ agent_email_confirm: !!emailConfirm.checked }),- });- } catch (_) {}- });- }}/* ═══════════════════════════════════════════