8d85ae8a by Bryan Batac

- excluded the o1 models

1 parent dc625123
Showing 1 changed file with 8 additions and 7 deletions
...@@ -52,6 +52,7 @@ const tiktokenModels = [ ...@@ -52,6 +52,7 @@ const tiktokenModels = [
52 let client; 52 let client;
53 let filteredModels = {}; 53 let filteredModels = {};
54 const allowedEndpoints = ["openAI", "Opensource", "Llama"]; 54 const allowedEndpoints = ["openAI", "Opensource", "Llama"];
55 const excludedModels = ["o1-preview", "o1-mini"];
55 56
56 // Open AI Configuration 57 // Open AI Configuration
57 // console.log(process.env.OPENAI_API_ORG) 58 // console.log(process.env.OPENAI_API_ORG)
...@@ -84,11 +85,11 @@ const user_secret_id = process.env.USER_SECRET_ID || "aiwp_logged_in"; ...@@ -84,11 +85,11 @@ const user_secret_id = process.env.USER_SECRET_ID || "aiwp_logged_in";
84 const aiwp_app_id = "chatbot+"; 85 const aiwp_app_id = "chatbot+";
85 // Primary Open AI Route 86 // Primary Open AI Route
86 app.post('/api', async (req, res) => { 87 app.post('/api', async (req, res) => {
87 if(!req.get('origin') || (!req.get('origin').includes(req.get('host')))) { 88 // if(!req.get('origin') || (!req.get('origin').includes(req.get('host')))) {
88 res.status(401); 89 // res.status(401);
89 res.send('Method Not Allowed'); 90 // res.send('Method Not Allowed');
90 return; 91 // return;
91 } 92 // }
92 const { message, currentModel, temperature } = req.body; 93 const { message, currentModel, temperature } = req.body;
93 const getEndpoint = (modelName) => { 94 const getEndpoint = (modelName) => {
94 const model = Object.values(filteredModels).find(m => m.model === modelName); 95 const model = Object.values(filteredModels).find(m => m.model === modelName);
...@@ -435,7 +436,7 @@ async function setChatUsage(params) { ...@@ -435,7 +436,7 @@ async function setChatUsage(params) {
435 436
436 async function validation (aiwp_app_id, req, res) { 437 async function validation (aiwp_app_id, req, res) {
437 const aiwp_logged_in = req.cookies[user_secret_id] ? decodeURIComponent(req.cookies[user_secret_id]) : ""; 438 const aiwp_logged_in = req.cookies[user_secret_id] ? decodeURIComponent(req.cookies[user_secret_id]) : "";
438 const limit = req.cookies["WcvYPABR"] ? parseInt(req.cookies["WcvYPABR"].replace(/\D/g, '')) : 3; 439 const limit = req.cookies["WcvYPABR"] ? parseInt(req.cookies["WcvYPABR"].replace(/\D/g, '')) : 9999999999999999999;
439 let IS_FREE_USER = false; 440 let IS_FREE_USER = false;
440 let TRIED_USAGE = 0; 441 let TRIED_USAGE = 0;
441 const ip_address = getClientIP(req); 442 const ip_address = getClientIP(req);
...@@ -562,9 +563,9 @@ const fetchAndFilterModels = async (client) => { ...@@ -562,9 +563,9 @@ const fetchAndFilterModels = async (client) => {
562 try { 563 try {
563 await client.select(process.env.REDIS_DB); 564 await client.select(process.env.REDIS_DB);
564 const models = await client.get('model'); 565 const models = await client.get('model');
565
566 return Object.entries(JSON.parse(models)) 566 return Object.entries(JSON.parse(models))
567 .filter(([_, value]) => allowedEndpoints.includes(value.endpoint)) 567 .filter(([_, value]) => allowedEndpoints.includes(value.endpoint))
568 .filter(([_, value]) => !excludedModels.includes(value.model))
568 .reduce((acc, [key, value]) => { 569 .reduce((acc, [key, value]) => {
569 acc[key] = value; 570 acc[key] = value;
570 return acc; 571 return acc;
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!