Merge branch 'master' into add-product-upload-page
This commit is contained in:
@@ -3,11 +3,20 @@ const router = express.Router();
|
||||
const OpenAI = require('openai');
|
||||
const fs = require('fs').promises;
|
||||
const path = require('path');
|
||||
const dotenv = require('dotenv');
|
||||
|
||||
// Ensure environment variables are loaded
|
||||
dotenv.config({ path: path.join(__dirname, '../../.env') });
|
||||
|
||||
// Initialize OpenAI client
|
||||
const openai = new OpenAI({
|
||||
apiKey: process.env.OPENAI_API_KEY
|
||||
});
|
||||
|
||||
if (!process.env.OPENAI_API_KEY) {
|
||||
console.error('Warning: OPENAI_API_KEY is not set in environment variables');
|
||||
}
|
||||
|
||||
// Cache configuration
|
||||
const CACHE_TTL = 60 * 60 * 1000; // 1 hour in milliseconds
|
||||
|
||||
|
||||
Reference in New Issue
Block a user