Spaces:
Paused
Paused
dushyantsingh0 commited on
Commit ·
39fa38f
1
Parent(s): 79a5f2f
backend stabilization
Browse files50 unmodified lines51525354555657585960616263646550 unmodified linesconst fetchSuggestions = async () => {setKbLoading(true);try {if (activeTickets.length > 0) {// Perform contextual search based on latest ticketconst res = await api.get('kb/search/', { params: { q: activeTickets[0].title } });setSuggestedArticles(res.data.results || []);} else {// Fallback to top recent articlesconst res = await api.get('kb/');setSuggestedArticles(res.data.slice(0, 4));}} catch (err) {console.error("Failed to fetch KB suggestions:", err);} finally {50 unmodified lines5152535455565758596061626364656667686970717250 unmodified linesconst fetchSuggestions = async () => {setKbLoading(true);try {let results = [];if (activeTickets.length > 0) {// Perform richer contextual search based on latest ticket title + descriptionconst latestTicket = activeTickets[0];const query = `${latestTicket.title} ${latestTicket.description || ''}`.trim();const res = await api.get('kb/search/', { params: { q: query } });results = res.data.results || [];}// Fallback to top recent articles if search yielded nothing or no active ticketsif (results.length === 0) {const res = await api.get('kb/');results = res.data.slice(0, 4);}setSuggestedArticles(results);} catch (err) {console.error("Failed to fetch KB suggestions:", err);} finally {
frontend/apps/customer/src/components/Dashboard.tsx+13-6