diff --git a/AGENTS.md b/AGENTS.md index 5b5e3c33..263266a0 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -17,7 +17,7 @@ I AM IN DEV ENV, but sometimes, pasting from PROD, do not treat my env as prod! > - ❌ **NEVER** write internal IPs to logs or output > - When debugging network issues, mask IPs (e.g., "10.x.x.x" instead of "10.16.164.222") > - Use hostnames instead of IPs in configs and documentation -See botserver/src/drive/local_file_monitor.rs to see how to load from /opt/gbo/data the list of development bots. +See botserver/src/drive/local_file_monitor.rs to see how bots are loaded from the drive (MinIO storage). - ❌ **NEVER** use `cargo clean` - causes 30min rebuilds, use `./reset.sh` for database issues > @@ -72,8 +72,8 @@ User Message (WebSocket) │ ▼ ┌─────────────────────────────────┐ -│ 2. start.bas Execution │ /opt/gbo/data/{bot}.gbai/... -│ - Runs ONCE per session │ {bot}.gbdialog/start.bas +│ 2. start.bas Execution │ Drive (MinIO) storage +│ - Runs ONCE per session │ {bot}.gbdialog/start.bas │ - ADD_SUGGESTION calls │ Adds button suggestions │ - Sets Redis flag │ prevents re-run └──────────────┬──────────────────┘ @@ -179,7 +179,7 @@ END TABLE ### {tool}.bas - Tool Scripts -**Location:** `/opt/gbo/data/{bot}.gbai/{bot}.gbdialog/{tool}.bas` +**Location:** Drive storage: `{bot}.gbdialog/{tool}.bas` **Compiled to:** `{tool}.ast` (in memory or `/opt/gbo/work/`) **Execution:** Via `CALL "tool"` or TOOL_EXEC (type 6) @@ -437,9 +437,8 @@ END SWITCH ## 🧭 LLM Navigation Guide ### Reading This Workspace -/opt/gbo/data is a place also for bots. **For LLMs analyzing this codebase:** -0. Bots are in drive, each bucket is a bot. Respect LOAD_ONLY. +0. Bots are in drive (MinIO storage), each bucket is a bot. Respect LOAD_ONLY. 1. Start with **[Component Dependency Graph](../README.md#-component-dependency-graph)** in README to understand relationships 2. Review **[Module Responsibility Matrix](../README.md#-module-responsibility-matrix)** for what each module does 3. Study **[Data Flow Patterns](../README.md#-data-flow-patterns)** to understand execution flow @@ -898,7 +897,7 @@ curl -X POST http://localhost:9000/api/features \ -d '{"name": "test"}' # 4. Test via BASIC script -# Create test.bas in /opt/gbo/data/testbot.gbai/testbot.gbdialog/ +# Create test.bas in {bot}.gbdialog/ folder (drive storage) # NEW_FEATURE "test" # 5. Check logs @@ -1381,7 +1380,7 @@ Continue on gb/ workspace. Follow AGENTS.md strictly: - **Host OS:** Ubuntu LTS - **Container engine:** Incus (LXC-based) - **Base path:** `/opt/gbo/` (General Bots Operations) -- **Data path:** `/opt/gbo/data` — shared data, configs, bot definitions +- **Data path:** `/opt/gbo/data` — shared data, configs (bot definitions are in MinIO drive storage) - **Bin path:** `/opt/gbo/bin` — compiled binaries - **Conf path:** `/opt/gbo/conf` — service configurations - **Log path:** `/opt/gbo/logs` — application logs @@ -1390,7 +1389,7 @@ Continue on gb/ workspace. Follow AGENTS.md strictly: | Role | Service | Typical Port | Notes | |------|---------|-------------|-------| -| **dns** | CoreDNS | 53 | DNS resolution, zone files in `/opt/gbo/data` | +| **dns** | CoreDNS | 53 | DNS resolution, zone files in `/opt/gbo/conf/` | | **proxy** | Caddy | 80/443 | Reverse proxy, TLS termination | | **tables** | PostgreSQL | 5432 | Primary database | | **email** | Stalwart | 993/465/587 | Mail server (IMAPS, SMTPS, Submission) | diff --git a/PROMPT.md b/PROMPT.md new file mode 100644 index 00000000..f7c445eb --- /dev/null +++ b/PROMPT.md @@ -0,0 +1,53 @@ +# System Prompt — Bot Salesianos + +## IDENTIDADE E PROPÓSITO + +Você é o assistente virtual da Escola Salesiana. Sua missão é transmitir informações com clareza, profundidade e didática. +salesianos.br e apenas Brasil. Inspetoria São João Bosco. + +--- + +## REGRA MÁXIMA E ABSOLUTA PARA BUSCA DE DADOS (RAMAIS, NOMES, SETORES) + +VOCÊ DEVE OBEDECER ESTA REGRA ACIMA DE QUALQUER OUTRA: + +1. QUANDO O USUÁRIO PERGUNTAR POR UM RAMAL, NOME OU TELEFONE: + **VOCÊ ESTÁ PROIBIDO DE PEDIR MAIS INFORMAÇÕES OU CLARIFICAÇÕES.** + +2. Você deve olhar IMEDIATAMENTE para o contexto fornecido (Knowledge Base) e procurar QUALQUER correspondência com o nome ou setor solicitado. + +3. SE ENCONTRAR O NOME NOS DADOS FORNECIDOS (MESMO QUE SEJA PARCIAL): + **RESPONDA APENAS COM O NOME E O RAMAL ENCONTRADOS.** + Não diga que "não tem certeza", não peça "o nome completo", não peça "o setor". Apenas liste o que encontrou no contexto! + +Exemplo Obrigatório: +Se o usuário perguntar: "Qual o ramal do João?" +Você procura no contexto. Se encontrar "João Silva 123" e "João Souza 456". +Você RESPONDE EXATAMENTE ASSIM: +
+

Ramais Encontrados

+ +
+ +**NUNCA DIGA "Ainda não tenho um ramal confirmado". SE ESTÁ NO CONTEXTO, É O RAMAL CORRETO. APENAS MOSTRE-O.** + +--- + +## REGRAS DE OUTPUT (HTML PURO) + +1. **OUTPUT DIRETO — HTML PURO** — Não use ```, não use markdown, não use backticks! +2. **Comece com
e termine com
** +3. Não use marcações como ```html +4. **CONTRASTE DE CORES**: Fundo escuro exige texto #FFFFFF. Fundo claro exige texto escuro (#1A1A2E). + +--- + +## MENSAGEM FINAL OBRIGATÓRIA + +No final de cada resposta, coloque: +Você também pode me perguntar sobre:... e 3 opções curtas. + +**LEMBRE-SE: VOCÊ ESTÁ ESTRITAMENTE PROIBIDO DE PEDIR CLARIFICAÇÃO PARA RAMAIS. ENTREGUE O RESULTADO IMEDIATAMENTE BASEADO NO CONTEXTO!** diff --git a/botserver/src/core/bot/mod.rs b/botserver/src/core/bot/mod.rs index 35a6b1ae..24af19db 100644 --- a/botserver/src/core/bot/mod.rs +++ b/botserver/src/core/bot/mod.rs @@ -611,21 +611,24 @@ impl BotOrchestrator { .await?? }; - let system_prompt = if !message.active_switchers.is_empty() { - let switcher_prompts = resolve_active_switchers( - self.state.cache.as_ref(), - &session.bot_id.to_string(), - &session.id.to_string(), - &message.active_switchers, - ); - if switcher_prompts.is_empty() { - system_prompt - } else { - format!("{system_prompt}\n\n{switcher_prompts}") - } - } else { - system_prompt - }; +let system_prompt = if !message.active_switchers.is_empty() { + log::debug!("Switchers active: {:?}", message.active_switchers); + let switcher_prompts = resolve_active_switchers( + self.state.cache.as_ref(), + &session.bot_id.to_string(), + &session.id.to_string(), + &message.active_switchers, + ); + log::debug!("Switcher prompts: {}", switcher_prompts); + if switcher_prompts.is_empty() { + system_prompt + } else { + format!("{system_prompt}\n\n{switcher_prompts}") + } + } else { + log::debug!("No active switchers for this message"); + system_prompt + }; let mut messages = OpenAIClient::build_messages(&system_prompt, &context_data, &history);