Spaces:
Running
Running
Update server.js
Browse files
server.js
CHANGED
@@ -44,7 +44,9 @@ function getTotalRequests() {
|
|
44 |
|
45 |
|
46 |
function validateModel(req, res, next) {
|
47 |
-
const
|
|
|
|
|
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}`);
|