feat(chat): implement adaptive timeout and enhanced search functionality
- Introduced adaptive timeout logic for web searches and chat streaming, improving responsiveness and efficiency. - Updated `smartSearchRag` method to support timeout adjustments based on search rounds. - Enhanced `executeProgressiveSearch` to utilize adaptive timeouts and improve search result handling. - Added new utility functions for calculating adaptive timeouts based on rounds and attempts. - Integrated event listeners for chat session management, improving user experience during chat interactions. - Refactored chat message handling to accommodate new streaming and timeout features.
This commit is contained in:
1 parent
f2e8a1b933
commit
8c546f6474
13 files changed
+1547
-271
No files matched your search
+6
-2
@@ -397,8 +397,9 @@ export default function ChatPage() {
|
||||
// Executar busca progressiva com semantic search se disponível
|
||||
const fallbackResult = await executeProgressiveSearch(
|
||||
query,
|
||||
async (q, limit) => {
|
||||
return await webSearch.smartSearchRag(q, limit);
|
||||
async (q, limit, round = 1) => {
|
||||
// Passar round para timeout adaptativo
|
||||
return await webSearch.smartSearchRag(q, limit, undefined, undefined, round);
|
||||
},
|
||||
selectedModel,
|
||||
{
|
||||
@@ -410,6 +411,9 @@ export default function ChatPage() {
|
||||
useSemanticSearch: !!enrichedQueries, // Usar semantic search se temos queries enriquecidas
|
||||
context: context || undefined,
|
||||
enrichedQueries: enrichedQueries || undefined,
|
||||
initialTimeout: settings.webSearch.timeout || 10000, // Usar timeout das configurações
|
||||
maxTimeoutPerQuery: 25000, // 25s máximo por query
|
||||
maxTimeoutPerRound: 15000, // 15s máximo por round
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in new issue
Block a user