AI tweaks/fixes + backend api interface updates

This commit is contained in:
2026-01-24 11:58:21 -05:00
parent 1866cbae7e
commit 3831cef234
24 changed files with 458 additions and 252 deletions

View File

@@ -6,6 +6,7 @@ const corsMiddleware = cors({
'https://inventory.kent.pw',
'http://localhost:5175',
'https://acot.site',
'https://acob.acherryontop.com',
/^http:\/\/192\.168\.\d+\.\d+(:\d+)?$/,
/^http:\/\/10\.\d+\.\d+\.\d+(:\d+)?$/
],
@@ -27,7 +28,7 @@ const corsErrorHandler = (err, req, res, next) => {
res.status(403).json({
error: 'CORS not allowed',
origin: req.get('Origin'),
message: 'Origin not in allowed list: https://inventory.kent.pw, https://acot.site, localhost:5175, 192.168.x.x, or 10.x.x.x'
message: 'Origin not in allowed list: https://inventory.kent.pw, https://acot.site, https://acob.acherryontop.com, localhost:5175, 192.168.x.x, or 10.x.x.x'
});
} else {
next(err);

View File

@@ -635,7 +635,7 @@ router.post('/upload-image', upload.single('image'), async (req, res) => {
// Create URL for the uploaded file - using an absolute URL with domain
// This will generate a URL like: https://acot.site/uploads/products/filename.jpg
const baseUrl = 'https://acot.site';
const baseUrl = 'https://acob.acherryontop.com';
const imageUrl = `${baseUrl}/uploads/products/${req.file.filename}`;
// Schedule this image for deletion in 24 hours
@@ -715,6 +715,26 @@ router.delete('/delete-image', (req, res) => {
}
});
// Clear all taxonomy caches
router.post('/clear-taxonomy-cache', (req, res) => {
try {
// Clear all entries from the query cache
const cacheSize = connectionCache.queryCache.size;
connectionCache.queryCache.clear();
console.log(`Cleared ${cacheSize} entries from taxonomy cache`);
res.json({
success: true,
message: `Cache cleared (${cacheSize} entries removed)`,
clearedEntries: cacheSize
});
} catch (error) {
console.error('Error clearing taxonomy cache:', error);
res.status(500).json({ error: 'Failed to clear cache' });
}
});
// Get all options for import fields
router.get('/field-options', async (req, res) => {
try {

View File

@@ -194,7 +194,7 @@ router.post('/upload', upload.single('image'), async (req, res) => {
}
// Create URL for the uploaded file
const baseUrl = 'https://acot.site';
const baseUrl = 'https://acob.acherryontop.com';
const imageUrl = `${baseUrl}/uploads/reusable/${req.file.filename}`;
const pool = req.app.locals.pool;

View File

@@ -29,6 +29,7 @@ function buildSanityCheckUserPrompt(products, prompts) {
tax_cat: p.tax_cat_name || p.tax_cat,
size_cat: p.size_cat_name || p.size_cat,
themes: p.theme_names || p.themes,
categories: p.category_names || p.categories,
weight: p.weight,
length: p.length,
width: p.width,
@@ -59,7 +60,7 @@ function buildSanityCheckUserPrompt(products, prompts) {
suggestion: 'Suggested fix or verification (optional)'
}
],
summary: '1-2 sentences summarizing the batch quality'
summary: '2-3 sentences summarizing the overall product quality'
}, null, 2));
parts.push('');