Ayeantics commited on
Commit
e5c5110
·
verified ·
1 Parent(s): 72161dc

Update server.js

Browse files
Files changed (1) hide show
  1. server.js +3 -1
server.js CHANGED
@@ -44,7 +44,9 @@ function getTotalRequests() {
44
 
45
 
46
  function validateModel(req, res, next) {
47
- const modelRequested = req.query.model; // Assuming the model name is passed as a query parameter
 
 
48
 
49
  if (!allowedModels.includes(modelRequested)) {
50
  console.log(`Forbidden model access attempted: ${modelRequested}`);
 
44
 
45
 
46
  function validateModel(req, res, next) {
47
+ const pathSegments = req.path.split('/');
48
+ // Example path: /v1/engines/gpt-3.5-turbo-0125/completions
49
+ const modelRequested = pathSegments[3]; // Adjust the index as necessary based on your routing
50
 
51
  if (!allowedModels.includes(modelRequested)) {
52
  console.log(`Forbidden model access attempted: ${modelRequested}`);