diff --git a/AGENTS.md b/AGENTS.md index 23d712e0..b3f500fc 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -54,6 +54,12 @@ See botserver/src/drive/local_file_monitor.rs to see how bots are loaded from Mi - **Env file:** `botserver/.env` - **UI Files:** `botui/ui/suite/` +### BotUI Development Mode +**IMPORTANT:** BotUI serves static HTML/JS/CSS files directly from `botui/ui/` - **NO recompilation needed** for frontend changes. +- Changes to `.html`, `.js`, `.css` files in `botui/ui/` take effect immediately on page refresh +- Only Rust code changes in `botui/src/` require rebuild with `cargo build -p botui` +- This is "gate desligada" (gate off) mode - static assets served directly from filesystem + --- ## 🏗️ System Architecture Overview diff --git a/botserver/src/auto_task/app_generator.rs b/botserver/src/auto_task/app_generator.rs index 0b3fa3b3..b9238dea 100644 --- a/botserver/src/auto_task/app_generator.rs +++ b/botserver/src/auto_task/app_generator.rs @@ -3465,31 +3465,38 @@ async fn write_to_drive( const sendBtn = panel.querySelector('.designer-input button'); const messages = panel.querySelector('.designer-messages'); - async function sendMessage() {{ - const msg = input.value.trim(); - if (!msg) return; +function escapeHtml(str) {{ + if (!str) return ''; + const div = document.createElement('div'); + div.textContent = str; + return div.innerHTML; +}} - messages.innerHTML += `
${{msg}}
`; - input.value = ''; - messages.scrollTop = messages.scrollHeight; +async function sendMessage() {{ + const msg = input.value.trim(); + if (!msg) return; - try {{ - const res = await fetch('/api/designer/modify', {{ - method: 'POST', - headers: {{ 'Content-Type': 'application/json' }}, - body: JSON.stringify({{ app_name: APP_NAME, current_page: currentPage, message: msg }}) - }}); - const data = await res.json(); - messages.innerHTML += `
${{data.message || 'Done!'}}
`; - if (data.success && data.changes && data.changes.length > 0) {{ - setTimeout(() => location.reload(), 1500); - }} - }} catch (e) {{ - messages.innerHTML += `
Sorry, something went wrong. Try again.
`; - if (window.AppLogger) window.AppLogger.error('Designer error', e.toString()); + messages.innerHTML += `
${{escapeHtml(msg)}}
`; + input.value = ''; + messages.scrollTop = messages.scrollHeight; + + try {{ + const res = await fetch('/api/designer/modify', {{ + method: 'POST', + headers: {{ 'Content-Type': 'application/json' }}, + body: JSON.stringify({{ app_name: APP_NAME, current_page: currentPage, message: msg }}) + }}); + const data = await res.json(); + messages.innerHTML += `
${{escapeHtml(data.message || 'Done!')}}
`; + if (data.success && data.changes && data.changes.length > 0) {{ + setTimeout(() => location.reload(), 1500); }} - messages.scrollTop = messages.scrollHeight; + }} catch (e) {{ + messages.innerHTML += `
Sorry, something went wrong. Try again.
`; + if (window.AppLogger) window.AppLogger.error('Designer error', e.toString()); }} + messages.scrollTop = messages.scrollHeight; +}} sendBtn.onclick = sendMessage; input.onkeypress = (e) => {{ if (e.key === 'Enter') sendMessage(); }}; diff --git a/botserver/src/core/bot/mod.rs b/botserver/src/core/bot/mod.rs index 2d9059af..235bae4a 100644 --- a/botserver/src/core/bot/mod.rs +++ b/botserver/src/core/bot/mod.rs @@ -715,9 +715,9 @@ pub async fn stream_response( .or_else(|_| std::fs::read_to_string(format!("{}PROMPT.txt", gbot_dir))) .or_else(|_| std::fs::read_to_string(format!("{}prompt.txt", gbot_dir))) .unwrap_or_else(|_| { - config_manager - .get_config(&session.bot_id, "system-prompt", Some("You are a helpful assistant with access to tools that can help you complete tasks. When a user's request matches one of your available tools, use the appropriate tool instead of providing a generic response.")) - .unwrap_or_else(|_| "You are a helpful General Bots assistant.".to_string()) + config_manager + .get_config(&session.bot_id, "system-prompt", Some("You are a helpful assistant with access to tools that can help you complete tasks. When a user's request matches one of your available tools, use the appropriate tool instead of providing a generic response.\n\nResponda APENAS com fragmentos HTML válidos. Não use markdown. Não use blocos de código (``` ou `). Não escreva prosa fora de tags HTML. Não inclua , , ou . Use apenas:

,

,