@@ -463,15 +463,13 @@ useEffect(() => {
463463 const fetchData = async () => {
464464 const token = localStorage .getItem (" access" );
465465 if (token) {
466- // Pobierz aktywny algorytm użytkownika
467466 const settingsResponse = await axios .get (
468467 ` ${ config .apiUrl } /api/recommendation-settings/` ,
469468 { headers: { Authorization: ` Bearer ${ token} ` } },
470469 );
471470 const algorithm =
472471 settingsResponse .data .active_algorithm || " collaborative" ;
473472
474- // Pobierz rekomendacje dla algorytmu
475473 const response = await axios .get (
476474 ` ${ config .apiUrl } /api/recommendation-preview/?algorithm=${ algorithm} ` ,
477475 { headers: { Authorization: ` Bearer ${ token} ` } },
@@ -490,12 +488,10 @@ useEffect(() => {
490488const fetchingAlgorithm = algorithmRequest .then ((response ) => {
491489 const algorithm = response .data .active_algorithm || " collaborative" ;
492490
493- // Ustaw tytuł sekcji rekomendacji
494491 if (algorithm === " collaborative" ) {
495492 setRecommendationTitle (" Recommended For You (Collaborative Filtering)" );
496493 }
497494
498- // Pobierz rekomendacje
499495 return axios .get (
500496 ` ${ config .apiUrl } /api/recommendation-preview/?algorithm=${ algorithm} ` ,
501497 { headers: { Authorization: ` Bearer ${ token} ` } },
@@ -1825,14 +1821,11 @@ def get(self, request):
18251821const fetchRecommendations = async () => {
18261822 setRecommendationsLoading (true );
18271823 try {
1828- // Zbierz ID produktów z koszyka
18291824 const productIds = Object .keys (items).filter ((id ) => items[id] > 0 );
18301825
1831- // Zbuduj query params
18321826 const params = new URLSearchParams ();
18331827 productIds .forEach ((id ) => params .append (" product_ids[]" , id));
18341828
1835- // Pobierz rekomendacje Apriori
18361829 const response = await axios .get (
18371830 ` ${ config .apiUrl } /api/frequently-bought-together/?${ params .toString ()} ` ,
18381831 );
@@ -1845,7 +1838,6 @@ const fetchRecommendations = async () => {
18451838 }
18461839};
18471840
1848- // Wywoływane przy każdej zmianie koszyka
18491841useEffect (() => {
18501842 if (Object .keys (items).length > 0 ) {
18511843 fetchRecommendations ();
@@ -1994,13 +1986,11 @@ const fetchAssociationDebug = async (productId) => {
19941986** Endpoint: ** ` GET /api/recommendation-preview/?algorithm={algorithm}`
19951987
19961988` ` ` jsx
1997- // Pobierz aktywny algorytm
19981989const settingsResponse = await axios.get(
19991990 ` ${config .apiUrl }/ api/ recommendation- settings/ ` ,
20001991);
20011992const algorithm = settingsResponse.data.active_algorithm || "collaborative";
20021993
2003- // Pobierz rekomendacje
20041994const response = await axios.get(
20051995 ` ${config .apiUrl }/ api/ recommendation- preview/ ? algorithm= ${algorithm}` ,
20061996);
@@ -2015,7 +2005,6 @@ const response = await axios.get(
20152005** Sekcja: ** " Recommended For You"
20162006
20172007` ` ` jsx
2018- // Tytuł zmienia się zależnie od algorytmu
20192008if (algorithm === "collaborative") {
20202009 setRecommendationTitle("Recommended For You (Collaborative Filtering)");
20212010} else if (algorithm === "content_based") {
@@ -2036,7 +2025,6 @@ if (algorithm === "collaborative") {
20362025** Endpoint: ** ` GET /api/frequently-bought-together/?product_ids[]={ids}`
20372026
20382027` ` ` jsx
2039- // Wyświetlanie metryk
20402028<span className="stat-confidence">
20412029 Confidence: {(rec.confidence * 100).toFixed(0)}%
20422030</span>
0 commit comments