This commit is contained in:
2025-12-10 15:50:11 +00:00
parent 50b9888004
commit 4e8b60f77c
12 changed files with 247 additions and 106 deletions

View File

@@ -204,6 +204,31 @@ app.get('/api/ollama/config', async (req, res) => {
}
});
app.get('/api/search', async (req, res) => {
try {
const { q, limit, category } = req.query;
const response = await axios.get(`${API_URL}/api/search`, {
params: { q, limit, category }
});
res.json(response.data);
} catch (error) {
if (error.response) {
// The request was made and the server responded with a status code
// that falls out of the range of 2xx
console.error('Search API Error:', error.response.status, error.response.data);
res.status(error.response.status).json(error.response.data);
} else if (error.request) {
// The request was made but no response was received
console.error('Search API No Response:', error.request);
res.status(502).json({ error: 'Search service unavailable (timeout/connection)' });
} else {
// Something happened in setting up the request that triggered an Error
console.error('Search API Request Error:', error.message);
res.status(500).json({ error: 'Internal proxy error' });
}
}
});
app.listen(PORT, () => {
console.log(`Frontend server running on http://localhost:${PORT}`);
console.log(`Admin dashboard: http://localhost:${PORT}/admin.html`);