Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.
JavaScript agent-collaborationagent-harnessagent-orchestrationagent-teamagent-workflowai-assistantai-automationai-employeeai-productivityai-teamai-workflowautonomous-agentsclaude-code-guiclaude-coworkdesktop-agentlocal-firstmulti-agentmulti-agent-systemself-evolving-agentstask-automation
Add a "Clear all conversations" button to the settings page
wyt694973c9afda
diff --git a/src/main/features/chats.ts b/src/main/features/chats.tsindex 124c52c5..d63654d5 100644--- a/src/main/features/chats.ts+++ b/src/main/features/chats.ts@@ -256,6 +256,26 @@ export async function getMessages(userId: string, cid: string, limit = 200): Proreturn readJsonl<MessageRecord>(path.join(ensureUserDir(userId), `${cid}.jsonl`), limit);}+/** Drop every conversation belonging to `userId`. Loops `deleteConversation`+ * so the full cascade (group dir / main jsonl / sessions / attachments / CLI+ * / search index) runs per cid; one cid's failure doesn't abort the rest.+ * Returns the number actually removed. Used by Settings → "Clear all+ * conversations". */+export async function deleteAllConversations(userId: string): Promise<number> {+ const items = await listConversations(userId);+ if (!items.length) return 0;+ let deleted = 0;+ for (const c of items) {+ try {+ if (await deleteConversation(userId, c.conversation_id)) deleted++;+ } catch (err) {+ log.warn(`bulk-delete failed user=${userId} cid=${c.conversation_id}: ${(err as Error).message}`);+ }+ }+ log.info(`deleted-all user=${userId} count=${deleted}`);+ return deleted;+}+/** Drop every conversation tied to `agentId` across every user. Called when* a custom agent is deleted. */export async function deleteConversationsByAgent(agentId: string): Promise<number> {diff --git a/src/main/ipc/index.ts b/src/main/ipc/index.tsindex 6dd380e5..aca6d26c 100644--- a/src/main/ipc/index.ts+++ b/src/main/ipc/index.ts@@ -104,6 +104,11 @@ const invokeHandlers: Record<string, InvokeHandler> = {return { deleted: ok };},+ 'conversations.deleteAll': async (_args, ctx) => {+ const deleted = await chats.deleteAllConversations(ctx.userId);+ return { deleted };+ },+// ── Group chat (replaces legacy conversations.send / .stream / .markFormSubmitted) ──'groupChat.send': async ({ cid, content, attachments }, ctx) => {if (!safeId(cid)) throw new Error('invalid cid');diff --git a/src/renderer/index.html b/src/renderer/index.htmlindex 8d1e4d12..4beee294 100644--- a/src/renderer/index.html+++ b/src/renderer/index.html@@ -498,6 +498,20 @@<div class="settings-empty" data-i18n="settings.loading">Loading…</div></div></div>++ <div class="settings-section-head" data-i18n="settings.section.data">Data</div>+ <div class="settings-section-note" data-i18n="settings.section.data_note">Maintenance actions on local data. These cannot be undone.</div>++ <div class="settings-group">+ <div class="settings-group-head">+ <div class="settings-group-title" data-i18n="settings.clear_all_convs.title">Clear all conversations</div>+ <div class="settings-group-sub" data-i18n="settings.clear_all_convs.sub">Removes every conversation and its associated message history, attachments, plan, sessions, and search index entries — same cascade as clicking × on a single conversation, applied to all of them. Skills and agents are NOT touched.</div>+ </div>+ <div class="settings-row">+ <button class="btn btn-sm btn-danger" id="settings-clear-all-convs-btn" data-i18n="settings.clear_all_convs.btn">Clear all conversations</button>+ <span class="settings-status muted" id="settings-clear-all-convs-status"></span>+ </div>+ </div></div></div></section>diff --git a/src/renderer/locales/en.json b/src/renderer/locales/en.jsonindex 71485296..45e58fb0 100644--- a/src/renderer/locales/en.json+++ b/src/renderer/locales/en.json@@ -357,6 +357,16 @@"settings.image.empty": "No image-gen API key yet (the chat-side OpenAI / Google key will be reused if present).","settings.image.active_tag": "Active","settings.image.confirm_delete": "Delete the {provider} image API key?",+ "settings.section.data": "Data",+ "settings.section.data_note": "Maintenance actions on local data. These cannot be undone.",+ "settings.clear_all_convs.title": "Clear all conversations",+ "settings.clear_all_convs.sub": "Removes every conversation and its associated message history, attachments, plan, sessions, and search index entries — same cascade as clicking × on a single conversation, applied to all of them. Skills and agents are NOT touched.",+ "settings.clear_all_convs.btn": "Clear all conversations",+ "settings.clear_all_convs.confirm": "Permanently delete all {count} conversation(s) and every related artifact (messages, attachments, plans, sessions, search index)? This cannot be undone.",+ "settings.clear_all_convs.empty": "No conversations to clear.",+ "settings.clear_all_convs.in_progress": "Clearing…",+ "settings.clear_all_convs.success": "Cleared {count} conversation(s).",+ "settings.clear_all_convs.failed": "Clear-all failed: {message}","settings.language.title": "语言 / Language","settings.language.zh": "简体中文","settings.language.en": "English",diff --git a/src/renderer/locales/zh.json b/src/renderer/locales/zh.jsonindex 17992a42..98255a34 100644--- a/src/renderer/locales/zh.json+++ b/src/renderer/locales/zh.json@@ -357,6 +357,16 @@"settings.image.empty": "尚未配置图片生成 API Key(将复用聊天 Key 兜底)。","settings.image.active_tag": "当前生效","settings.image.confirm_delete": "确认删除 {provider} 的图片 API Key?",+ "settings.section.data": "数据",+ "settings.section.data_note": "对本地数据的维护操作,无法撤销。",+ "settings.clear_all_convs.title": "清空所有对话",+ "settings.clear_all_convs.sub": "删除每一条对话以及它附带的消息记录、附件、计划、会话、搜索索引——和点单条对话上的 × 同样的清理流程,批量执行。技能和智能体不受影响。",+ "settings.clear_all_convs.btn": "清空所有对话",+ "settings.clear_all_convs.confirm": "确认永久删除全部 {count} 条对话及其关联内容(消息、附件、计划、会话、搜索索引)?无法撤销。",+ "settings.clear_all_convs.empty": "目前没有对话可清空。",+ "settings.clear_all_convs.in_progress": "正在清理…",+ "settings.clear_all_convs.success": "已清空 {count} 条对话。",+ "settings.clear_all_convs.failed": "清空失败:{message}","settings.language.title": "语言 / Language","settings.language.zh": "简体中文","settings.language.en": "English",diff --git a/src/renderer/modules/settings.js b/src/renderer/modules/settings.jsindex 4b477272..314576fe 100644--- a/src/renderer/modules/settings.js+++ b/src/renderer/modules/settings.js@@ -24,6 +24,7 @@ let _settingsState = {async function loadSettings() {_settingsBindLanguageOnce();_settingsSyncLanguageRadio();+ _settingsBindClearAllConvsOnce();await Promise.all([_settingsRefreshProviders(),_settingsRefreshEntries(),@@ -228,6 +229,74 @@ function _settingsSyncLanguageRadio() {});}+// ── Clear all conversations ──+// One-shot bind: button click takes a snapshot of the current conv list+// (the global `conversations` array, kept in sync by `loadConversations`),+// runs the same per-cid renderer cleanup the × button does (abortConvStream+// + _forgetConvLocal) for every cid in the snapshot, then fires the bulk+// IPC `conversations.deleteAll` (server runs the full delete cascade per+// cid: group dir / main jsonl / sessions / attachments / CLI / search idx+// — see chats.deleteConversation). If the user was viewing one of the+// deleted conversations, switch to new-chat. Reload the sidebar list.++let _settingsClearAllConvsBound = false;++function _settingsBindClearAllConvsOnce() {+ if (_settingsClearAllConvsBound) return;+ const btn = document.getElementById('settings-clear-all-convs-btn');+ if (!btn) return;+ btn.addEventListener('click', async () => {+ // Snapshot BEFORE the bulk delete — once the server returns, the global+ // `conversations` is about to be reloaded as empty and we'll lose the+ // per-cid info needed for renderer cleanup.+ const snapshot = (Array.isArray(conversations) ? conversations : []).slice();+ const status = document.getElementById('settings-clear-all-convs-status');+ if (!snapshot.length) {+ if (typeof uiAlert === 'function') {+ await uiAlert(t('settings.clear_all_convs.empty'));+ }+ return;+ }+ const ok = await uiConfirm(t('settings.clear_all_convs.confirm', { count: snapshot.length }));+ if (!ok) return;++ btn.disabled = true;+ if (status) status.textContent = t('settings.clear_all_convs.in_progress');++ const wasActiveDeleted = currentCid+ && snapshot.some((c) => c.conversation_id === currentCid);+ for (const c of snapshot) {+ try { if (typeof abortConvStream === 'function') abortConvStream(c.conversation_id); } catch (_) {}+ try { if (typeof _forgetConvLocal === 'function') _forgetConvLocal(c.conversation_id); } catch (_) {}+ }++ let deleted = 0;+ try {+ const res = await window.orkas.invoke('conversations.deleteAll');+ if (res && typeof res.deleted === 'number') deleted = res.deleted;+ _settingsLog.info('cleared all conversations', { count: deleted });+ } catch (err) {+ _settingsLog.warn('clear-all failed', { error: (err && err.message) || String(err) });+ btn.disabled = false;+ if (status) status.textContent = '';+ if (typeof uiAlert === 'function') {+ uiAlert(t('settings.clear_all_convs.failed', {+ message: (err && err.message) || String(err),+ }));+ }+ return;+ }++ if (wasActiveDeleted && typeof setView === 'function') setView('new-chat');+ try { await loadConversations(); } catch (_) {}++ btn.disabled = false;+ if (status) status.textContent = t('settings.clear_all_convs.success', { count: deleted });+ setTimeout(() => { if (status) status.textContent = ''; }, 4000);+ });+ _settingsClearAllConvsBound = true;+}+// Keep the radio in sync if some other code path changes language, and// re-render sections whose text is written by JS (so their content// isn't refreshed by applyDomI18n's data-i18n sweep).