8cebb4f4e9
- unified_search: Hybride Suche (PostgreSQL FTS + pgvector + RRF Fusion) - 5 Search Providers (Contact, Company, Mail, File, Event) - KI Query Understanding (Fuzzy, Facetten via LiteLLM) - DMS Text-Extraction (PDF, DOCX, XLSX, PPTX) - Embedding Pipeline (ollama/nomic-embed-text, 768 Dim) - Background Jobs für Indexierung - Plugin-basierte Provider Registry - ai_proactive: Proaktiver KI-Agent - Context-Tracking (Frontend → Backend → Event Bus) - Proactive Engine mit LLM Suggestion-Generierung - SSE Real-time Push an Frontend - 6 AI Tools für Tool Registry - Rate-Limiting + User Settings - Deep Analysis Background Jobs - Frontend Integration: - useAIContext Hook, SuggestionSidebar, SuggestionBadge - ProactiveAISettings Page, Search API Client - Globale Suche auf neue API umgestellt - Tests: test_unified_search.py + test_ai_proactive.py (alle bestanden) - Config: Ollama Cloud DeepSeek V4 als Default, konfigurierbar - Dependencies: PyMuPDF, python-docx, python-pptx, pgvector - Bugfixes: notification type_key length, migration IF NOT EXISTS
25 lines
880 B
TypeScript
25 lines
880 B
TypeScript
import { useEffect, useRef } from 'react';
|
|
import { useLocation } from 'react-router-dom';
|
|
import { apiClient } from '@/api/client';
|
|
|
|
export function useAIContext(entityType?: string, entityId?: string, entityData?: any) {
|
|
const location = useLocation();
|
|
const debounceRef = useRef<ReturnType<typeof setTimeout>>();
|
|
|
|
useEffect(() => {
|
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
debounceRef.current = setTimeout(() => {
|
|
apiClient.post('/api/v1/ai-proactive/context', {
|
|
page: location.pathname,
|
|
entity_type: entityType,
|
|
entity_id: entityId,
|
|
entity_data: entityData,
|
|
}).catch(() => {}); // Silent fail, don't bother user
|
|
}, 500); // Debounce 500ms
|
|
|
|
return () => {
|
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
};
|
|
}, [location.pathname, entityType, entityId, entityData]);
|
|
}
|