AI validation tweaks, add templates settings page and schema and routes
This commit is contained in:
@@ -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" }
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user