mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-17 02:05:22 -04:00
Refresh slash command hints
This commit is contained in:
@@ -9,14 +9,14 @@ const MAX_VISIBLE = 12;
|
|||||||
|
|
||||||
// Flatten the registry into a searchable list of leaf entries. Each entry is
|
// Flatten the registry into a searchable list of leaf entries. Each entry is
|
||||||
// either a top-level command or a "cmd sub" pair (so subcommands get their
|
// either a top-level command or a "cmd sub" pair (so subcommands get their
|
||||||
// own row when relevant — /toggle web, /session new, etc).
|
// own row when relevant — /toggle web, /chats new, etc).
|
||||||
// Commands intentionally excluded from the autocomplete popup (pure easter
|
// Commands intentionally excluded from the autocomplete popup (pure easter
|
||||||
// eggs with no productivity value, or internal machinery).
|
// eggs with no productivity value, or internal machinery).
|
||||||
const EXCLUDED = new Set(['flip','roll','8ball','fortune','odyssey','ascii']);
|
const EXCLUDED = new Set(['flip','roll','8ball','fortune','odyssey','ascii']);
|
||||||
|
|
||||||
// Important legacy aliases to promote to their own rows in the popup. These
|
// Important legacy aliases to promote to their own rows in the popup. These
|
||||||
// are the short forms people will actually type (/new, /clear, /web, etc.)
|
// are the short forms people will actually type (/new, /clear, /web, etc.)
|
||||||
// rather than the full /session new, /toggle web equivalents.
|
// rather than the full /chats new, /toggle web equivalents.
|
||||||
const PROMOTED_ALIASES = new Set([
|
const PROMOTED_ALIASES = new Set([
|
||||||
'new','clear','rename','fork','export','archive','important','star',
|
'new','clear','rename','fork','export','archive','important','star',
|
||||||
'web','bash','research','doc',
|
'web','bash','research','doc',
|
||||||
@@ -30,6 +30,7 @@ function _flatten() {
|
|||||||
// 1. Top-level commands and their subcommands from COMMANDS
|
// 1. Top-level commands and their subcommands from COMMANDS
|
||||||
for (const [name, def] of Object.entries(COMMANDS)) {
|
for (const [name, def] of Object.entries(COMMANDS)) {
|
||||||
if (EXCLUDED.has(name)) continue;
|
if (EXCLUDED.has(name)) continue;
|
||||||
|
if (def.hidden) continue;
|
||||||
if (def.handler) {
|
if (def.handler) {
|
||||||
seen.add(`/${name}`);
|
seen.add(`/${name}`);
|
||||||
out.push({
|
out.push({
|
||||||
@@ -43,6 +44,7 @@ function _flatten() {
|
|||||||
if (def.subs) {
|
if (def.subs) {
|
||||||
for (const [sub, sdef] of Object.entries(def.subs)) {
|
for (const [sub, sdef] of Object.entries(def.subs)) {
|
||||||
if (sub.startsWith('_')) continue;
|
if (sub.startsWith('_')) continue;
|
||||||
|
if (sdef.hidden) continue;
|
||||||
const tok = `/${name} ${sub}`;
|
const tok = `/${name} ${sub}`;
|
||||||
seen.add(tok);
|
seen.add(tok);
|
||||||
out.push({
|
out.push({
|
||||||
|
|||||||
+50
-59
@@ -1422,17 +1422,17 @@ async function _cmdMemorySearch(args, ctx) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Note (quick memory shortcut) ──
|
// ── Note (quick Notes shortcut) ──
|
||||||
|
|
||||||
async function _cmdNote(args, ctx) {
|
async function _cmdNote(args, ctx) {
|
||||||
const text = args.join(' ');
|
const text = args.join(' ');
|
||||||
if (!text) { slashReply('Usage: /note Your note here'); return true; }
|
if (!text) { slashReply('Usage: /note Your note here'); return true; }
|
||||||
const res = await fetch(`${API_BASE}/api/memory/add`, {
|
const res = await fetch(`${API_BASE}/api/notes`, {
|
||||||
method: 'POST', credentials: 'same-origin',
|
method: 'POST', credentials: 'same-origin',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({ text, category: 'note', source: 'user' })
|
body: JSON.stringify({ title: text, content: '', note_type: 'note', source: 'slash' })
|
||||||
});
|
});
|
||||||
if (res.ok) await typewriterReply(`Note saved: ${ctx.esc(text)}`);
|
if (res.ok) await typewriterReply(`Note added: ${ctx.esc(text)}`);
|
||||||
else slashReply('Failed to save note');
|
else slashReply('Failed to save note');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -5347,7 +5347,7 @@ async function _cmdHelp(args, ctx) {
|
|||||||
categories[cat].push(` ${usage.padEnd(21)}${desc}`);
|
categories[cat].push(` ${usage.padEnd(21)}${desc}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const order = ['Getting started', 'Tours', 'Settings', 'Memory', 'Productivity', 'AI Tools'];
|
const order = ['Getting started', 'Tours', 'Chats', 'Settings', 'Memory', 'Productivity', 'AI Tools'];
|
||||||
let lines = [];
|
let lines = [];
|
||||||
for (const cat of order) {
|
for (const cat of order) {
|
||||||
if (categories[cat] && categories[cat].length) {
|
if (categories[cat] && categories[cat].length) {
|
||||||
@@ -5365,7 +5365,7 @@ async function _cmdHelp(args, ctx) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
lines.push('Tip: /<command> --help for details');
|
lines.push('Tip: /<command> --help for details');
|
||||||
lines.push('Unix aliases: /rm /mv /cd /ls /cp /cat /man /stat /tar /mkdir /curl /df /fsck /bind /status');
|
lines.push('Shortcuts: /new /rename /fork /web /bash /memories /forget');
|
||||||
slashReply(`<pre style="line-height:1.7">${lines.join('\n')}</pre>`);
|
slashReply(`<pre style="line-height:1.7">${lines.join('\n')}</pre>`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -5373,29 +5373,28 @@ async function _cmdHelp(args, ctx) {
|
|||||||
// ── Command registry ──────────────────────────────────────────────
|
// ── Command registry ──────────────────────────────────────────────
|
||||||
// Each top-level key is a command group. Flat commands have a handler
|
// Each top-level key is a command group. Flat commands have a handler
|
||||||
// directly; grouped commands use `subs`. `default` is the sub run
|
// directly; grouped commands use `subs`. `default` is the sub run
|
||||||
// when the command is invoked bare (e.g. `/session` -> list).
|
// when the command is invoked bare (e.g. `/chats` -> info).
|
||||||
|
|
||||||
const COMMANDS = {
|
const COMMANDS = {
|
||||||
session: {
|
chats: {
|
||||||
alias: ['s'],
|
alias: ['chat', 'session', 'sessions', 's'],
|
||||||
category: 'Session',
|
category: 'Chats',
|
||||||
hidden: true,
|
|
||||||
help: 'Manage chat sessions',
|
help: 'Manage chat sessions',
|
||||||
default: 'info',
|
default: 'info',
|
||||||
subs: {
|
subs: {
|
||||||
'new': { handler: _cmdSessionNew, alias: ['create','mkdir'], help: 'Create new session', usage: '/session new [name]' },
|
'new': { handler: _cmdSessionNew, alias: ['create','mkdir'], help: 'Create new chat', usage: '/chats new [name]' },
|
||||||
'delete': { handler: _cmdSessionDelete, alias: ['del','rm'], help: 'Delete session', usage: '/session delete [id]' },
|
'delete': { handler: _cmdSessionDelete, alias: ['del','rm'], help: 'Delete chat', usage: '/chats delete [id]' },
|
||||||
'archive': { handler: _cmdSessionArchive, alias: ['tar'], help: 'Archive session', usage: '/session archive [id]' },
|
'archive': { handler: _cmdSessionArchive, alias: ['tar'], help: 'Archive chat', usage: '/chats archive [id]' },
|
||||||
'rename': { handler: _cmdSessionRename, alias: ['mv'], help: 'Rename current session', usage: '/session rename Name' },
|
'rename': { handler: _cmdSessionRename, alias: ['mv'], help: 'Rename current chat', usage: '/chats rename Name' },
|
||||||
'important': { handler: _cmdSessionImportant, alias: ['star'], help: 'Mark as important', usage: '/session important' },
|
'important': { handler: _cmdSessionImportant, alias: ['pin'], help: 'Mark as important', usage: '/chats important' },
|
||||||
'unimportant': { handler: _cmdSessionUnimportant, alias: ['unstar'], help: 'Unmark important', usage: '/session unimportant' },
|
'unimportant': { handler: _cmdSessionUnimportant, alias: ['unpin'], help: 'Unmark important', usage: '/chats unimportant' },
|
||||||
'fork': { handler: _cmdSessionFork, alias: ['cp'], help: 'Fork session (keep first N msgs)', usage: '/session fork [N]' },
|
'fork': { handler: _cmdSessionFork, alias: ['cp'], help: 'Fork chat (keep first N msgs)', usage: '/chats fork [N]' },
|
||||||
'truncate': { handler: _cmdSessionTruncate, alias: [], help: 'Delete older messages, keep last N', usage: '/session truncate N' },
|
'truncate': { handler: _cmdSessionTruncate, alias: [], help: 'Delete older messages, keep last N', usage: '/chats truncate N' },
|
||||||
'switch': { handler: _cmdSessionSwitch, alias: ['goto','cd'], help: 'Switch to session by name/id', usage: '/session switch name' },
|
'switch': { handler: _cmdSessionSwitch, alias: ['goto','cd'], help: 'Switch to chat by name/id', usage: '/chats switch name' },
|
||||||
'sort': { handler: _cmdSessionSort, alias: [], help: 'Auto-sort into folders', usage: '/session sort' },
|
'sort': { handler: _cmdSessionSort, alias: [], help: 'Auto-sort into folders', usage: '/chats sort' },
|
||||||
'info': { handler: _cmdSessionInfo, alias: ['stat'], help: 'Show session details', usage: '/session info' },
|
'info': { handler: _cmdSessionInfo, alias: ['stat'], help: 'Show chat details', usage: '/chats info' },
|
||||||
'clear': { handler: _cmdSessionClear, alias: [], help: 'Clear chat display', usage: '/session clear' },
|
'clear': { handler: _cmdSessionClear, alias: [], help: 'Clear chat display', usage: '/chats clear' },
|
||||||
'export': { handler: _cmdSessionExport, alias: ['cat'], help: 'Download as markdown', usage: '/session export' }
|
'export': { handler: _cmdSessionExport, alias: ['cat'], help: 'Download as markdown', usage: '/chats export' }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
toggle: {
|
toggle: {
|
||||||
@@ -5621,14 +5620,6 @@ const COMMANDS = {
|
|||||||
handler: _cmdCompact,
|
handler: _cmdCompact,
|
||||||
usage: '/compact'
|
usage: '/compact'
|
||||||
},
|
},
|
||||||
tts: {
|
|
||||||
alias: ['speak'],
|
|
||||||
category: 'Utility',
|
|
||||||
hidden: true,
|
|
||||||
help: 'Text-to-speech',
|
|
||||||
handler: _cmdTts,
|
|
||||||
usage: '/tts text'
|
|
||||||
},
|
|
||||||
sh: {
|
sh: {
|
||||||
alias: ['exec', 'run', 'shell'],
|
alias: ['exec', 'run', 'shell'],
|
||||||
category: 'Utility',
|
category: 'Utility',
|
||||||
@@ -5680,25 +5671,25 @@ const COMMANDS = {
|
|||||||
// Maps old flat command names to { parent, sub } so `/new` still works.
|
// Maps old flat command names to { parent, sub } so `/new` still works.
|
||||||
|
|
||||||
export const LEGACY_ALIASES = {
|
export const LEGACY_ALIASES = {
|
||||||
'new': { parent: 'session', sub: 'new' },
|
'new': { parent: 'chats', sub: 'new' },
|
||||||
'create': { parent: 'session', sub: 'new' },
|
'create': { parent: 'chats', sub: 'new' },
|
||||||
'delete': { parent: 'session', sub: 'delete' },
|
'delete': { parent: 'chats', sub: 'delete' },
|
||||||
'del': { parent: 'session', sub: 'delete' },
|
'del': { parent: 'chats', sub: 'delete' },
|
||||||
'archive': { parent: 'session', sub: 'archive' },
|
'archive': { parent: 'chats', sub: 'archive' },
|
||||||
'rename': { parent: 'session', sub: 'rename' },
|
'rename': { parent: 'chats', sub: 'rename' },
|
||||||
'important': { parent: 'session', sub: 'important' },
|
'important': { parent: 'chats', sub: 'important' },
|
||||||
'star': { parent: 'session', sub: 'important' },
|
'star': { parent: 'chats', sub: 'important' },
|
||||||
'unimportant': { parent: 'session', sub: 'unimportant' },
|
'unimportant': { parent: 'chats', sub: 'unimportant' },
|
||||||
'unstar': { parent: 'session', sub: 'unimportant' },
|
'unstar': { parent: 'chats', sub: 'unimportant' },
|
||||||
'fork': { parent: 'session', sub: 'fork' },
|
'fork': { parent: 'chats', sub: 'fork' },
|
||||||
'truncate': { parent: 'session', sub: 'truncate' },
|
'truncate': { parent: 'chats', sub: 'truncate' },
|
||||||
'sessions': { parent: 'session', sub: 'info' },
|
'sessions': { parent: 'chats', sub: 'info' },
|
||||||
'switch': { parent: 'session', sub: 'switch' },
|
'switch': { parent: 'chats', sub: 'switch' },
|
||||||
'goto': { parent: 'session', sub: 'switch' },
|
'goto': { parent: 'chats', sub: 'switch' },
|
||||||
'sort': { parent: 'session', sub: 'sort' },
|
'sort': { parent: 'chats', sub: 'sort' },
|
||||||
'info': { parent: 'session', sub: 'info' },
|
'info': { parent: 'chats', sub: 'info' },
|
||||||
'clear': { parent: 'session', sub: 'clear' },
|
'clear': { parent: 'chats', sub: 'clear' },
|
||||||
'export': { parent: 'session', sub: 'export' },
|
'export': { parent: 'chats', sub: 'export' },
|
||||||
'web': { parent: 'toggle', sub: 'web' },
|
'web': { parent: 'toggle', sub: 'web' },
|
||||||
'bash': { parent: 'toggle', sub: 'bash' },
|
'bash': { parent: 'toggle', sub: 'bash' },
|
||||||
'research': { parent: 'toggle', sub: 'research' },
|
'research': { parent: 'toggle', sub: 'research' },
|
||||||
@@ -5707,14 +5698,14 @@ export const LEGACY_ALIASES = {
|
|||||||
'memories': { parent: 'memory', sub: 'list' },
|
'memories': { parent: 'memory', sub: 'list' },
|
||||||
'forget': { parent: 'memory', sub: 'delete' },
|
'forget': { parent: 'memory', sub: 'delete' },
|
||||||
// Linux-style aliases
|
// Linux-style aliases
|
||||||
'rm': { parent: 'session', sub: 'delete' },
|
'rm': { parent: 'chats', sub: 'delete' },
|
||||||
'mv': { parent: 'session', sub: 'rename' },
|
'mv': { parent: 'chats', sub: 'rename' },
|
||||||
'cd': { parent: 'session', sub: 'switch' },
|
'cd': { parent: 'chats', sub: 'switch' },
|
||||||
'cp': { parent: 'session', sub: 'fork' },
|
'cp': { parent: 'chats', sub: 'fork' },
|
||||||
'cat': { parent: 'session', sub: 'export' },
|
'cat': { parent: 'chats', sub: 'export' },
|
||||||
'stat': { parent: 'session', sub: 'info' },
|
'stat': { parent: 'chats', sub: 'info' },
|
||||||
'tar': { parent: 'session', sub: 'archive' },
|
'tar': { parent: 'chats', sub: 'archive' },
|
||||||
'mkdir': { parent: 'session', sub: 'new' },
|
'mkdir': { parent: 'chats', sub: 'new' },
|
||||||
'status': { parent: 'toggle', sub: '_show' }
|
'status': { parent: 'toggle', sub: '_show' }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -2747,7 +2747,7 @@ body.bg-pattern-sparkles {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
width: 30px;
|
width: 30px;
|
||||||
height: 24px;
|
height: 24px;
|
||||||
margin: -5px -4px -5px 4px;
|
margin: -5px -6px -5px 6px;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
border: none;
|
border: none;
|
||||||
background: none;
|
background: none;
|
||||||
@@ -2799,7 +2799,7 @@ body.bg-pattern-sparkles {
|
|||||||
.model-picker-list .mp-fav-dot {
|
.model-picker-list .mp-fav-dot {
|
||||||
width: 30px;
|
width: 30px;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
margin: -7px -4px -7px 4px;
|
margin: -7px -6px -7px 6px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Overflow "+" menu */
|
/* Overflow "+" menu */
|
||||||
|
|||||||
Reference in New Issue
Block a user