From 4c279d2a19dc69cedc17452a9f9e08398da5433b Mon Sep 17 00:00:00 2001 From: "Rodrigo Rodriguez (Pragmatismo)" Date: Mon, 3 Nov 2025 13:38:55 -0300 Subject: [PATCH] feat: optimize suggestions and LLM server configuration - Added duplicate filtering for suggestions in both backend (Rust) and frontend (JavaScript) - Changed announcement summary schedule from every 15 minutes to hourly at :37 - Simplified LLM prompt for document summarization - Updated LLM server configuration with reduced GPU layers and increased context size - Removed memory mapping and lock settings for LLM server - Improved HTML formatting and added missing newline at EOF --- src/bot/mod.rs | 3 +++ .../announcements.gbdialog/update-summary.bas | 4 ++-- templates/default.gbai/default.gbot/config.csv | 13 +++++++------ web/html/index.html | 9 +++++++-- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/bot/mod.rs b/src/bot/mod.rs index 1ff35d08..6bc3cd8a 100644 --- a/src/bot/mod.rs +++ b/src/bot/mod.rs @@ -676,9 +676,12 @@ impl BotOrchestrator { .query_async(&mut conn) .await?; + // Filter out duplicate suggestions + let mut seen = std::collections::HashSet::new(); suggestions .into_iter() .filter_map(|s| serde_json::from_str::(&s).ok()) + .filter(|s| seen.insert((s.text.clone(), s.context.clone()))) .collect() } else { Vec::new() diff --git a/templates/announcements.gbai/announcements.gbdialog/update-summary.bas b/templates/announcements.gbai/announcements.gbdialog/update-summary.bas index b70a4f38..d4b2a89d 100644 --- a/templates/announcements.gbai/announcements.gbdialog/update-summary.bas +++ b/templates/announcements.gbai/announcements.gbdialog/update-summary.bas @@ -1,7 +1,7 @@ -SET_SCHEDULE "*/15 * * * *" +SET_SCHEDULE "37 * * * *" let text = GET "announcements.gbkb/news/news.pdf" -let resume = LLM "Resume this document: " + text +let resume = LLM "In a short phrase, resume this: " + text SET_BOT_MEMORY "resume", resume diff --git a/templates/default.gbai/default.gbot/config.csv b/templates/default.gbai/default.gbot/config.csv index 63024780..deb99347 100644 --- a/templates/default.gbai/default.gbot/config.csv +++ b/templates/default.gbai/default.gbot/config.csv @@ -15,13 +15,14 @@ llm-server,false llm-server-path,botserver-stack/bin/llm/build/bin llm-server-host,0.0.0.0 llm-server-port,8081 -llm-server-gpu-layers,35 -llm-server-n-moe,23 -llm-server-ctx-size,512 -llm-server-parallel,8 +llm-server-gpu-layers,0 +llm-server-n-moe,0 +llm-server-ctx-size,2048 +llm-server-parallel,2 llm-server-cont-batching,true -llm-server-mlock,true -llm-server-no-mmap,true +llm-server-mlock,false +llm-server-no-mmap,false + email-from,from@domain.com email-server,mail.domain.com diff --git a/web/html/index.html b/web/html/index.html index 7e044fa0..0b3f63c7 100644 --- a/web/html/index.html +++ b/web/html/index.html @@ -1734,7 +1734,12 @@ // Clear existing suggestions before adding new ones container.innerHTML = ''; - suggestions.forEach(s => { + // Filter out duplicate suggestions + const uniqueSuggestions = suggestions.filter((s, index, self) => + index === self.findIndex(t => t.text === s.text && t.context === s.context) + ); + + uniqueSuggestions.forEach(s => { const btn = document.createElement('button'); btn.textContent = s.text; btn.className = 'suggestion-button'; @@ -2015,4 +2020,4 @@ }); - \ No newline at end of file +