feat(chat): implement speculative web search and embeddings commands

- Added speculative search functionality to enhance query processing by detecting when a web search may be needed based on user input patterns.
- Integrated commands for managing embeddings, including downloading models, checking availability, calculating relevance scores, generating embeddings, and pruning context.
- Optimized chat streaming by buffering tokens to reduce overhead and improve responsiveness.
- Implemented lazy initialization for the headless browser to conserve memory until needed.
- Enhanced web scraping capabilities with a static scraping method for faster content retrieval.
This commit is contained in:
Evandro Fonseca Junior committed 2025-11-27 21:19:16 -03:00
1 parent ba03131a78
commit e53e49c8f8
7 files changed
+1407 -40

No files matched your search

+5 -6
View File
@@ -85,14 +85,13 @@ pub async fn reload_scheduled_tasks(
return;
}
// Obter browser - precisa acessar via app_handle
// Obter browser - usando lazy initialization global
let browser_arc = {
// Criar browser diretamente se necessário
use crate::web_scraper::create_browser;
match create_browser() {
Ok(b) => Arc::new(b),
use crate::web_scraper::get_or_create_browser;
match get_or_create_browser() {
Ok(b) => b,
Err(e) => {
log::error!("Erro ao criar browser para task {}: {}", task_id, e);
log::error!("Erro ao obter browser para task {}: {}", task_id, e);
return;
}
}