๊ฐ•๋ฏผ๊ท 
Fix: Remove embedded git from web folder
b46ff5d
import axios from 'axios';
const API_BASE_URL = import.meta.env.VITE_API_URL || "http://localhost:8080";
const api = axios.create({
baseURL: API_BASE_URL,
headers: {
'Content-Type': 'application/json',
},
});
export const healthCheck = async () => {
try {
const res = await api.get('/');
return res.data;
} catch (error) {
console.error("Health check failed:", error);
return null;
}
};
// ์ „์ฒด ๋ ˆ์‹œํ”ผ ๋ชฉ๋ก ์กฐํšŒ (ํŽ˜์ด์ง€๋„ค์ด์…˜)
export const listRecipes = async (limit = 50, offset = 0) => {
try {
const res = await api.get('/recipes', { params: { limit, offset } });
return res.data;
} catch (error) {
console.error("List recipes failed:", error);
return { total: 0, recipes: [] };
}
};
export const searchRecipes = async (query) => {
try {
const res = await api.get('/recipes/search', { params: { q: query } });
return res.data;
} catch (error) {
console.error("Recipe search failed:", error);
return [];
}
};
export const getRecipeDetail = async (id) => {
try {
const res = await api.get(`/recipes/${id}`);
return res.data;
} catch (error) {
console.error("Get recipe detail failed:", error);
return null;
}
};
// ๋‹จ์ผ ์žฌ๋ฃŒ ๋Œ€์ฒด ์ถ”์ฒœ
export const recommendDbSingle = async (recipeId, target, w2v = 0.5, d2v = 0.5, method = 0.0, cat = 0.0) => {
try {
const res = await api.post('/recommend/db/single', {
recipe_id: recipeId,
target: [target],
stopwords: [],
w_w2v: w2v,
w_d2v: d2v,
w_method: method,
w_cat: cat
});
return res.data;
} catch (error) {
console.error("DB Single Rec failed:", error);
return [];
}
};
// ๋‹ค์ค‘ ์žฌ๋ฃŒ ๋Œ€์ฒด ์ถ”์ฒœ
export const recommendDbMulti = async (recipeId, targets, w2v = 0.5, d2v = 0.5, method = 0.0, cat = 0.0) => {
try {
const res = await api.post('/recommend/db/multi', {
recipe_id: recipeId,
target: targets,
stopwords: [],
w_w2v: w2v,
w_d2v: d2v,
w_method: method,
w_cat: cat
});
return res.data;
} catch (error) {
console.error("DB Multi Rec failed:", error);
return [];
}
};
// Custom recommendation (์‚ฌ์šฉ์ž ์ •์˜ ์žฌ๋ฃŒ)
export const recommendCustomSingle = async (target, contextIngs) => {
try {
const res = await api.post('/recommend/custom/single', {
context_ings: contextIngs,
target: [target],
stopwords: [],
excluded: []
});
return res.data;
} catch (error) {
return [];
}
};
export default api;