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 = [
let client;
let filteredModels = {};
const allowedEndpoints = ["openAI", "Opensource", "Llama"];
const excludedModels = ["o1-preview", "o1-mini"];
// Open AI Configuration
// console.log(process.env.OPENAI_API_ORG)
......@@ -84,11 +85,11 @@ const user_secret_id = process.env.USER_SECRET_ID || "aiwp_logged_in";
const aiwp_app_id = "chatbot+";
// Primary Open AI Route
app.post('/api', async (req, res) => {
if(!req.get('origin') || (!req.get('origin').includes(req.get('host')))) {
res.status(401);
res.send('Method Not Allowed');
return;
}
// if(!req.get('origin') || (!req.get('origin').includes(req.get('host')))) {
// res.status(401);
// res.send('Method Not Allowed');
// return;
// }
const { message, currentModel, temperature } = req.body;
const getEndpoint = (modelName) => {
const model = Object.values(filteredModels).find(m => m.model === modelName);
......@@ -435,7 +436,7 @@ async function setChatUsage(params) {
async function validation (aiwp_app_id, req, res) {
const aiwp_logged_in = req.cookies[user_secret_id] ? decodeURIComponent(req.cookies[user_secret_id]) : "";
const limit = req.cookies["WcvYPABR"] ? parseInt(req.cookies["WcvYPABR"].replace(/\D/g, '')) : 3;
const limit = req.cookies["WcvYPABR"] ? parseInt(req.cookies["WcvYPABR"].replace(/\D/g, '')) : 9999999999999999999;
let IS_FREE_USER = false;
let TRIED_USAGE = 0;
const ip_address = getClientIP(req);
......@@ -562,9 +563,9 @@ const fetchAndFilterModels = async (client) => {
try {
await client.select(process.env.REDIS_DB);
const models = await client.get('model');
return Object.entries(JSON.parse(models))
.filter(([_, value]) => allowedEndpoints.includes(value.endpoint))
.filter(([_, value]) => !excludedModels.includes(value.model))
.reduce((acc, [key, value]) => {
acc[key] = value;
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!