diff options
| author | Agando <roduccomm@gmail.com> | 2026-06-24 06:01:05 +0200 |
|---|---|---|
| committer | Agando <roduccomm@gmail.com> | 2026-06-24 06:01:05 +0200 |
| commit | b08aa5b479395441462effed59ff1ee02d9d8c7f (patch) | |
| tree | 91ff8aeb294b38cc07a63b31b224164aa971cac6 /modules/core/module-aiassist.js | |
| parent | 168a7bc6d50023215f75fa8a0d95362473cfe033 (diff) | |
auto: 2026-06-24_06:01 changes
Diffstat (limited to 'modules/core/module-aiassist.js')
| -rw-r--r-- | modules/core/module-aiassist.js | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/modules/core/module-aiassist.js b/modules/core/module-aiassist.js index caf6d99..31f8665 100644 --- a/modules/core/module-aiassist.js +++ b/modules/core/module-aiassist.js @@ -80,7 +80,7 @@ buildSystemPrompt() { } catch (e) {} let base = `Current date: ${dateStr} (${dayStr}) ${timeStr}${nvfsNote}\n` + 'VFS→Modules→AI. nvfs-index for commands. Tool→Observe→Answer. nvfs-resolve. Destructive cmds need confirm.\n' - + 'FS: list/read/write/delete | NVFS: nvfs-resolve | Web: search/fetch [POST=method+body] | Mod: view/edit/test/reload | Config | Skills | VaultMind: vaultmind_connect(network) — connect wallet, vaultmind_status — check session, vaultmind_query(ep,msg,agent) — Hyperliquid prices/portfolio/chat | wallet_lookup(address) — read-only portfolio for any wallet\n' + + 'FS: list/read/write/delete | NVFS: nvfs-resolve | Web: search/fetch [POST=method+body] | Mod: view/edit/test/reload | Config | Skills | VaultMind: vaultmind_connect(network) — connect wallet, vaultmind_status — check session, vaultmind_query(ep,msg,agent) — Hyperliquid prices/portfolio/chat | wallet_lookup(address) — read-only portfolio for any wallet | get_usage_stats(model,provider,since_hours) — LLM token/latency stats\n' + 'web_fetch tool: GET for normal pages (returns title+content+word_count), POST for JSON APIs like Hyperliquid /info (pass method="POST" and body as JSON string).\n' + 'Other: floating, webdav, cron, vault, sandbox, agents, wpm, mindmap, memgraph, guardrail, wget, tar, secret-* — discoverable via help. ' + 'JS: node <file.js> executes JS from VFS (alias for js-run), node -e "expr" for inline eval. No real Node.js runtime — browser JS only.'; @@ -493,6 +493,21 @@ buildSystemPrompt() { required: ['address'] } } + }, { + type: 'function', + function: { + name: 'get_usage_stats', + description: 'Get LLM usage statistics: total requests, tokens, latency, per-model breakdown. Use this to report token consumption or latency to the user.', + parameters: { + type: 'object', + properties: { + model: { type: 'string', description: 'Filter by model name (optional)' }, + provider: { type: 'string', description: 'Filter by provider name (optional)' }, + since_hours: { type: 'number', description: 'Only last N hours (optional)' } + }, + required: [] + } + } }]; } getHelpInfo() { @@ -2077,6 +2092,16 @@ buildSystemPrompt() { return JSON.stringify({ error: 'Wallet lookup error: ' + e.message }); } } + case 'get_usage_stats': { + const om = this.terminal.ollamaManager; + if (!om) return JSON.stringify({ error: 'Ollama manager not available' }); + const filters = {}; + if (a.model) filters.model = a.model; + if (a.provider) filters.provider = a.provider; + if (a.since_hours) filters.since_hours = a.since_hours; + const stats = om.getUsageStats(filters); + return JSON.stringify({ success: true, stats }); + } default: return JSON.stringify({ error: `Unknown tool: ${name}` }); } |