AI validation tweaks, add templates settings page and schema and routes

This commit is contained in:
2025-02-23 15:14:12 -05:00
parent 959a64aebc
commit 3f16413769
12 changed files with 1167 additions and 201 deletions

View File

@@ -32,32 +32,7 @@ function clearCache() {
};
}
// Debug endpoint to view prompt and cache status
router.get('/debug', async (req, res) => {
try {
console.log('Debug endpoint called');
const pool = req.app.locals.pool;
// Get a real supplier, company, and artist ID from the database
const [suppliers] = await pool.query('SELECT supplierid FROM suppliers LIMIT 1');
const [companies] = await pool.query('SELECT cat_id FROM product_categories WHERE type = 1 LIMIT 1');
const [artists] = await pool.query('SELECT cat_id FROM product_categories WHERE type = 40 LIMIT 1');
// Create a sample product with real IDs
const productsToUse = [{
supplierid: suppliers[0]?.supplierid || 1234,
company: companies[0]?.cat_id || 567,
artist: artists[0]?.cat_id || 890
}];
return await generateDebugResponse(pool, productsToUse, res);
} catch (error) {
console.error('Debug endpoint error:', error);
res.status(500).json({ error: error.message });
}
});
// New POST endpoint for debug with products
// Debug endpoint for viewing prompt and cache status
router.post('/debug', async (req, res) => {
try {
console.log('Debug POST endpoint called');
@@ -490,8 +465,7 @@ router.post('/validate', async (req, res) => {
content: fullPrompt
}
],
temperature: 0.3,
max_tokens: 4000,
temperature: 0.2,
response_format: { type: "json_object" }
});