diff options
| author | Agando <roduccomm@gmail.com> | 2026-06-18 18:00:54 +0200 |
|---|---|---|
| committer | Agando <roduccomm@gmail.com> | 2026-06-18 18:00:54 +0200 |
| commit | 0eca39021874a673933ebb82b973002b682e7a4b (patch) | |
| tree | dbfbb685e40d10e6255e68629b72194b23709854 /chat/chat-modules.js | |
| parent | fba6df22dae297c89fa0df065628dddded66c69c (diff) | |
auto: 2026-06-18_18:00 changes
Diffstat (limited to 'chat/chat-modules.js')
| -rw-r--r-- | chat/chat-modules.js | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/chat/chat-modules.js b/chat/chat-modules.js index 140e379..295c7c9 100644 --- a/chat/chat-modules.js +++ b/chat/chat-modules.js @@ -10,9 +10,9 @@ const DEFAULT_MODULES = [ id: 'default', name: 'AI Chat', desc: 'General purpose AI assistant', - prompt: 'You are a helpful AI assistant on WebX11. You have access to these tools:\n\n1. **Search:** /api/search?q=QUERY - Searches the web via DuckDuckGo. Returns HTML results. Use this for current events, facts, and web information.\n\n2. **Fetch:** /api/fetch?url=URL - Fetches content from any URL. Use this to read web pages, APIs, or documents.\n\n3. **Commands:** Users can type /help, /search [query], /fetch [url], /explain [code], /status, /clear directly.\n\nWhen a user asks about current events, recent info, or something you dont know, suggest they use /search or tell them to ask you to search the web. If they provide a URL, offer to fetch it.\n\nBe concise, helpful, and use the available tools when appropriate.', - help: 'Just type any question! I can help with:\n- Current events (I can search the web)\n- Web pages (I can fetch URLs)\n- Coding questions\n- General knowledge\n- Problem solving\n\nTry: /search latest news', - commands: '/help, /search, /fetch, /explain, /status, /clear' + prompt: 'You are a helpful AI assistant on WebX11 newOS4. Current date is injected dynamically. You have access to these tools:\n\n1. **Search:** /api/search?q=QUERY - Searches the web via DuckDuckGo/SearXNG. Returns results with titles, URLs, and snippets. Use this for current events, facts, and web information.\n2. **Fetch:** /api/fetch?url=URL - Fetches raw HTML from any URL. Use this to read web pages, APIs, or documents.\n3. **Extract:** /api/extract?url=URL - Extracts readable content (title, word count, excerpt, full text) from a URL. Prefer this over /fetch for reading articles.\n4. **Summarize:** /api/summarize?url=URL - AI summarization of a URL.\n\n**Tool-Use Rules:**\n- NEVER announce that you are about to use a tool (no "Hold on...", "Let me search...", "Fetching...", or waiting indicators). Just use the tool and present the result immediately.\n- If a /search returns generic/portal results (e.g., google.com homepages), automatically retry with a more specific query using site: operators or exact phrases in quotes.\n- If a user types a malformed command (e.g., /extraxt instead of /extract, /serch instead of /search), recognize their intent and suggest the correct command immediately: "Did you mean /extract [url]? Here are the available commands: /search, /fetch, /extract, /summarize"\n- When a user shares a URL, proactively suggest /extract or /fetch with the URL pre-filled.\n- Be concise. Deliver results, not commentary about the process.\n\n**Available slash commands:** /help, /search [query], /fetch [url], /extract [url], /summarize [url], /explain [code], /status, /models, /clear', + help: 'Just type any question! I can help with:\n- Current events (I can search the web)\n- Web pages (I can extract/fetch URLs)\n- Coding questions\n- General knowledge\n- Problem solving\n\nCommands: /search, /fetch, /extract, /summarize, /explain, /status, /clear\n\nTry: /search latest news', + commands: '/help, /search, /fetch, /extract, /summarize, /explain, /status, /models, /clear' }, { id: 'search', @@ -72,7 +72,8 @@ const DEFAULT_MODULES = [ } ]; -var modules = []; +// modules array lives on window.modules (set by _initLiteEngine in module-chatstudio.js) +// Do NOT redeclare here — just reference the global var currentModule = 'default'; var editingModuleId = null; @@ -266,14 +267,19 @@ function saveModule() { // === AI Module Generator === -async function generateModuleWithAI() { +async function generateModuleWithAI(evt) { + var e = evt || window.event; var desc = document.getElementById('aiModuleDesc').value.trim(); if (!desc) { showToast('Please describe what the module should do'); return; } - var btn = event.target; + var btn = e ? e.target : null; + if (!btn) { + var modal = document.getElementById('moduleModal'); + btn = modal ? modal.querySelector('button[onclick*="generateModule"]') : null; + } btn.disabled = true; btn.textContent = 'Generating...'; @@ -283,7 +289,7 @@ async function generateModuleWithAI() { headers['Authorization'] = 'Bearer ' + OLLAMA_API_KEY; } - var response = await fetch((typeof OLLAMA_URL !== 'undefined' ? OLLAMA_URL : '/ollama') + '/api/generate', { + var response = await _csFetch((typeof OLLAMA_URL !== 'undefined' ? OLLAMA_URL : '/ollama') + '/api/generate', { method: 'POST', headers: headers, body: JSON.stringify({ |